summaryrefslogtreecommitdiffstats
path: root/net/mpls
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-10-15 18:56:48 -0700
committerDavid S. Miller <davem@davemloft.net>2018-10-16 00:14:07 -0700
commiteffe6792662495ad9c175bf0d9c53459a51fdbbd (patch)
tree91353d9080049cba45bae02ddad84c1e6232dbb7 /net/mpls
parentcb167893f41e21e6bd283d78e53489289dc0592d (diff)
downloadlinux-effe6792662495ad9c175bf0d9c53459a51fdbbd.tar.gz
linux-effe6792662495ad9c175bf0d9c53459a51fdbbd.tar.bz2
linux-effe6792662495ad9c175bf0d9c53459a51fdbbd.zip
net: Enable kernel side filtering of route dumps
Update parsing of route dump request to enable kernel side filtering. Allow filtering results by protocol (e.g., which routing daemon installed the route), route type (e.g., unicast), table id and nexthop device. These amount to the low hanging fruit, yet a huge improvement, for dumping routes. ip_valid_fib_dump_req is called with RTNL held, so __dev_get_by_index can be used to look up the device index without taking a reference. From there filter->dev is only used during dump loops with the lock still held. Set NLM_F_DUMP_FILTERED in the answer_flags so the user knows the results have been filtered should no entries be returned. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls')
-rw-r--r--net/mpls/af_mpls.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 48f4cbd9fb38..24381696932a 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -2034,15 +2034,16 @@ nla_put_failure:
#if IS_ENABLED(CONFIG_INET)
static int mpls_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
struct fib_dump_filter *filter,
- struct netlink_ext_ack *extack)
+ struct netlink_callback *cb)
{
- return ip_valid_fib_dump_req(net, nlh, filter, extack);
+ return ip_valid_fib_dump_req(net, nlh, filter, cb);
}
#else
static int mpls_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
struct fib_dump_filter *filter,
- struct netlink_ext_ack *extack)
+ struct netlink_callback *cb)
{
+ struct netlink_ext_ack *extack = cb->extack;
struct rtmsg *rtm;
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) {
@@ -2104,7 +2105,7 @@ static int mpls_dump_routes(struct sk_buff *skb, struct netlink_callback *cb)
if (cb->strict_check) {
int err;
- err = mpls_valid_fib_dump_req(net, nlh, &filter, cb->extack);
+ err = mpls_valid_fib_dump_req(net, nlh, &filter, cb);
if (err < 0)
return err;