use hex value for short session ID used in naming interfaces
use interface names "vethOOOOO.ii.ss" and "vethOOOOO.iipss" for veth pairs (where OOOOO = object id, ii = interface index, ss = hex short session ID) fixes bug #260 virtual interface names too long (Boeing r1894)
This commit is contained in:
parent
96dd48e3c3
commit
503713f0bc
3 changed files with 6 additions and 4 deletions
|
@ -167,9 +167,9 @@ class SimpleLxcNode(PyCoreNode):
|
|||
if ifname is None:
|
||||
ifname = "eth%d" % ifindex
|
||||
sessionid = self.session.shortsessionid()
|
||||
name = "veth%s.%s.1.%s" % (self.objid, ifindex, sessionid)
|
||||
name = "veth%s.%sp%s" % (self.objid, ifindex, sessionid)
|
||||
localname = "veth%s.%s.%s" % (self.objid, ifindex, sessionid)
|
||||
if len(ifname) > 16:
|
||||
if len(localname) >= 16:
|
||||
raise ValueError, "interface local name '%s' to long" % \
|
||||
localname
|
||||
ifclass = VEth
|
||||
|
|
|
@ -689,7 +689,8 @@ class Session(object):
|
|||
''' Return a shorter version of the session ID, appropriate for
|
||||
interface names, where length may be limited.
|
||||
'''
|
||||
return (self.sessionid >> 8) ^ (self.sessionid & ((1 << 8) - 1))
|
||||
ssid = (self.sessionid >> 8) ^ (self.sessionid & ((1 << 8) - 1))
|
||||
return "%x" % ssid
|
||||
|
||||
def sendnodeemuid(self, handler, nodenum):
|
||||
''' Send back node messages to the GUI for node messages that had
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue