diff options
author | Michael Brown | 2008-03-25 17:38:01 +0100 |
---|---|---|
committer | Michael Brown | 2008-03-25 17:38:01 +0100 |
commit | 7234f91bf87df67b770a44cad2351e5c73e67ea4 (patch) | |
tree | 21c60f3b95a01bce898c6b36f7a7ebd16d27de70 /src/net | |
parent | [Settings] Add named setting for next-server (diff) | |
download | ipxe-7234f91bf87df67b770a44cad2351e5c73e67ea4.tar.gz ipxe-7234f91bf87df67b770a44cad2351e5c73e67ea4.tar.xz ipxe-7234f91bf87df67b770a44cad2351e5c73e67ea4.zip |
[DHCP] Fix DHCP state confusion.
DHCP code was using an incorrect check for whether to construct a
DHCPDISCOVER or DHCPREQUEST packet.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/udp/dhcp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index 908e7b3f..8789f925 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -622,7 +622,7 @@ static int dhcp_send_request ( struct dhcp_session *dhcp ) { .netdev = dhcp->netdev, }; struct io_buffer *iobuf; - struct dhcp_packet *dhcpoffer; + struct dhcp_packet *dhcpoffer = NULL; struct dhcp_packet dhcppkt; int rc; @@ -643,7 +643,10 @@ static int dhcp_send_request ( struct dhcp_session *dhcp ) { return -ENOMEM; /* Create DHCP packet in temporary buffer */ - dhcpoffer = ( dhcp->response ? &dhcp->response->dhcppkt : NULL ); + if ( dhcp->state == DHCPREQUEST ) { + assert ( dhcp->response ); + dhcpoffer = &dhcp->response->dhcppkt; + } if ( ( rc = create_dhcp_request ( &dhcppkt, dhcp->netdev, dhcpoffer, iobuf->data, iob_tailroom ( iobuf ) ) ) != 0 ) { |