Browse Source

dhcp: handle NAK packets

Dario Nieuwenhuis 4 years ago
parent
commit
9ce3d9505e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/socket/dhcpv4.rs

+ 6 - 0
src/socket/dhcpv4.rs

@@ -206,6 +206,9 @@ impl Dhcpv4Socket {
                     });
                 }
             }
+            (ClientState::Requesting(_), DhcpMessageType::Nak) => {
+                self.reset();
+            }
             (ClientState::Renewing(state), DhcpMessageType::Ack) => {
                 if let Some((config, renew_at, expires_at)) = Self::parse_ack(now, ip_repr, &dhcp_repr) {
                     state.renew_at = renew_at;
@@ -216,6 +219,9 @@ impl Dhcpv4Socket {
                     }
                 }
             }
+            (ClientState::Renewing(_), DhcpMessageType::Nak) => {
+                self.reset();
+            }
             _ => {
                 net_debug!("DHCP ignoring {:?}: unexpected in current state", dhcp_repr.message_type);
             }