This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: RedBoot DHCP broken?
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Chris Garry <cgarry at sweeneydesign dot co dot uk>
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 23 Sep 2003 10:13:40 -0600
- Subject: Re: [ECOS] RedBoot DHCP broken?
- Organization: MLB Associates
- References: <016601c381eb$0e85e720$500ba8c0@jasper>
On Tue, 2003-09-23 at 09:54, Chris Garry wrote:
> When I build RedBoot with the latest sources, DHCP is not working.
> I get the following output from RedBoot:
>
> ... waiting for BOOTP information
> Invalid DHCP state: 1
> Can't get BOOTP info, using default IP address
>
> All other network operations are working okay.
>
> When I use Ethereal to check the packets sent at boot time, no packets
> are seen from RedBoot at all.
>
> After a quick bit of debugging it seems that in the file
> redboot\current\src\net\bootp.c in the function
> __bootp_find_local_ip()
>
> the function call:
> __udp_send((char *)&b, txSize, &r, IPPORT_BOOTPS, IPPORT_BOOTPC);
> at line 250 is called and returns a value 0, but no packets make it out onto the
> wire. Thus when the subsequent code is waiting for a response, it does not
> get one.
>
> Has anybody else built RedBoot with the latest code and seen/not seen
> this problem?
No, I've not seen this problem, but I am interested since I [obviously]
broke it for you. A few questions:
* Did it work before?
* Is your server set up for DHCP, or BOOTP only?
* Have you seen the traffic before these changes? [This might just be
a network snoop issue]
* Try forcing the network debug code on.
Can you try things with the attached patch? Let me know what you find.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
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 16:13:11 -0000
@@ -55,10 +55,12 @@
#include <redboot.h>
#include <net/net.h>
#include <net/bootp.h>
+extern int net_debug;
+
#define SHOULD_BE_RANDOM 0x12345555
/* How many milliseconds to wait before retrying the request */
#define RETRY_TIME 500
#define MAX_RETRIES 30
@@ -173,10 +175,11 @@ __bootp_find_local_ip(bootp_header_t *in
static int xid = SHOULD_BE_RANDOM;
#ifdef CYGSEM_REDBOOT_NETWORKING_DHCP
dhcpState = DHCP_NONE;
#endif
+ net_debug = 1;
// Where we want the results saved
bp_info = info;
// Preserve any IP address we currently have, just in case
memcpy(saved_ip_addr, __local_ip_addr, sizeof(__local_ip_addr));
@@ -211,17 +214,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 +234,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;
}
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss