]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
mroute: Add table id attribute for kernel side filtering
authorDavid Ahern <dsahern@gmail.com>
Mon, 15 Oct 2018 17:30:34 +0000 (10:30 -0700)
committerDavid Ahern <dsahern@gmail.com>
Thu, 27 Dec 2018 23:34:50 +0000 (15:34 -0800)
Similar to 'ip route' add the table id to the dump request for
kernel side filtering if it is supported.

Signed-off-by: David Ahern <dsahern@gmail.com>
ip/ipmroute.c

index b8f0bc49b92e31aec527a515670cedbca58ad5e4..b29c78e4cc86c96a5c562c9356c637a0212fa18c 100644 (file)
@@ -220,6 +220,19 @@ void ipmroute_reset_filter(int ifindex)
        filter.iif = ifindex;
 }
 
+static int iproute_dump_filter(struct nlmsghdr *nlh, int reqlen)
+{
+       int err;
+
+       if (filter.tb) {
+               err = addattr32(nlh, reqlen, RTA_TABLE, filter.tb);
+               if (err)
+                       return err;
+       }
+
+       return 0;
+}
+
 static int mroute_list(int argc, char **argv)
 {
        char *id = NULL;
@@ -285,7 +298,7 @@ static int mroute_list(int argc, char **argv)
                filter.iif = idx;
        }
 
-       if (rtnl_routedump_req(&rth, filter.af, NULL) < 0) {
+       if (rtnl_routedump_req(&rth, filter.af, iproute_dump_filter) < 0) {
                perror("Cannot send dump request");
                return 1;
        }