From 66ebcb5cf43bcaa26be363a488f0f685de05fa4b Mon Sep 17 00:00:00 2001 From: ahrenholz Date: Mon, 4 Aug 2014 17:28:35 +0000 Subject: [PATCH] fix bug #253 "NetworkManager runs DHCP..." for Ubuntu (but not Fedora/CentOS) use "vethA.B.SS" name for veth devices (A = node number, B = index, SS = short session ID) use "tapA.B.SS" name for tap devices; use "b.A.SS" name for bridge devices added a SESSION_SHORT environment variable to the default CORE environment (Boeing r1867) --- Changelog | 3 ++- daemon/core/netns/vnet.py | 3 ++- daemon/core/netns/vnode.py | 6 +++--- daemon/core/session.py | 1 + daemon/sbin/core-cleanup | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index c78d81e8..48d6cb7d 100644 --- a/Changelog +++ b/Changelog @@ -17,7 +17,8 @@ - support link delays up to 274 seconds (netem maximum) - allow runtime changes of WLAN link effects * DAEMON: - - set NODE_NAME and NODE_NUMBER in default vnoded environment + - set NODE_NAME, NODE_NUMBER, SESSION_SHORT in default vnoded environment + - changed host device naming to use veth, tap prefixes; b.n.SS for bridges - allow parsing XML files into live running session - enable link effects between hub/switch and hub/switch connections - update MDR service to use broadcast interfaces for non-WLAN links diff --git a/daemon/core/netns/vnet.py b/daemon/core/netns/vnet.py index 7edde1b6..922bc7ec 100644 --- a/daemon/core/netns/vnet.py +++ b/daemon/core/netns/vnet.py @@ -211,7 +211,8 @@ class LxBrNet(PyCoreNet): if policy is not None: self.policy = policy self.name = name - self.brname = "b.%s.%s" % (str(self.objid), self.session.sessionid) + sessionid = self.session.shortsessionid() + self.brname = "b.%s.%s" % (str(self.objid), sessionid) self.up = False if start: self.startup() diff --git a/daemon/core/netns/vnode.py b/daemon/core/netns/vnode.py index 3cf49395..a92375f8 100644 --- a/daemon/core/netns/vnode.py +++ b/daemon/core/netns/vnode.py @@ -167,8 +167,8 @@ class SimpleLxcNode(PyCoreNode): if ifname is None: ifname = "eth%d" % ifindex sessionid = self.session.shortsessionid() - name = "n%s.%s.%s" % (self.objid, ifindex, sessionid) - localname = "n%s.%s.%s" % (self.objid, ifname, sessionid) + name = "veth%s.%s.1.%s" % (self.objid, ifindex, sessionid) + localname = "veth%s.%s.%s" % (self.objid, ifindex, sessionid) if len(ifname) > 16: raise ValueError, "interface local name '%s' to long" % \ localname @@ -198,7 +198,7 @@ class SimpleLxcNode(PyCoreNode): if ifname is None: ifname = "eth%d" % ifindex sessionid = self.session.shortsessionid() - localname = "n%s.%s.%s" % (self.objid, ifindex, sessionid) + localname = "tap%s.%s.%s" % (self.objid, ifindex, sessionid) name = ifname ifclass = TunTap tuntap = ifclass(node = self, name = name, localname = localname, diff --git a/daemon/core/session.py b/daemon/core/session.py index f767c018..73f14d59 100644 --- a/daemon/core/session.py +++ b/daemon/core/session.py @@ -321,6 +321,7 @@ class Session(object): ''' env = os.environ.copy() env['SESSION'] = "%s" % self.sessionid + env['SESSION_SHORT'] = "%s" % self.shortsessionid() env['SESSION_DIR'] = "%s" % self.sessiondir env['SESSION_NAME'] = "%s" % self.name env['SESSION_FILENAME'] = "%s" % self.filename diff --git a/daemon/sbin/core-cleanup b/daemon/sbin/core-cleanup index e95ee667..dca35da2 100755 --- a/daemon/sbin/core-cleanup +++ b/daemon/sbin/core-cleanup @@ -45,7 +45,7 @@ killall -q emanetransportd killall -q emaneeventservice ifconfig -a | awk ' - /^n[0-9]+/ {print "removing interface " $1; system("ip link del " $1);} + /^veth[0-9]+\./ {print "removing interface " $1; system("ip link del " $1);} /tmp\./ {print "removing interface " $1; system("ip link del " $1);} /gt\./ {print "removing interface " $1; system("ip link del " $1);} /b\./ {print "removing bridge " $1; system("ip link set " $1 " down; brctl delbr " $1);}