Commit 23841d8d authored by Martín Ferrari's avatar Martín Ferrari

moved internal interface classes to iproute, as they are used mostly for iproute communication

parent b6d0ee4f
This diff is collapsed.
This diff is collapsed.
...@@ -8,7 +8,7 @@ except ImportError: ...@@ -8,7 +8,7 @@ except ImportError:
from yaml import Loader, Dumper from yaml import Loader, Dumper
import base64, os, passfd, re, signal, sys, traceback, unshare, yaml import base64, os, passfd, re, signal, sys, traceback, unshare, yaml
import netns.subprocess_, netns.iproute, netns.interface import netns.subprocess_, netns.iproute
# ============================================================================ # ============================================================================
# Server-side protocol implementation # Server-side protocol implementation
...@@ -339,7 +339,7 @@ class Server(object): ...@@ -339,7 +339,7 @@ class Server(object):
for i in range(len(args) / 2): for i in range(len(args) / 2):
d[str(args[i * 2])] = args[i * 2 + 1] d[str(args[i * 2])] = args[i * 2 + 1]
iface = netns.interface.interface(**d) iface = netns.iproute.interface(**d)
netns.iproute.set_if(iface) netns.iproute.set_if(iface)
self.reply(200, "Done.") self.reply(200, "Done.")
...@@ -360,17 +360,17 @@ class Server(object): ...@@ -360,17 +360,17 @@ class Server(object):
def do_ADDR_ADD(self, cmdname, ifnr, address, prefixlen, broadcast = None): def do_ADDR_ADD(self, cmdname, ifnr, address, prefixlen, broadcast = None):
if address.find(":") < 0: # crude, I know if address.find(":") < 0: # crude, I know
a = netns.interface.ipv4address(address, prefixlen, broadcast) a = netns.iproute.ipv4address(address, prefixlen, broadcast)
else: else:
a = netns.interface.ipv6address(address, prefixlen) a = netns.iproute.ipv6address(address, prefixlen)
netns.iproute.add_addr(ifnr, a) netns.iproute.add_addr(ifnr, a)
self.reply(200, "Done.") self.reply(200, "Done.")
def do_ADDR_DEL(self, cmdname, ifnr, address, prefixlen): def do_ADDR_DEL(self, cmdname, ifnr, address, prefixlen):
if address.find(":") < 0: # crude, I know if address.find(":") < 0: # crude, I know
a = netns.interface.ipv4address(address, prefixlen, None) a = netns.iproute.ipv4address(address, prefixlen, None)
else: else:
a = netns.interface.ipv6address(address, prefixlen) a = netns.iproute.ipv6address(address, prefixlen)
netns.iproute.del_addr(ifnr, a) netns.iproute.del_addr(ifnr, a)
self.reply(200, "Done.") self.reply(200, "Done.")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment