[DHCP] Fix DHCP state confusion.
DHCP code was using an incorrect check for whether to construct a DHCPDISCOVER or DHCPREQUEST packet.
This commit is contained in:
parent
8f00c84828
commit
7234f91bf8
@ -622,7 +622,7 @@ static int dhcp_send_request ( struct dhcp_session *dhcp ) {
|
|||||||
.netdev = dhcp->netdev,
|
.netdev = dhcp->netdev,
|
||||||
};
|
};
|
||||||
struct io_buffer *iobuf;
|
struct io_buffer *iobuf;
|
||||||
struct dhcp_packet *dhcpoffer;
|
struct dhcp_packet *dhcpoffer = NULL;
|
||||||
struct dhcp_packet dhcppkt;
|
struct dhcp_packet dhcppkt;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -643,7 +643,10 @@ static int dhcp_send_request ( struct dhcp_session *dhcp ) {
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Create DHCP packet in temporary buffer */
|
/* 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,
|
if ( ( rc = create_dhcp_request ( &dhcppkt, dhcp->netdev,
|
||||||
dhcpoffer, iobuf->data,
|
dhcpoffer, iobuf->data,
|
||||||
iob_tailroom ( iobuf ) ) ) != 0 ) {
|
iob_tailroom ( iobuf ) ) ) != 0 ) {
|
||||||
|
Reference in New Issue
Block a user