diff --git a/pyroute2/iproute/linux.py b/pyroute2/iproute/linux.py index 4edc17ba8..64075ba2c 100644 --- a/pyroute2/iproute/linux.py +++ b/pyroute2/iproute/linux.py @@ -2308,7 +2308,7 @@ async def rule(self, command, **kwarg): 'del': (RTM_DELRULE, 'req'), 'remove': (RTM_DELRULE, 'req'), 'delete': (RTM_DELRULE, 'req'), - 'dump': (RTM_GETRULE, 'dump'), + 'dump': (RTM_GETRULE, 'root'), } if isinstance(kwarg.get('match'), str): kwarg['match'] = {'ifname': kwarg['match']} diff --git a/pyroute2/netlink/nlsocket.py b/pyroute2/netlink/nlsocket.py index 88944af19..211d561c7 100644 --- a/pyroute2/netlink/nlsocket.py +++ b/pyroute2/netlink/nlsocket.py @@ -102,12 +102,14 @@ NETLINK_LISTEN_ALL_NSID, NLM_F_ACK, NLM_F_APPEND, + NLM_F_ATOMIC, NLM_F_CREATE, NLM_F_DUMP, NLM_F_ECHO, NLM_F_EXCL, NLM_F_REPLACE, NLM_F_REQUEST, + NLM_F_ROOT, SOL_NETLINK, ) from pyroute2.netlink.core import ( @@ -419,6 +421,7 @@ class NetlinkRequest: # request flags flags = { 'dump': NLM_F_REQUEST | NLM_F_DUMP, + 'root': NLM_F_REQUEST | NLM_F_ROOT | NLM_F_ATOMIC, 'get': NLM_F_REQUEST | NLM_F_ACK, 'req': NLM_F_REQUEST | NLM_F_ACK, } diff --git a/pyroute2/requests/rule.py b/pyroute2/requests/rule.py index e52f819ff..e92d54b57 100644 --- a/pyroute2/requests/rule.py +++ b/pyroute2/requests/rule.py @@ -16,7 +16,7 @@ class RuleIPRouteFilter(IPRouteFilter): def get_table(self, context, mode): table = context.get('table', 0) if mode == 'field': - return table if 0 < table < 255 else 254 + return table if 0 <= table <= 255 else 252 return table def set_action(self, context, value):