Statistics
| Branch: | Tag: | Revision:

root / contrib / patches / nfdhcpd-patch-feca7bb959 @ 2e1e6844

History | View | Annotate | Download (2.2 kB)

1
diff --git a/nfdhcpd b/nfdhcpd
2
index c3bdcc7..19e8d6c 100755
3
--- a/nfdhcpd
4
+++ b/nfdhcpd
5
@@ -1,4 +1,4 @@
6
-#!/usr/bin/env python
7
+#!/usr/bin/env python2.7
8
 #
9
 
10
 # nfdcpd: A promiscuous, NFQUEUE-based DHCP server for virtual machine hosting
11
@@ -496,7 +496,9 @@ class VMNetProxy(object): # pylint: disable=R0902
12
         """ Generate a reply to a BOOTP/DHCP request
13
 
14
         """
15
-        indev = payload.get_indev()
16
+        # If the packet comes from a bridged interface, use the ifindex
17
+        # of the physical device instead of the ifindex of the bridge interface
18
+        indev = payload.get_physindev() or payload.get_indev()
19
         try:
20
             # Get the actual interface from the ifindex
21
             iface = self.ifaces[indev]
22
@@ -537,7 +539,7 @@ class VMNetProxy(object): # pylint: disable=R0902
23
             return
24
 
25
         resp = Ether(dst=mac, src=self.get_iface_hw_addr(iface))/\
26
-               IP(src=DHCP_DUMMY_SERVER_IP, dst=binding.ip)/\
27
+               IP(src=self.dhcp_server_ip, dst=binding.ip)/\
28
                UDP(sport=pkt.dport, dport=pkt.sport)/resp
29
         subnet = self.subnets[binding.link]
30
 
31
@@ -593,7 +595,7 @@ class VMNetProxy(object): # pylint: disable=R0902
32
         # Finally, always add the server identifier and end options
33
         dhcp_options += [
34
             ("message-type", resp_type),
35
-            ("server_id", DHCP_DUMMY_SERVER_IP),
36
+            ("server_id", self.dhcp_server_ip),
37
             "end"
38
         ]
39
         resp /= DHCP(options=dhcp_options)
40
@@ -606,7 +608,7 @@ class VMNetProxy(object): # pylint: disable=R0902
41
         """ Generate a reply to a BOOTP/DHCP request
42
 
43
         """
44
-        indev = payload.get_indev()
45
+        indev = payload.get_physindev() or payload.get_indev()
46
         try:
47
             # Get the actual interface from the ifindex
48
             iface = self.ifaces[indev]
49
@@ -641,7 +643,7 @@ class VMNetProxy(object): # pylint: disable=R0902
50
         """ Generate a reply to an ICMPv6 neighbor solicitation
51
 
52
         """
53
-        indev = payload.get_indev()
54
+        indev = payload.get_physindev() or payload.get_indev()
55
         try:
56
             # Get the actual interface from the ifindex
57
             iface = self.ifaces[indev]