|
@@ -76,7 +76,7 @@ static char *dhcpmsg2str(int type)
|
|
}
|
|
}
|
|
#endif
|
|
#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_prep (u8 *e); /*rtn new e after add own opts. */
|
|
extern u8 *dhcp_vendorex_proc (u8 *e); /*rtn next e if mine,else NULL */
|
|
extern u8 *dhcp_vendorex_proc (u8 *e); /*rtn next e if mine,else NULL */
|
|
#endif
|
|
#endif
|
|
@@ -181,7 +181,7 @@ static void BootpVendorFieldProcess (u8 * ext)
|
|
if (NetOurDNSIP == 0) {
|
|
if (NetOurDNSIP == 0) {
|
|
NetCopyIP (&NetOurDNSIP, (IPaddr_t *) (ext + 2));
|
|
NetCopyIP (&NetOurDNSIP, (IPaddr_t *) (ext + 2));
|
|
}
|
|
}
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_DNS2)
|
|
if ((NetOurDNS2IP == 0) && (size > 4)) {
|
|
if ((NetOurDNS2IP == 0) && (size > 4)) {
|
|
NetCopyIP (&NetOurDNS2IP, (IPaddr_t *) (ext + 2 + 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 *start = e;
|
|
u8 *cnt;
|
|
u8 *cnt;
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_VENDOREX)
|
|
u8 *x;
|
|
u8 *x;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_SEND_HOSTNAME)
|
|
char *hostname;
|
|
char *hostname;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -425,7 +425,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
|
|
*e++ = tmp >> 8;
|
|
*e++ = tmp >> 8;
|
|
*e++ = tmp & 0xff;
|
|
*e++ = tmp & 0xff;
|
|
}
|
|
}
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_SEND_HOSTNAME)
|
|
if ((hostname = getenv ("hostname"))) {
|
|
if ((hostname = getenv ("hostname"))) {
|
|
int hostnamelen = strlen (hostname);
|
|
int hostnamelen = strlen (hostname);
|
|
|
|
|
|
@@ -436,7 +436,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_VENDOREX)
|
|
if ((x = dhcp_vendorex_prep (e)))
|
|
if ((x = dhcp_vendorex_prep (e)))
|
|
return x - start;
|
|
return x - start;
|
|
#endif
|
|
#endif
|
|
@@ -444,39 +444,39 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
|
|
*e++ = 55; /* Parameter Request List */
|
|
*e++ = 55; /* Parameter Request List */
|
|
cnt = e++; /* Pointer to count of requested items */
|
|
cnt = e++; /* Pointer to count of requested items */
|
|
*cnt = 0;
|
|
*cnt = 0;
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_SUBNETMASK)
|
|
*e++ = 1; /* Subnet Mask */
|
|
*e++ = 1; /* Subnet Mask */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_TIMEOFFSET)
|
|
*e++ = 2;
|
|
*e++ = 2;
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_GATEWAY)
|
|
*e++ = 3; /* Router Option */
|
|
*e++ = 3; /* Router Option */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_DNS)
|
|
*e++ = 6; /* DNS Server(s) */
|
|
*e++ = 6; /* DNS Server(s) */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_HOSTNAME)
|
|
*e++ = 12; /* Hostname */
|
|
*e++ = 12; /* Hostname */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_BOOTFILESIZE)
|
|
*e++ = 13; /* Boot File Size */
|
|
*e++ = 13; /* Boot File Size */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_BOOTPATH)
|
|
*e++ = 17; /* Boot path */
|
|
*e++ = 17; /* Boot path */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_NISDOMAIN)
|
|
*e++ = 40; /* NIS Domain name request */
|
|
*e++ = 40; /* NIS Domain name request */
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_NTPSERVER)
|
|
*e++ = 42;
|
|
*e++ = 42;
|
|
*cnt += 1;
|
|
*cnt += 1;
|
|
#endif
|
|
#endif
|
|
@@ -493,7 +493,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
|
|
|
|
|
|
#else /* CFG_CMD_DHCP */
|
|
#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)
|
|
static int BootpExtended (u8 * e)
|
|
{
|
|
{
|
|
@@ -515,43 +515,43 @@ static int BootpExtended (u8 * e)
|
|
*e++ = (576 - 312 + OPT_SIZE) & 0xff;
|
|
*e++ = (576 - 312 + OPT_SIZE) & 0xff;
|
|
#endif /* CFG_CMD_DHCP */
|
|
#endif /* CFG_CMD_DHCP */
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_SUBNETMASK)
|
|
*e++ = 1; /* Subnet mask request */
|
|
*e++ = 1; /* Subnet mask request */
|
|
*e++ = 4;
|
|
*e++ = 4;
|
|
e += 4;
|
|
e += 4;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_GATEWAY)
|
|
*e++ = 3; /* Default gateway request */
|
|
*e++ = 3; /* Default gateway request */
|
|
*e++ = 4;
|
|
*e++ = 4;
|
|
e += 4;
|
|
e += 4;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_DNS)
|
|
*e++ = 6; /* Domain Name Server */
|
|
*e++ = 6; /* Domain Name Server */
|
|
*e++ = 4;
|
|
*e++ = 4;
|
|
e += 4;
|
|
e += 4;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_HOSTNAME)
|
|
*e++ = 12; /* Host name request */
|
|
*e++ = 12; /* Host name request */
|
|
*e++ = 32;
|
|
*e++ = 32;
|
|
e += 32;
|
|
e += 32;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_BOOTFILESIZE)
|
|
*e++ = 13; /* Boot file size */
|
|
*e++ = 13; /* Boot file size */
|
|
*e++ = 2;
|
|
*e++ = 2;
|
|
e += 2;
|
|
e += 2;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_BOOTPATH)
|
|
*e++ = 17; /* Boot path */
|
|
*e++ = 17; /* Boot path */
|
|
*e++ = 32;
|
|
*e++ = 32;
|
|
e += 32;
|
|
e += 32;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_NISDOMAIN)
|
|
*e++ = 40; /* NIS Domain name request */
|
|
*e++ = 40; /* NIS Domain name request */
|
|
*e++ = 32;
|
|
*e++ = 32;
|
|
e += 32;
|
|
e += 32;
|
|
@@ -726,7 +726,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
|
|
case 1:
|
|
case 1:
|
|
NetCopyIP (&NetOurSubnetMask, (popt + 2));
|
|
NetCopyIP (&NetOurSubnetMask, (popt + 2));
|
|
break;
|
|
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 */
|
|
case 2: /* Time offset */
|
|
NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2));
|
|
NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2));
|
|
NetTimeOffset = ntohl (NetTimeOffset);
|
|
NetTimeOffset = ntohl (NetTimeOffset);
|
|
@@ -737,7 +737,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
|
|
break;
|
|
break;
|
|
case 6:
|
|
case 6:
|
|
NetCopyIP (&NetOurDNSIP, (popt + 2));
|
|
NetCopyIP (&NetOurDNSIP, (popt + 2));
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_DNS2)
|
|
if (*(popt + 1) > 4) {
|
|
if (*(popt + 1) > 4) {
|
|
NetCopyIP (&NetOurDNS2IP, (popt + 2 + 4));
|
|
NetCopyIP (&NetOurDNS2IP, (popt + 2 + 4));
|
|
}
|
|
}
|
|
@@ -755,7 +755,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
|
|
memcpy (&NetOurRootPath, popt + 2, size);
|
|
memcpy (&NetOurRootPath, popt + 2, size);
|
|
NetOurRootPath[size] = 0;
|
|
NetOurRootPath[size] = 0;
|
|
break;
|
|
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 */
|
|
case 42: /* NTP server IP */
|
|
NetCopyIP (&NetNtpServerIP, (popt + 2));
|
|
NetCopyIP (&NetNtpServerIP, (popt + 2));
|
|
break;
|
|
break;
|
|
@@ -801,7 +801,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
-#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX)
|
|
|
|
|
|
+#if defined(CONFIG_BOOTP_VENDOREX)
|
|
if (dhcp_vendorex_proc (popt))
|
|
if (dhcp_vendorex_proc (popt))
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|