Commit 754a6532 authored by Martín Ferrari's avatar Martín Ferrari

add IF DEL command

parent b420be8c
......@@ -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
......
......@@ -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()
......
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