DHCP code was using an incorrect check for whether to construct a
DHCPDISCOVER or DHCPREQUEST packet.
.netdev = dhcp->netdev,
};
struct io_buffer *iobuf;
- struct dhcp_packet *dhcpoffer;
+ struct dhcp_packet *dhcpoffer = NULL;
struct dhcp_packet dhcppkt;
int rc;
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 ) {