fix to add correct broadcast address for ipv4 interfaces with netns backend

This commit is contained in:
lbaumgaertner 2017-03-28 12:00:24 +02:00
parent 67117a3af3
commit e665a122b6

View file

@ -225,8 +225,12 @@ class SimpleLxcNode(PyCoreNode):
"error setting MAC address %s" % str(addr))
def addaddr(self, ifindex, addr):
if self.up:
self.cmd([IP_BIN, "addr", "add", str(addr),
"dev", self.ifname(ifindex)])
if ":" in str(addr): # check if addr is ipv6
self.cmd([IP_BIN, "addr", "add", str(addr),
"dev", self.ifname(ifindex)])
else:
self.cmd([IP_BIN, "addr", "add", str(addr), "broadcast", "+",
"dev", self.ifname(ifindex)])
self._netif[ifindex].addaddr(addr)
def deladdr(self, ifindex, addr):