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
754a6532
Commit
754a6532
authored
Jul 20, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add IF DEL command
parent
b420be8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
protocol.txt
protocol.txt
+1
-0
src/netns/protocol.py
src/netns/protocol.py
+9
-0
No files found.
protocol.txt
View file @
754a6532
...
...
@@ -13,6 +13,7 @@ QUIT 221 Close the netns
IF LIST [if#] 200 serialised data ip link list
IF SET if# k v k v... 200/500 ip link set (1)
IF RTRN if# ns 200/500 ip link set netns $ns
IF DEL if# 200/500 ip link del
ADDR LIST [if#] 200 serialised data ip addr list
ADDR ADD if# addr_spec 200/500 ip addr add
ADDR DEL if# addr_spec 200/500 ip addr del
...
...
src/netns/protocol.py
View file @
754a6532
...
...
@@ -28,6 +28,7 @@ _proto_commands = {
"LIST"
:
(
""
,
"i"
),
"SET"
:
(
"iss"
,
"s*"
),
"RTRN"
:
(
"ii"
,
""
)
"DEL"
:
(
"i"
,
""
)
},
"ADDR"
:
{
"LIST"
:
(
""
,
"i"
),
...
...
@@ -345,6 +346,10 @@ class Server(object):
netns
.
iproute
.
change_netns
(
ifnr
,
netns
)
self
.
reply
(
200
,
"Done."
)
def
do_IF_DEL
(
self
,
cmdname
,
ifnr
):
netns
.
iproute
.
del_if
(
ifnr
)
self
.
reply
(
200
,
"Done."
)
def
do_ADDR_LIST
(
self
,
cmdname
,
ifnr
=
None
):
addrdata
=
netns
.
iproute
.
get_addr_data
()[
0
]
if
ifnr
!=
None
:
...
...
@@ -539,6 +544,10 @@ class Client(object):
self
.
_send_cmd
(
*
cmd
)
self
.
_read_and_check_reply
()
def
del_if
(
self
,
ifnr
):
self
.
_send_cmd
(
"IF"
,
"DEL"
,
ifnr
)
self
.
_read_and_check_reply
()
def
change_netns
(
self
,
ifnr
,
netns
):
self
.
_send_cmd
(
"IF"
,
"RTRN"
,
ifnr
,
netns
)
self
.
_read_and_check_reply
()
...
...
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