Fix broken ns_responce in nfdhcpd
authorDimitris Aragiorgis <dimara@grnet.gr>
Tue, 29 May 2012 18:44:20 +0000 (21:44 +0300)
committerDimitris Aragiorgis <dimara@grnet.gr>
Tue, 29 May 2012 18:44:20 +0000 (21:44 +0300)
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

nfdhcpd/nfdhcpd

index fd952db..72d920c 100755 (executable)
@@ -616,27 +616,26 @@ class VMNetProxy(object): # pylint: disable=R0902
         """
         ns = IPv6(payload.get_data())
 
-        binding = None
-        for b in self.clients.values():
-          if b.eui64 == ns.tgt:
-            binding = b
-            break
+        logging.debug("lladdr %s  src %sns.lladdr" , ns.lladdr, ns.src)
 
-        if binding is None:
-            logging.debug("Ignoring neighbour solicitation on"
-                          " for eui64 %s", ns.tgt)
-            # We don't know what to do with this packet, so let the kernel
-            # handle it
-            payload.set_verdict(nfqueue.NF_ACCEPT)
-            return
+        try:
+          binding = self.clients[ns.lladdr]
+        except:
+          logging.debug("Ignoring neighbour solicitation for eui64 %s", ns.tgt)
+          # We don't know what to do with this packet, so let the kernel
+          # handle it
+          payload.set_verdict(nfqueue.NF_ACCEPT)
+          return
 
-        payload.set_verdict(nfqueue.NF_DROP)
 
         subnet = binding.net6
         if subnet.net is None:
           logging.debug("No IPv6 network assigned for the interface")
+          payload.set_verdict(nfqueue.NF_ACCEPT)
           return
 
+        payload.set_verdict(nfqueue.NF_DROP)
+
         indevmac = self.get_iface_hw_addr(binding.indev)
 
         ifll = subnet.make_ll64(indevmac)