summaryrefslogtreecommitdiffstats
path: root/src/net/udp
diff options
context:
space:
mode:
authorMichael Brown2007-11-21 05:48:18 +0100
committerMichael Brown2007-11-21 05:48:18 +0100
commitfb809da2dfe9d715a02de7033ede46854d176c2e (patch)
tree78b7f6462aa74a4ebc9f243c69bf2c41676d0714 /src/net/udp
parentAdd PXE-required DHCP options to DHCPDISCOVER and DHCPREQUEST packets. (diff)
downloadipxe-fb809da2dfe9d715a02de7033ede46854d176c2e.tar.gz
ipxe-fb809da2dfe9d715a02de7033ede46854d176c2e.tar.xz
ipxe-fb809da2dfe9d715a02de7033ede46854d176c2e.zip
Remove some assumptions about DHCP obtaining only a single options block.
Diffstat (limited to 'src/net/udp')
-rw-r--r--src/net/udp/dhcp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 7de05ac1b..308044570 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -1006,14 +1006,18 @@ int dhcp_configure_netdev ( struct net_device *netdev,
struct in_addr gateway = { INADDR_NONE };
int rc;
- /* Clear any existing routing table entry */
- del_ipv4_address ( netdev );
-
/* Retrieve IP address configuration */
find_dhcp_ipv4_option ( options, DHCP_EB_YIADDR, &address );
find_dhcp_ipv4_option ( options, DHCP_SUBNET_MASK, &netmask );
find_dhcp_ipv4_option ( options, DHCP_ROUTERS, &gateway );
+ /* Do nothing unless we have at least an IP address to use */
+ if ( ! address.s_addr )
+ return 0;
+
+ /* Clear any existing routing table entry */
+ del_ipv4_address ( netdev );
+
/* Set up new IP address configuration */
if ( ( rc = add_ipv4_address ( netdev, address, netmask,
gateway ) ) != 0 ) {