+ logging.info(" - %s to %s (%s) on %s", DHCP_TYPES[resp_type], mac,
+ binding.ip, binding.tap)
+ try:
+ binding.sendp(resp)
+ except socket.error, e:
+ logging.warn(" - DHCP response on %s (%s) failed: %s",
+ binding.tap, binding.hostname, str(e))
+ except Exception, e:
+ logging.warn(" - Unkown error during DHCP response on %s (%s): %s",
+ binding.tap, binding.hostname, str(e))
+
+ def dhcpv6_response(self, arg1, arg2=None): # pylint: disable=W0613
+
+ logging.info(" * Processing pending DHCPv6 request")
+ # Workaround for supporting both squeezy's nfqueue-bindings-python
+ # and wheezy's python-nfqueue because for some reason the function's
+ # signature has changed and has broken compatibility
+ # See bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718894
+ if arg2:
+ payload = arg2
+ else:
+ payload = arg1
+ pkt = IPv6(payload.get_data())
+ indev = get_indev(payload)
+
+ #TODO: figure out how to find the src mac
+ mac = None
+ binding = self.get_binding(indev, mac)
+ if binding is None:
+ # We don't know anything about this interface, so accept the packet
+ # and return
+ logging.debug(" - Ignoring dhcpv6 request for mac %s", mac)
+ # We don't know what to do with this packet, so let the kernel
+ # handle it
+ payload.set_verdict(nfqueue.NF_ACCEPT)
+ return
+
+ # Signal the kernel that it shouldn't further process the packet
+ payload.set_verdict(nfqueue.NF_DROP)
+
+ subnet = binding.net6
+
+ if subnet.net is None:
+ logging.debug(" - No IPv6 network assigned for tap %s", binding.tap)
+ return
+
+ indevmac = self.get_iface_hw_addr(binding.indev)
+ ifll = subnet.make_ll64(indevmac)
+ if ifll is None:
+ return
+
+ ofll = subnet.make_ll64(binding.mac)
+ if ofll is None:
+ return