X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=net%2Fbootp.c;h=4db63cbbe64c65dd6722d94b91b5e2fb9aeb863a;hb=bdb3c20386e0c3b80c1e5d2408ce567c1df1ca18;hp=309385278f35c93f89b3f28a9104e243544944ee;hpb=e35c73d7e19e6ea45efcaf807736277afee9c7d1;p=oweals%2Fu-boot.git diff --git a/net/bootp.c b/net/bootp.c index 309385278f..4db63cbbe6 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -20,8 +20,6 @@ #define BOOTP_VENDOR_MAGIC 0x63825363 /* RFC1048 Magic Cookie */ -#if defined(CONFIG_CMD_NET) - #define TIMEOUT 5000UL /* Milliseconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ @@ -46,7 +44,8 @@ ulong seed1, seed2; dhcp_state_t dhcp_state = INIT; unsigned long dhcp_leasetime = 0; IPaddr_t NetDHCPServerIP = 0; -static void DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len); +static void DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, + unsigned len); /* For Debug */ #if 0 @@ -284,7 +283,8 @@ static void BootpVendorProcess (u8 * ext, int size) * Handle a BOOTP received packet. */ static void -BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) +BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, + unsigned len) { Bootp_t *bp; char *s; @@ -458,11 +458,15 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R *e++ = 42; *cnt += 1; #endif + /* no options, so back up to avoid sending an empty request list */ + if (*cnt == 0) + e -= 2; + *e++ = 255; /* End of the list */ /* Pad to minimal length */ #ifdef CONFIG_DHCP_MIN_EXT_LEN - while ((e - start) <= CONFIG_DHCP_MIN_EXT_LEN) + while ((e - start) < CONFIG_DHCP_MIN_EXT_LEN) *e++ = 0; #endif @@ -856,7 +860,8 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) * Handle DHCP received packets. */ static void -DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) +DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, + unsigned len) { Bootp_t *bp = (Bootp_t *)pkt; @@ -948,5 +953,3 @@ void DhcpRequest(void) BootpRequest(); } #endif /* CONFIG_CMD_DHCP */ - -#endif /* CONFIG_CMD_NET */