Commit 2d3e5f77 authored by Peter V. Saveliev's avatar Peter V. Saveliev

rtnl: fix marshal module

parent 94bbbef4
from pyroute2.netlink import rtnl
from pyroute2.netlink.nlsocket import Marshal
from pyroute2.netlink.rtnl.tcmsg import tcmsg
from pyroute2.netlink.rtnl.rtmsg import rtmsg
from pyroute2.netlink.rtnl.ndmsg import ndmsg
from pyroute2.netlink.rtnl.ndtmsg import ndtmsg
from pyroute2.netlink.rtnl.fibmsg import fibmsg
from pyroute2.netlink.rtnl.ifinfmsg import ifinfmsg
from pyroute2.netlink.rtnl.ifaddrmsg import ifaddrmsg
class MarshalRtnl(Marshal):
msg_map = {rtnl.RTM_NEWLINK: ifinfmsg,
rtnl.RTM_DELLINK: ifinfmsg,
rtnl.RTM_GETLINK: ifinfmsg,
rtnl.RTM_SETLINK: ifinfmsg,
rtnl.RTM_NEWADDR: ifaddrmsg,
rtnl.RTM_DELADDR: ifaddrmsg,
rtnl.RTM_GETADDR: ifaddrmsg,
rtnl.RTM_NEWROUTE: rtmsg,
rtnl.RTM_DELROUTE: rtmsg,
rtnl.RTM_GETROUTE: rtmsg,
rtnl.RTM_NEWRULE: fibmsg,
rtnl.RTM_DELRULE: fibmsg,
rtnl.RTM_GETRULE: fibmsg,
rtnl.RTM_NEWNEIGH: ndmsg,
rtnl.RTM_DELNEIGH: ndmsg,
rtnl.RTM_GETNEIGH: ndmsg,
rtnl.RTM_NEWQDISC: tcmsg,
rtnl.RTM_DELQDISC: tcmsg,
rtnl.RTM_GETQDISC: tcmsg,
rtnl.RTM_NEWTCLASS: tcmsg,
rtnl.RTM_DELTCLASS: tcmsg,
rtnl.RTM_GETTCLASS: tcmsg,
rtnl.RTM_NEWTFILTER: tcmsg,
rtnl.RTM_DELTFILTER: tcmsg,
rtnl.RTM_GETTFILTER: tcmsg,
rtnl.RTM_NEWNEIGHTBL: ndtmsg,
rtnl.RTM_GETNEIGHTBL: ndtmsg,
rtnl.RTM_SETNEIGHTBL: ndtmsg}
def fix_message(self, msg):
# FIXME: pls do something with it
msg['event'] = rtnl.RTM_VALUES[msg['header']['type']]
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