From 1fe80d79c5c4e52d3410a7ab4b8515da095cdab3 Mon Sep 17 00:00:00 2001 From: Jon Loeliger Date: Mon, 9 Jul 2007 22:08:34 -0500 Subject: [PATCH] Finally retire cmd_confdefs.h and CONFIG_BOOTP_MASK! All of the choices for CONFIG_BOOTP_ are now documented in the README file. You must now individually select exactly the set that you want using a series of #define CONFIG_BOOTP_ statements in the board port config files now. Signed-off-by: Jon Loeliger --- README | 28 +++++++++++++++------- common/cmd_net.c | 6 ++--- include/cmd_confdefs.h | 33 -------------------------- include/config_bootp.h | 41 -------------------------------- include/net.h | 2 +- net/bootp.c | 54 +++++++++++++++++++++--------------------- net/net.c | 2 +- 7 files changed, 51 insertions(+), 115 deletions(-) delete mode 100644 include/cmd_confdefs.h delete mode 100644 include/config_bootp.h diff --git a/README b/README index a45181961d..cfbd39afb5 100644 --- a/README +++ b/README @@ -1125,10 +1125,21 @@ The following options need to be configured: BOOTP requests: delay 0 ... 8 sec - DHCP Advanced Options: - CONFIG_BOOTP_MASK - - You can fine tune the DHCP functionality by adding - these flags to the CONFIG_BOOTP_MASK define: + You can fine tune the DHCP functionality by defining + CONFIG_BOOTP_* symbols: + + CONFIG_BOOTP_SUBNETMASK + CONFIG_BOOTP_GATEWAY + CONFIG_BOOTP_HOSTNAME + CONFIG_BOOTP_NISDOMAIN + CONFIG_BOOTP_BOOTPATH + CONFIG_BOOTP_BOOTFILESIZE + CONFIG_BOOTP_DNS + CONFIG_BOOTP_DNS2 + CONFIG_BOOTP_SEND_HOSTNAME + CONFIG_BOOTP_NTPSERVER + CONFIG_BOOTP_TIMEOFFSET + CONFIG_BOOTP_VENDOREX CONFIG_BOOTP_DNS2 - If a DHCP client requests the DNS serverip from a DHCP server, it is possible that more @@ -1137,15 +1148,14 @@ The following options need to be configured: serverip will be stored in the additional environment variable "dnsip2". The first DNS serverip is always stored in the variable "dnsip", when CONFIG_BOOTP_DNS - is added to the CONFIG_BOOTP_MASK. + is defined. CONFIG_BOOTP_SEND_HOSTNAME - Some DHCP servers are capable to do a dynamic update of a DNS server. To do this, they need the hostname of the DHCP requester. - If CONFIG_BOOP_SEND_HOSTNAME is added to the - CONFIG_BOOTP_MASK, the content of the "hostname" - environment variable is passed as option 12 to - the DHCP server. + If CONFIG_BOOP_SEND_HOSTNAME is defined, the content + of the "hostname" environment variable is passed as + option 12 to the DHCP server. - CDP Options: CONFIG_CDP_DEVICE_ID diff --git a/common/cmd_net.c b/common/cmd_net.c index da55f14a2e..8f766c8dbb 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -128,7 +128,7 @@ static void netboot_update_env (void) ip_to_string (NetOurDNSIP, tmp); setenv ("dnsip", tmp); } -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#if defined(CONFIG_BOOTP_DNS2) if (NetOurDNS2IP) { ip_to_string (NetOurDNS2IP, tmp); setenv ("dnsip2", tmp); @@ -138,14 +138,14 @@ static void netboot_update_env (void) setenv ("domain", NetOurNISDomain); #if defined(CONFIG_CMD_SNTP) \ - && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET) + && defined(CONFIG_BOOTP_TIMEOFFSET) if (NetTimeOffset) { sprintf (tmp, "%d", NetTimeOffset); setenv ("timeoffset", tmp); } #endif #if defined(CONFIG_CMD_SNTP) \ - && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER) + && defined(CONFIG_BOOTP_NTPSERVER) if (NetNtpServerIP) { ip_to_string (NetNtpServerIP, tmp); setenv ("ntpserverip", tmp); diff --git a/include/cmd_confdefs.h b/include/cmd_confdefs.h deleted file mode 100644 index 3bfb2aed39..0000000000 --- a/include/cmd_confdefs.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * (C) Copyright 2000-2002 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef _CMD_CONFIG_H -#define _CMD_CONFIG_H - -/* - * Temporary placeholder until all users directly - * include the proper include file, "config_bootp.h". - */ -#include "config_bootp.h" - -#endif /* _CMD_CONFIG_H */ diff --git a/include/config_bootp.h b/include/config_bootp.h deleted file mode 100644 index f0c9360180..0000000000 --- a/include/config_bootp.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2007 Freescale Semiconductor, Inc. - * - * This file is licensed under the terms of the GNU General Public - * License Version 2. This file is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef _CONFIG_BOOTP_H -#define _CONFIG_BOOTP_H - -/* - * Optional BOOTP fields - */ - -#define CONFIG_BOOTP_SUBNETMASK 0x00000001 -#define CONFIG_BOOTP_GATEWAY 0x00000002 -#define CONFIG_BOOTP_HOSTNAME 0x00000004 -#define CONFIG_BOOTP_NISDOMAIN 0x00000008 -#define CONFIG_BOOTP_BOOTPATH 0x00000010 -#define CONFIG_BOOTP_BOOTFILESIZE 0x00000020 -#define CONFIG_BOOTP_DNS 0x00000040 -#define CONFIG_BOOTP_DNS2 0x00000080 -#define CONFIG_BOOTP_SEND_HOSTNAME 0x00000100 -#define CONFIG_BOOTP_NTPSERVER 0x00000200 -#define CONFIG_BOOTP_TIMEOFFSET 0x00000400 - -#define CONFIG_BOOTP_VENDOREX 0x80000000 - -#define CONFIG_BOOTP_ALL (~CONFIG_BOOTP_VENDOREX) - -#define CONFIG_BOOTP_DEFAULT (CONFIG_BOOTP_SUBNETMASK | \ - CONFIG_BOOTP_GATEWAY | \ - CONFIG_BOOTP_HOSTNAME | \ - CONFIG_BOOTP_BOOTPATH) - -#ifndef CONFIG_BOOTP_MASK -#define CONFIG_BOOTP_MASK CONFIG_BOOTP_DEFAULT -#endif - -#endif /* _CONFIG_BOOTP_H */ diff --git a/include/net.h b/include/net.h index f6f33fff91..9671948009 100644 --- a/include/net.h +++ b/include/net.h @@ -296,7 +296,7 @@ typedef struct icmphdr { extern IPaddr_t NetOurGatewayIP; /* Our gateway IP addresse */ extern IPaddr_t NetOurSubnetMask; /* Our subnet mask (0 = unknown)*/ extern IPaddr_t NetOurDNSIP; /* Our Domain Name Server (0 = unknown)*/ -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#if defined(CONFIG_BOOTP_DNS2) extern IPaddr_t NetOurDNS2IP; /* Our 2nd Domain Name Server (0 = unknown)*/ #endif extern char NetOurNISDomain[32]; /* Our NIS domain */ diff --git a/net/bootp.c b/net/bootp.c index 0c7c193e8b..ac9455e1ab 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -76,7 +76,7 @@ static char *dhcpmsg2str(int type) } #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#if defined(CONFIG_BOOTP_VENDOREX) extern u8 *dhcp_vendorex_prep (u8 *e); /*rtn new e after add own opts. */ extern u8 *dhcp_vendorex_proc (u8 *e); /*rtn next e if mine,else NULL */ #endif @@ -181,7 +181,7 @@ static void BootpVendorFieldProcess (u8 * ext) if (NetOurDNSIP == 0) { NetCopyIP (&NetOurDNSIP, (IPaddr_t *) (ext + 2)); } -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#if defined(CONFIG_BOOTP_DNS2) if ((NetOurDNS2IP == 0) && (size > 4)) { NetCopyIP (&NetOurDNS2IP, (IPaddr_t *) (ext + 2 + 4)); } @@ -383,10 +383,10 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R u8 *start = e; u8 *cnt; -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#if defined(CONFIG_BOOTP_VENDOREX) u8 *x; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME) +#if defined(CONFIG_BOOTP_SEND_HOSTNAME) char *hostname; #endif @@ -425,7 +425,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R *e++ = tmp >> 8; *e++ = tmp & 0xff; } -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME) +#if defined(CONFIG_BOOTP_SEND_HOSTNAME) if ((hostname = getenv ("hostname"))) { int hostnamelen = strlen (hostname); @@ -436,7 +436,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R } #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#if defined(CONFIG_BOOTP_VENDOREX) if ((x = dhcp_vendorex_prep (e))) return x - start; #endif @@ -444,39 +444,39 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R *e++ = 55; /* Parameter Request List */ cnt = e++; /* Pointer to count of requested items */ *cnt = 0; -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK) +#if defined(CONFIG_BOOTP_SUBNETMASK) *e++ = 1; /* Subnet Mask */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET) +#if defined(CONFIG_BOOTP_TIMEOFFSET) *e++ = 2; *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY) +#if defined(CONFIG_BOOTP_GATEWAY) *e++ = 3; /* Router Option */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS) +#if defined(CONFIG_BOOTP_DNS) *e++ = 6; /* DNS Server(s) */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME) +#if defined(CONFIG_BOOTP_HOSTNAME) *e++ = 12; /* Hostname */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE) +#if defined(CONFIG_BOOTP_BOOTFILESIZE) *e++ = 13; /* Boot File Size */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH) +#if defined(CONFIG_BOOTP_BOOTPATH) *e++ = 17; /* Boot path */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN) +#if defined(CONFIG_BOOTP_NISDOMAIN) *e++ = 40; /* NIS Domain name request */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER) +#if defined(CONFIG_BOOTP_NTPSERVER) *e++ = 42; *cnt += 1; #endif @@ -493,7 +493,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R #else /* CFG_CMD_DHCP */ /* - * Warning: no field size check - change CONFIG_BOOTP_MASK at your own risk! + * Warning: no field size check - change CONFIG_BOOTP_* at your own risk! */ static int BootpExtended (u8 * e) { @@ -515,43 +515,43 @@ static int BootpExtended (u8 * e) *e++ = (576 - 312 + OPT_SIZE) & 0xff; #endif /* CFG_CMD_DHCP */ -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK) +#if defined(CONFIG_BOOTP_SUBNETMASK) *e++ = 1; /* Subnet mask request */ *e++ = 4; e += 4; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY) +#if defined(CONFIG_BOOTP_GATEWAY) *e++ = 3; /* Default gateway request */ *e++ = 4; e += 4; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS) +#if defined(CONFIG_BOOTP_DNS) *e++ = 6; /* Domain Name Server */ *e++ = 4; e += 4; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME) +#if defined(CONFIG_BOOTP_HOSTNAME) *e++ = 12; /* Host name request */ *e++ = 32; e += 32; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE) +#if defined(CONFIG_BOOTP_BOOTFILESIZE) *e++ = 13; /* Boot file size */ *e++ = 2; e += 2; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH) +#if defined(CONFIG_BOOTP_BOOTPATH) *e++ = 17; /* Boot path */ *e++ = 32; e += 32; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN) +#if defined(CONFIG_BOOTP_NISDOMAIN) *e++ = 40; /* NIS Domain name request */ *e++ = 32; e += 32; @@ -726,7 +726,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) case 1: NetCopyIP (&NetOurSubnetMask, (popt + 2)); break; -#if defined(CONFIG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET) +#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET) case 2: /* Time offset */ NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2)); NetTimeOffset = ntohl (NetTimeOffset); @@ -737,7 +737,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) break; case 6: NetCopyIP (&NetOurDNSIP, (popt + 2)); -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#if defined(CONFIG_BOOTP_DNS2) if (*(popt + 1) > 4) { NetCopyIP (&NetOurDNS2IP, (popt + 2 + 4)); } @@ -755,7 +755,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) memcpy (&NetOurRootPath, popt + 2, size); NetOurRootPath[size] = 0; break; -#if defined(CONFIG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER) +#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER) case 42: /* NTP server IP */ NetCopyIP (&NetNtpServerIP, (popt + 2)); break; @@ -801,7 +801,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) } break; default: -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#if defined(CONFIG_BOOTP_VENDOREX) if (dhcp_vendorex_proc (popt)) break; #endif diff --git a/net/net.c b/net/net.c index 1b7b4a8637..f96eb28b35 100644 --- a/net/net.c +++ b/net/net.c @@ -110,7 +110,7 @@ DECLARE_GLOBAL_DATA_PTR; IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */ IPaddr_t NetOurGatewayIP=0; /* Our gateways IP address */ IPaddr_t NetOurDNSIP=0; /* Our DNS IP address */ -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#if defined(CONFIG_BOOTP_DNS2) IPaddr_t NetOurDNS2IP=0; /* Our 2nd DNS IP address */ #endif char NetOurNISDomain[32]={0,}; /* Our NIS domain */ -- 2.30.2