Commit fe389a82c9f9f29c54768e3b3ac947487ff85d59

Authored by stroese
1 parent d94f92cbd7

- Added CONFIG_BOOTP_DNS2 and CONFIG_BOOTP_SEND_HOSTNAME to CONFIG_BOOTP_MASK.

Showing 9 changed files with 74 additions and 13 deletions Side-by-side Diff

... ... @@ -901,6 +901,29 @@
901 901 4th and following
902 902 BOOTP requests: delay 0 ... 8 sec
903 903  
  904 +- DHCP Advanced Options:
  905 + CONFIG_BOOTP_MASK
  906 +
  907 + You can fine tune the DHCP functionality by adding
  908 + these flags to the CONFIG_BOOTP_MASK define:
  909 +
  910 + CONFIG_BOOTP_DNS2 - If a DHCP client requests the DNS
  911 + serverip from a DHCP server, it is possible that more
  912 + than one DNS serverip is offered to the client.
  913 + If CONFIG_BOOTP_DNS2 is enabled, the secondary DNS
  914 + serverip will be stored in the additional environment
  915 + variable "dnsip2". The first DNS serverip is always
  916 + stored in the variable "dnsip", when CONFIG_BOOTP_DNS
  917 + is added to the CONFIG_BOOTP_MASK.
  918 +
  919 + CONFIG_BOOTP_SEND_HOSTNAME - Some DHCP servers are capable
  920 + to do a dynamic update of a DNS server. To do this, they
  921 + need the hostname of the DHCP requester.
  922 + If CONFIG_BOOP_SEND_HOSTNAME is added to the
  923 + CONFIG_BOOTP_MASK, the content of the "hostname"
  924 + environment variable is passed as option 12 to
  925 + the DHCP server.
  926 +
904 927 - Status LED: CONFIG_STATUS_LED
905 928  
906 929 Several configurations allow to display the current
... ... @@ -2118,6 +2141,7 @@
2118 2141  
2119 2142 bootfile - see above
2120 2143 dnsip - IP address of your Domain Name Server
  2144 + dnsip2 - IP address of your secondary Domain Name Server
2121 2145 gatewayip - IP address of the Gateway (Router) to use
2122 2146 hostname - Target hostname
2123 2147 ipaddr - see above
... ... @@ -116,6 +116,13 @@
116 116 setenv("dnsip", tmp);
117 117 }
118 118  
  119 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
  120 + if (NetOurDNS2IP) {
  121 + ip_to_string (NetOurDNS2IP, tmp);
  122 + setenv("dnsip2", tmp);
  123 + }
  124 +#endif
  125 +
119 126 if (NetOurNISDomain[0])
120 127 setenv("domain", NetOurNISDomain);
121 128  
include/cmd_confdefs.h
... ... @@ -148,6 +148,8 @@
148 148 #define CONFIG_BOOTP_BOOTPATH 0x00000010
149 149 #define CONFIG_BOOTP_BOOTFILESIZE 0x00000020
150 150 #define CONFIG_BOOTP_DNS 0x00000040
  151 +#define CONFIG_BOOTP_DNS2 0x00000080
  152 +#define CONFIG_BOOTP_SEND_HOSTNAME 0x00000100
151 153  
152 154 #define CONFIG_BOOTP_VENDOREX 0x80000000
153 155  
include/configs/CPCI405.h
... ... @@ -69,12 +69,10 @@
69 69 #define CONFIG_MII 1 /* MII PHY management */
70 70 #define CONFIG_PHY_ADDR 0 /* PHY address */
71 71  
72   -#if 0 /* test-only */
73   -#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
74   - CONFIG_BOOTP_VENDOREX)
75   -#else
76   -#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT)
77   -#endif
  72 +#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
  73 + CONFIG_BOOTP_DNS | \
  74 + CONFIG_BOOTP_DNS2 | \
  75 + CONFIG_BOOTP_SEND_HOSTNAME )
