Commit 628381f4 authored by Peter V. Saveliev's avatar Peter V. Saveliev

netns: allow to pass libc to NetNS and NSPopen

Bug-Url: https://github.com/svinota/pyroute2/issues/702
parent 05f00100
......@@ -132,7 +132,7 @@ class NetNS(RTNL_API, RemoteSocket):
Do not forget to call `release()` when the work is done. It will shut
down `NetNS` instance as well.
'''
def __init__(self, netns, flags=os.O_CREAT, target=None):
def __init__(self, netns, flags=os.O_CREAT, target=None, libc=None):
self.netns = netns
self.flags = flags
target = target or netns
......@@ -149,7 +149,7 @@ class NetNS(RTNL_API, RemoteSocket):
trnsp_in.file_obj.close()
trnsp_out.file_obj.close()
try:
setns(self.netns, self.flags)
setns(self.netns, self.flags, libc=None)
except OSError as e:
(self
.remote_trnsp_out
......
......@@ -79,7 +79,7 @@ class NSPopenFile(object):
def NSPopenServer(nsname, flags, channel_in, channel_out, argv, kwarg):
# set netns
try:
setns(nsname, flags=flags)
setns(nsname, flags=flags, libc=kwarg.pop('libc', None))
except Exception as e:
channel_out.put(e)
return
......
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