Merge pull request #115 from gh0st42/master
fix to add correct broadcast address for ipv4 interfaces
This commit is contained in:
commit
de923091b3
1 changed files with 6 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue