Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netns: add documentation on how to go back on default netns #590

Merged
merged 1 commit into from Mar 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions pyroute2/netns/__init__.py
Expand Up @@ -222,6 +222,11 @@ def setns(netns, flags=os.O_CREAT, libc=None):
- O_CREAT -- create netns, if doesn't exist
- O_CREAT | O_EXCL -- create only if doesn't exist

Note that "main" netns as no name. But you can access it with::
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… has no name


setns('foo') # move to netns foo
setns('/proc/1/ns/net') # go back to default netns

Changed in 0.5.1: the routine closes the ns fd if it's
not provided via arguments.
'''
Expand Down