Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
a7e44669
Commit
a7e44669
authored
Aug 05, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
9f1d3d08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
src/netns/environ.py
src/netns/environ.py
+18
-7
src/netns/iproute.py
src/netns/iproute.py
+2
-0
No files found.
src/netns/environ.py
View file @
a7e44669
...
...
@@ -3,6 +3,7 @@
import
os
,
subprocess
__all__
=
[
"ip_path"
,
"tc_path"
,
"brctl_path"
,
"sysctl_path"
,
"hz"
]
__all__
+=
[
"tcpdump_path"
,
"netperf_path"
]
__all__
+=
[
"execute"
,
"backticks"
]
def
_find_bin
(
name
):
...
...
@@ -14,13 +15,23 @@ def _find_bin(name):
except
OSError
,
e
:
if
e
.
errno
!=
os
.
errno
.
ENOENT
:
raise
raise
RuntimeError
(
"Cannot find `%s' command, impossible to continue."
%
name
)
ip_path
=
_find_bin
(
"ip"
)
tc_path
=
_find_bin
(
"tc"
)
brctl_path
=
_find_bin
(
"brctl"
)
sysctl_path
=
_find_bin
(
"sysctl"
)
return
None
def
_find_bin_or_die
(
name
):
r
=
_find_bin
(
name
)
if
not
r
:
raise
RuntimeError
(
"Cannot find `%s' command, impossible to "
+
"continue."
%
name
)
return
r
ip_path
=
_find_bin_or_die
(
"ip"
)
tc_path
=
_find_bin_or_die
(
"tc"
)
brctl_path
=
_find_bin_or_die
(
"brctl"
)
sysctl_path
=
_find_bin_or_die
(
"sysctl"
)
# Optional tools
tcpdump_path
=
_find_bin
(
"tcpdump"
)
netperf_path
=
_find_bin
(
"netperf"
)
# Seems this is completely bogus. At least, we can assume that the internal HZ
# is bigger than this.
...
...
src/netns/iproute.py
View file @
a7e44669
...
...
@@ -272,6 +272,8 @@ def _get_if_name(iface):
# XXX: ideally this should be replaced by netlink communication
# Interface handling
# FIXME: try to lower the amount of calls to retrieve data!!
def
get_if_data
():
"""Gets current interface information. Returns a tuple (byidx, bynam) in
which each element is a dictionary with the same data, but using different
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment