When a DHCP Nak is received, return a DHCP_EVENT_NO_LEASE event. If
some other DHCP message is received or an error happens when parsing
options, return -ENOMSG in order to ignore the packet. There may be
more than one server serving the same subnet, each server will send
its Offer to the client.
len = len - DHCP_IP_UDP_SIZE;
r = dhcp_option_parse(&offer->dhcp, len, client_parse_offer, lease);
- if (r != DHCP_ACK)
+ if (r == DHCP_NAK) {
+ r = DHCP_EVENT_NO_LEASE;
goto error;
+ }
+
+ if (r != DHCP_ACK) {
+ r = -ENOMSG;
+ goto error;
+ }
lease->address = offer->dhcp.yiaddr;