[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181220035427.14453-8-dsahern@kernel.org>
Date: Wed, 19 Dec 2018 19:54:22 -0800
From: David Ahern <dsahern@...nel.org>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org, David Ahern <dsahern@...il.com>
Subject: [PATCH iproute2-next 07/12] mroute: Add table id attribute for kernel side filtering
From: David Ahern <dsahern@...il.com>
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@...il.com>
---
ip/ipmroute.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index b8f0bc49b92e..b29c78e4cc86 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;
}
--
2.11.0
Powered by blists - more mailing lists