78 76  
79 77 #define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
80 78 CFG_CMD_DHCP | \
include/configs/CPCI4052.h
... ... @@ -72,12 +72,10 @@
72 72  
73 73 #define CONFIG_RTC_M48T35A 1 /* ST Electronics M48 timekeeper */
74 74  
75   -#if 0 /* test-only */
76   -#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
77   - CONFIG_BOOTP_VENDOREX)
78   -#else
79   -#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT)
80   -#endif
  75 +#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
  76 + CONFIG_BOOTP_DNS | \
  77 + CONFIG_BOOTP_DNS2 | \
  78 + CONFIG_BOOTP_SEND_HOSTNAME )
81 79  
82 80 #define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
83 81 CFG_CMD_DHCP | \
include/configs/CPCI405AB.h
... ... @@ -65,7 +65,10 @@
65 65  
66 66 #define CONFIG_RTC_M48T35A 1 /* ST Electronics M48 timekeeper */
67 67  
68   -#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT)
  68 +#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
  69 + CONFIG_BOOTP_DNS | \
  70 + CONFIG_BOOTP_DNS2 | \
  71 + CONFIG_BOOTP_SEND_HOSTNAME )
69 72  
70 73 #define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
71 74 CFG_CMD_DHCP | \
... ... @@ -275,6 +275,9 @@
275 275 extern IPaddr_t NetOurGatewayIP; /* Our gateway IP addresse */
276 276 extern IPaddr_t NetOurSubnetMask; /* Our subnet mask (0 = unknown)*/
277 277 extern IPaddr_t NetOurDNSIP; /* Our Domain Name Server (0 = unknown)*/
  278 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
  279 +extern IPaddr_t NetOurDNS2IP; /* Our 2nd Domain Name Server (0 = unknown)*/
  280 +#endif
278 281 extern char NetOurNISDomain[32]; /* Our NIS domain */
279 282 extern char NetOurHostName[32]; /* Our hostname */
280 283 extern char NetOurRootPath[64]; /* Our root path */
... ... @@ -174,6 +174,11 @@
174 174 if (NetOurDNSIP == 0) {
175 175 NetCopyIP(&NetOurDNSIP, (IPaddr_t*)(ext+2));
176 176 }
  177 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
  178 + if ((NetOurDNS2IP == 0) && (size > 4)) {
  179 + NetCopyIP(&NetOurDNS2IP, (IPaddr_t*)(ext+2+4));
  180 + }
  181 +#endif
177 182 break;
178 183 case 7: /* Log server - Not yet supported */
179 184 break;
... ... @@ -365,6 +370,9 @@
365 370 #if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
366 371 u8 *x;
367 372 #endif
  373 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
  374 + uchar *hostname;
  375 +#endif
368 376  
369 377 *e++ = 99; /* RFC1048 Magic Cookie */
370 378 *e++ = 130;
... ... @@ -402,6 +410,16 @@
402 410 *e++ = tmp & 0xff;
403 411 }
404 412  
  413 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
  414 + if ( (hostname = getenv("hostname")) ) {
  415 + int hostnamelen = strlen(hostname);
  416 + *e++ = 12; /* Hostname */
  417 + *e++ = hostnamelen;
  418 + memcpy(e,hostname,hostnamelen);
  419 + e += hostnamelen;
  420 + }
  421 +#endif
  422 +
405 423 #if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
406 424 if ((x = dhcp_vendorex_prep (e)))
407 425 return x - start ;
... ... @@ -690,6 +708,11 @@
690 708 break;
691 709 case 6:
692 710 NetCopyIP(&NetOurDNSIP, (popt+2));
  711 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
  712 + if ( *(popt+1) > 4 ) {
  713 + NetCopyIP(&NetOurDNS2IP, (popt+2+4));
  714 + }
  715 +#endif
693 716 break;
694 717 case 12:
695 718 size = truncate_sz ("Host Name",
... ... @@ -84,6 +84,9 @@
84 84 IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */
85 85 IPaddr_t NetOurGatewayIP=0; /* Our gateways IP address */
86 86 IPaddr_t NetOurDNSIP=0; /* Our DNS IP address */
  87 +#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
  88 +IPaddr_t NetOurDNS2IP=0; /* Our 2nd DNS IP address */
  89 +#endif
87 90 char NetOurNISDomain[32]={0,}; /* Our NIS domain */
88 91 char NetOurHostName[32]={0,}; /* Our hostname */
89 92 char NetOurRootPath[64]={0,}; /* Our bootpath */