On Fri, Feb 21, 2014 at 02:02:50PM +0100, Gregor Beck wrote: > Hi, > > with the attached patch lxc-device can move a wireless device into a > container. > > There was a related issue requesting this feature from lxc.conf > https://github.com/lxc/lxc/issues/52 > > Gregor
That's interesting, I didn't know the phy itself could be moved between network namespaces. I'll have to do a few tests here to make sure this covers all the cases we care about, but that seems like a bug step up from the "can't do, kernel won't let us" conclusion I arrived at last time! > > > -- > SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen > phone: +49-551-370000-0, fax: +49-551-370000-9 > AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen > http://www.sernet.de, mailto:[email protected] > From 2d6c9c692386a46b9401bf36fd3a9375de618506 Mon Sep 17 00:00:00 2001 > From: Gregor Beck <[email protected]> > Date: Fri, 21 Feb 2014 11:09:32 +0100 > Subject: [PATCH] support lxc-device add wlan > > Signed-off-by: Gregor Beck <[email protected]> > --- > src/python-lxc/lxc/__init__.py | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py > index 9eb27b6..0b982ab 100644 > --- a/src/python-lxc/lxc/__init__.py > +++ b/src/python-lxc/lxc/__init__.py > @@ -160,6 +160,23 @@ class Container(_lxc.Container): > if not self.running: > return False > > + > + if os.path.exists("/sys/class/net/%s/phy80211/" % name): > + f = open("/sys/class/net/%s/phy80211/name" % name) > + phy = f.readline().strip() > + f.close() > + if subprocess.call(['iw', 'phy', phy, 'set', 'netns', > + str(self.init_pid)]) != 0: > + return False > + if destname: > + # return subprocess.call(['ip', 'netns', > + # 'exec', str(self.init_pid), > + # 'ip', 'link', 'set', > + # 'dev', name, > + # 'name', destname]) == 0 > + return destname == name > + return True > + > if not destname: > destname = name > > -- > 1.7.9.5 > > _______________________________________________ > lxc-devel mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-devel -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: Digital signature
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
