- Added CONFIG_BOOTP_DNS2 and CONFIG_BOOTP_SEND_HOSTNAME to CONFIG_BOOTP_MASK.

This commit is contained in:
stroese 2003-08-28 14:17:32 +00:00
parent d94f92cbd7
commit fe389a82c9
9 changed files with 74 additions and 13 deletions

24
README
View file

@ -901,6 +901,29 @@ The following options need to be configured:
4th and following
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:
CONFIG_BOOTP_DNS2 - If a DHCP client requests the DNS
serverip from a DHCP server, it is possible that more
than one DNS serverip is offered to the client.
If CONFIG_BOOTP_DNS2 is enabled, the secondary DNS
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.
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.
- Status LED: CONFIG_STATUS_LED
Several configurations allow to display the current
@ -2118,6 +2141,7 @@ depending the information provided by your boot server:
bootfile - see above
dnsip - IP address of your Domain Name Server
dnsip2 - IP address of your secondary Domain Name Server
gatewayip - IP address of the Gateway (Router) to use
hostname - Target hostname
ipaddr - see above

View file

@ -116,6 +116,13 @@ static void netboot_update_env(void)
setenv("dnsip", tmp);
}
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
if (NetOurDNS2IP) {
ip_to_string (NetOurDNS2IP, tmp);
setenv("dnsip2", tmp);
}
#endif
if (NetOurNISDomain[0])
setenv("domain", NetOurNISDomain);

View file

@ -148,6 +148,8 @@
#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_VENDOREX 0x80000000

View file

@ -69,12 +69,10 @@
#define CONFIG_MII 1 /* MII PHY management */
#define CONFIG_PHY_ADDR 0 /* PHY address */
#if 0 /* test-only */
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_VENDOREX)
#else
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT)
#endif
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_DNS | \
CONFIG_BOOTP_DNS2 | \
CONFIG_BOOTP_SEND_HOSTNAME )
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
CFG_CMD_DHCP | \

View file

@ -72,12 +72,10 @@
#define CONFIG_RTC_M48T35A 1 /* ST Electronics M48 timekeeper */
#if 0 /* test-only */
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_VENDOREX)
#else
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT)
#endif
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_DNS | \
CONFIG_BOOTP_DNS2 | \
CONFIG_BOOTP_SEND_HOSTNAME )
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
CFG_CMD_DHCP | \

View file

@ -65,7 +65,10 @@
#define CONFIG_RTC_M48T35A 1 /* ST Electronics M48 timekeeper */
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT)
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_DNS | \
CONFIG_BOOTP_DNS2 | \
CONFIG_BOOTP_SEND_HOSTNAME )
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
CFG_CMD_DHCP | \

View file

@ -275,6 +275,9 @@ 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)
extern IPaddr_t NetOurDNS2IP; /* Our 2nd Domain Name Server (0 = unknown)*/
#endif
extern char NetOurNISDomain[32]; /* Our NIS domain */
extern char NetOurHostName[32]; /* Our hostname */
extern char NetOurRootPath[64]; /* Our root path */

View file

@ -174,6 +174,11 @@ static void BootpVendorFieldProcess(u8 *ext)
if (NetOurDNSIP == 0) {
NetCopyIP(&NetOurDNSIP, (IPaddr_t*)(ext+2));
}
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
if ((NetOurDNS2IP == 0) && (size > 4)) {
NetCopyIP(&NetOurDNS2IP, (IPaddr_t*)(ext+2+4));
}
#endif
break;
case 7: /* Log server - Not yet supported */
break;
@ -365,6 +370,9 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID, IPaddr_t Req
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
u8 *x;
#endif
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
uchar *hostname;
#endif
*e++ = 99; /* RFC1048 Magic Cookie */
*e++ = 130;
@ -402,6 +410,16 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID, IPaddr_t Req
*e++ = tmp & 0xff;
}
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
if ( (hostname = getenv("hostname")) ) {
int hostnamelen = strlen(hostname);
*e++ = 12; /* Hostname */
*e++ = hostnamelen;
memcpy(e,hostname,hostnamelen);
e += hostnamelen;
}
#endif
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
if ((x = dhcp_vendorex_prep (e)))
return x - start ;
@ -690,6 +708,11 @@ static void DhcpOptionsProcess(uchar *popt)
break;
case 6:
NetCopyIP(&NetOurDNSIP, (popt+2));
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
if ( *(popt+1) > 4 ) {
NetCopyIP(&NetOurDNS2IP, (popt+2+4));
}
#endif
break;
case 12:
size = truncate_sz ("Host Name",

View file

@ -84,6 +84,9 @@
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)
IPaddr_t NetOurDNS2IP=0; /* Our 2nd DNS IP address */
#endif
char NetOurNISDomain[32]={0,}; /* Our NIS domain */
char NetOurHostName[32]={0,}; /* Our hostname */
char NetOurRootPath[64]={0,}; /* Our bootpath */