Skip to content
Snippets Groups Projects
Commit e5c794e4 authored by Justin Flammia's avatar Justin Flammia Committed by Wolfgang Denk
Browse files

DHCP Client Fix


This is a multi-part message in MIME format.

commit e6e505eae94ed721e123e177489291fc4544b7b8
Author: Justin Flammia <jflammia@savantav.com>
Date:   Mon Oct 29 17:19:03 2007 -0400

    Found a bug in the way the DHCP Request packet is built, where the IP address
    that is offered by the server is bound to prematurely. This patch is a fix of
    that bug where the IP address offered by the DHCP server is not used until
    after the DHCP ACK from the server is received.

Signed-off-by: default avatarJustin Flammia <jflammia@savantav.com>
Signed-off-by: default avatarBen Warren <bwarren@qstreams.com>
parent 8287b3b5
No related branches found
No related tags found
No related merge requests found
...@@ -850,9 +850,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) ...@@ -850,9 +850,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
bp->bp_hlen = HWL_ETHER; bp->bp_hlen = HWL_ETHER;
bp->bp_hops = 0; bp->bp_hops = 0;
bp->bp_secs = htons(get_timer(0) / CFG_HZ); bp->bp_secs = htons(get_timer(0) / CFG_HZ);
NetCopyIP(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */ /* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by
NetCopyIP(&bp->bp_yiaddr, &bp_offer->bp_yiaddr); * the server yet */
NetCopyIP(&bp->bp_siaddr, &bp_offer->bp_siaddr);
/* /*
* RFC3046 requires Relay Agents to discard packets with * RFC3046 requires Relay Agents to discard packets with
* nonzero and offered giaddr * nonzero and offered giaddr
...@@ -870,7 +870,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) ...@@ -870,7 +870,9 @@ 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);
/* Copy offered IP into the parameters request list */
NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr);
extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP); extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen; pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
...@@ -980,3 +982,4 @@ void DhcpRequest(void) ...@@ -980,3 +982,4 @@ void DhcpRequest(void)
#endif #endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment