From: David Ahern Date: Mon, 15 Oct 2018 17:30:34 +0000 (-0700) Subject: mroute: Add table id attribute for kernel side filtering X-Git-Tag: v5.0.0~36^2~5^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e41ede893960df15958fd146d857fa2cdc4df50e;p=thirdparty%2Fiproute2.git mroute: Add table id attribute for kernel side filtering 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 --- diff --git a/ip/ipmroute.c b/ip/ipmroute.c index b8f0bc49b..b29c78e4c 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -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; }