From d509b81210e8126d8f953fda419f93c8065e314a Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Sun, 12 Mar 2006 01:13:30 +0100 Subject: Fix behaviour if gatewayip is not set Patch by Robin Gilks, 23 Dec 2004 --- net/net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/net.c b/net/net.c index 37c5fb698e1..506203761f4 100644 --- a/net/net.c +++ b/net/net.c @@ -222,8 +222,10 @@ void ArpRequest (void) (NetOurIP & NetOurSubnetMask)) { if (NetOurGatewayIP == 0) { puts ("## Warning: gatewayip needed but not set\n"); + NetArpWaitReplyIP = NetArpWaitPacketIP; + } else { + NetArpWaitReplyIP = NetOurGatewayIP; } - NetArpWaitReplyIP = NetOurGatewayIP; } else { NetArpWaitReplyIP = NetArpWaitPacketIP; } -- cgit v1.3.1 From 3b2e4fd9b0348d49e7b55a19a0c919f6c83d9a43 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Sun, 12 Mar 2006 18:26:46 +0100 Subject: Add support for the DHCP vendor optional bootfile (#67). Ignores the vendor TFTP server name option (#66). Patch by Murray Jensen, 30 Jun 2005 --- CHANGELOG | 4 ++++ net/bootp.c | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/CHANGELOG b/CHANGELOG index bdd6fc62f79..82538e9be2f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,10 @@ Changes since U-Boot 1.1.4: ====================================================================== +* Add support for the DHCP vendor optional bootfile (#67). + Ignores the vendor TFTP server name option (#66). + Patch by Murray Jensen, 30 Jun 2005 + * Fix a HW timing issue on 8548 CDS for eTSEC 3 in RGMII mode Patch by Andy Fleming, 14 Jun 2005 diff --git a/net/bootp.c b/net/bootp.c index 8c56c0845f3..669d74a6a50 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -715,7 +715,7 @@ BootpRequest (void) } #if (CONFIG_COMMANDS & CFG_CMD_DHCP) -static void DhcpOptionsProcess (uchar * popt) +static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) { uchar *end = popt + BOOTP_HDR_SIZE; int oplen, size; @@ -772,6 +772,34 @@ static void DhcpOptionsProcess (uchar * popt) break; case 59: /* Ignore Rebinding Time Option */ break; + case 66: /* Ignore TFTP server name */ + break; + case 67: /* vendor opt bootfile */ + /* + * I can't use dhcp_vendorex_proc here because I need + * to write into the bootp packet - even then I had to + * pass the bootp packet pointer into here as the + * second arg + */ + size = truncate_sz ("Opt Boot File", + sizeof(bp->bp_file), + oplen); + if (bp->bp_file[0] == '\0' && size > 0) { + /* + * only use vendor boot file if we didn't + * receive a boot file in the main non-vendor + * part of the packet - god only knows why + * some vendors chose not to use this perfectly + * good spot to store the boot file (join on + * Tru64 Unix) it seems mind bogglingly crazy + * to me + */ + printf("*** WARNING: using vendor " + "optional boot file\n"); + memcpy(bp->bp_file, popt + 2, size); + bp->bp_file[size] = '\0'; + } + break; default: #if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) if (dhcp_vendorex_proc (popt)) @@ -882,7 +910,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) dhcp_state = REQUESTING; if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC)) - DhcpOptionsProcess((u8 *)&bp->bp_vend[4]); + DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp); BootpCopyNetParams(bp); /* Store net params from reply */ @@ -901,7 +929,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) char *s; if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC)) - DhcpOptionsProcess((u8 *)&bp->bp_vend[4]); + DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp); BootpCopyNetParams(bp); /* Store net params from reply */ dhcp_state = BOUND; puts ("DHCP client bound to address "); -- cgit v1.3.1