summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJustin Flammia <jflammia@savantav.com>2007-10-29 17:40:35 -0400
committerWolfgang Denk <wd@denx.de>2007-11-01 23:13:00 +0100
commite5c794e491a57d829b6d8733e2ed8368a2269abf (patch)
tree7ec5bd4000df1bfb0b98aa8d38d1194dfdec43f6 /net
parent8287b3b5642c5157392e35b7277ea0c513da50b5 (diff)
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: Justin Flammia <jflammia@savantav.com> Signed-off-by: Ben Warren <bwarren@qstreams.com>
Diffstat (limited to 'net')
-rw-r--r--net/bootp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 749d3e5e0c..cfe6f8dd6b 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -850,9 +850,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
bp->bp_hlen = HWL_ETHER;
bp->bp_hops = 0;
bp->bp_secs = htons(get_timer(0) / CFG_HZ);
- NetCopyIP(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */
- NetCopyIP(&bp->bp_yiaddr, &bp_offer->bp_yiaddr);
- NetCopyIP(&bp->bp_siaddr, &bp_offer->bp_siaddr);
+ /* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by
+ * the server yet */
+
/*
* RFC3046 requires Relay Agents to discard packets with
* nonzero and offered giaddr
@@ -870,7 +870,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
/*
* 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);
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
@@ -980,3 +982,4 @@ void DhcpRequest(void)
#endif
#endif
+