Don't answer DHCP packets if we don't recognize the hardware address
[invirt/packages/invirt-dhcp.git] / invirt-dhcpserver
index d4e40e0..ffbf839 100755 (executable)
@@ -224,12 +224,14 @@ class DhcpServer(pydhcplib.dhcp_network.DhcpServer):
 
         else : s.syslog(s.LOG_INFO,"Get DHCPREQUEST_UNKNOWN_STATE packet : not implemented")
 
-        if self.backend.Request(packet) : packet.TransformToDhcpAckPacket()
-        else : packet.TransformToDhcpNackPacket()
-
-        self.SendPacket(packet)
-
-
+        if self.backend.Request(packet):
+            packet.TransformToDhcpAckPacket()
+            self.SendPacket(packet)
+        elif self.backend.Discover(packet):
+            packet.TransformToDhcpNackPacket()
+            self.SendPacket(packet)
+        else:
+            pass # We aren't authoritative, so don't reply if we don't know them.
 
     # FIXME: These are not yet implemented.
     def HandleDhcpDecline(self, packet):