]> git.sur5r.net Git - u-boot/commitdiff
- Added CONFIG_BOOTP_DNS2 and CONFIG_BOOTP_SEND_HOSTNAME to CONFIG_BOOTP_MASK.
authorstroese <stroese>
Thu, 28 Aug 2003 14:17:32 +0000 (14:17 +0000)
committerstroese <stroese>
Thu, 28 Aug 2003 14:17:32 +0000 (14:17 +0000)
README
common/cmd_net.c
include/cmd_confdefs.h
include/configs/CPCI405.h
include/configs/CPCI4052.h
include/configs/CPCI405AB.h
include/net.h
net/bootp.c
net/net.c

diff --git a/README b/README
index efd46933066d7963ab72ad571b26a4422a8f5627..fb2529aac94e40ea582dba20ae584d95db2f6bea 100644 (file)
--- a/README
+++ b/README
@@ -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
index 4d4a1ea9ed5838eabf9ac8090d26e77b0baf0a27..e9b54d24509a73cb358934eaafaa8d5264f5815b 100644 (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);
 
index 8b8b0f58e7732a1c8b0f9af087f5d51ffd079f7c..d7f1fd4fed9617ff165954bdc693915812d5f568 100644 (file)
 #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
 
index 4be94ed854dee8b7cb1f837d01d39493be7f445f..b877043712bf65527a014b705abb833808a9a923 100644 (file)
 #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    | \
index 1f9d39c606a8c68e4b87a57c7d4a5b8ce0d35819..dd2fa7ffea76af76753454a36666438e6a3bc26a 100644 (file)
 
 #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    | \
index 00adfd5998ac1c18c4148ee542824494c9c2fa95..d55b51eb975dc82fb6d7223b8a81d714dea04ef2 100644 (file)
 
 #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    | \
index dd8d378045110c1f18e930f36bb42d9305fd8da3..2d4aa94d0d4f66af02a95a78952aef41d607c53c 100644 (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                */
index 31b224327e82f847bfb209eb2f5091037464f068..854ca16d6ab457d6f3baaf1688f91fa341fbc358 100644 (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",
index dafcc561e6a72d2a4552f9c38559719cf77e1404..a139742292d11f43a17a8accb99d23611f2a8a37 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -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                 */