This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot - improve DHCP handling
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 23 Sep 2003 11:09:28 -0600
- Subject: RedBoot - improve DHCP handling
- Organization: MLB Associates
Wasn't handling retries properly.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.134
diff -u -5 -p -r1.134 ChangeLog
--- redboot/current/ChangeLog 22 Sep 2003 17:35:38 -0000 1.134
+++ redboot/current/ChangeLog 23 Sep 2003 17:08:00 -0000
@@ -1,5 +1,10 @@
+2003-09-23 Gary Thomas <gary@mlbassoc.com>
+
+ * src/net/bootp.c (__bootp_find_local_ip): Handle retries on DHCP
+ requests better.
+
2003-09-22 Gary Thomas <gary@mlbassoc.com>
* cdl/redboot.cdl: Fix compile error for systems with no FLASH.
2003-09-21 Gary Thomas <gary@mlbassoc.com>
Index: redboot/current/src/net/bootp.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/net/bootp.c,v
retrieving revision 1.14
diff -u -5 -p -r1.14 bootp.c
--- redboot/current/src/net/bootp.c 20 Sep 2003 14:35:58 -0000 1.14
+++ redboot/current/src/net/bootp.c 23 Sep 2003 17:06:42 -0000
@@ -211,17 +211,19 @@ __bootp_find_local_ip(bootp_header_t *in
#ifdef CYGSEM_REDBOOT_NETWORKING_DHCP
p = b.bp_vend;
switch (dhcpState) {
case DHCP_NONE:
+ case DHCP_DISCOVER:
AddOption(p,dhcpCookie);
AddOption(p,dhcpDiscover);
AddOption(p,dhcpParamRequestList);
AddOption(p,dhcpEnd);
dhcpState = DHCP_DISCOVER;
break;
case DHCP_OFFER:
+ case DHCP_REQUEST:
retry = MAX_RETRIES;
AddOption(p,dhcpCookie);
AddOption(p,dhcpRequest);
AddOption(p,dhcpRequestIP);
memcpy(p, &bp_info->bp_yiaddr, 4); p += 4; // Ask for the address just given
@@ -229,12 +231,10 @@ __bootp_find_local_ip(bootp_header_t *in
AddOption(p,dhcpEnd);
dhcpState = DHCP_REQUEST;
memset(&b.bp_yiaddr, 0xFF, 4);
memset(&b.bp_siaddr, 0xFF, 4);
break;
- case DHCP_DISCOVER:
- case DHCP_REQUEST:
case DHCP_ACK:
// These states should never occur here!
diag_printf("Invalid DHCP state: %d\n", dhcpState);
abort = true;
}