Changed DHCP client to use ip address from server option field #54 from the OFFER-paket in the server option field #54 in the REQUEST-paket. This fixes a problem using a Windows 2000 DHCP server, where the DHCP-server is not the TFTP-server.
This commit is contained in:
parent
d126bfbdbd
commit
759a51b4f3
|
@ -56,6 +56,7 @@ ulong seed1, seed2;
|
||||||
#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
|
#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
|
||||||
dhcp_state_t dhcp_state = INIT;
|
dhcp_state_t dhcp_state = INIT;
|
||||||
unsigned int dhcp_leasetime = 0;
|
unsigned int dhcp_leasetime = 0;
|
||||||
|
IPaddr_t NetDHCPServerIP = 0;
|
||||||
static void DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len);
|
static void DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len);
|
||||||
|
|
||||||
/* For Debug */
|
/* For Debug */
|
||||||
|
@ -716,7 +717,7 @@ static void DhcpOptionsProcess(uchar *popt)
|
||||||
case 53: /* Ignore Message Type Option */
|
case 53: /* Ignore Message Type Option */
|
||||||
break;
|
break;
|
||||||
case 54:
|
case 54:
|
||||||
NetCopyIP(&NetServerIP, (popt+2));
|
NetCopyIP(&NetDHCPServerIP, (popt+2));
|
||||||
break;
|
break;
|
||||||
case 58: /* Ignore Renewal Time Option */
|
case 58: /* Ignore Renewal Time Option */
|
||||||
break;
|
break;
|
||||||
|
@ -788,7 +789,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
|
||||||
* Copy options from OFFER packet if present
|
* Copy options from OFFER packet if present
|
||||||
*/
|
*/
|
||||||
NetCopyIP(&OfferedIP, &bp->bp_yiaddr);
|
NetCopyIP(&OfferedIP, &bp->bp_yiaddr);
|
||||||
extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST, NetServerIP, OfferedIP);
|
extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
|
||||||
|
|
||||||
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
|
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
|
||||||
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
|
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
|
||||||
|
@ -832,11 +833,10 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
|
||||||
|
|
||||||
debug ("TRANSITIONING TO REQUESTING STATE\n");
|
debug ("TRANSITIONING TO REQUESTING STATE\n");
|
||||||
dhcp_state = REQUESTING;
|
dhcp_state = REQUESTING;
|
||||||
#if 0
|
|
||||||
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
|
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
|
||||||
DhcpOptionsProcess(&bp->bp_vend[4]);
|
DhcpOptionsProcess(&bp->bp_vend[4]);
|
||||||
|
|
||||||
#endif
|
|
||||||
BootpCopyNetParams(bp); /* Store net params from reply */
|
BootpCopyNetParams(bp); /* Store net params from reply */
|
||||||
|
|
||||||
NetSetTimeout(TIMEOUT * CFG_HZ, BootpTimeout);
|
NetSetTimeout(TIMEOUT * CFG_HZ, BootpTimeout);
|
||||||
|
|
Loading…
Reference in New Issue