[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181011150627.4010-10-dsahern@kernel.org>
Date: Thu, 11 Oct 2018 08:06:27 -0700
From: David Ahern <dsahern@...nel.org>
To: netdev@...r.kernel.org, davem@...emloft.net
Cc: David Ahern <dsahern@...il.com>
Subject: [PATCH net-next 9/9] net/ipv4: Bail early if user only wants prefix entries
From: David Ahern <dsahern@...il.com>
Unlike IPv6, IPv4 does not have routes marked with RTF_PREFIX_RT. If the
flag is set in the dump request, just return.
In the process of this change, move the CLONE check to use the new
filter flags.
Signed-off-by: David Ahern <dsahern@...il.com>
---
net/ipv4/fib_frontend.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index a99f2c7ba4e6..3e5e3c380dbb 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -884,10 +884,14 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
err = ip_valid_fib_dump_req(net, nlh, &filter, cb->extack);
if (err < 0)
return err;
+ } else if (nlmsg_len(nlh) >= sizeof(struct rtmsg)) {
+ struct rtmsg *rtm = nlmsg_data(nlh);
+
+ filter.flags = rtm->rtm_flags & (RTM_F_PREFIX | RTM_F_CLONED);
}
- if (nlmsg_len(nlh) >= sizeof(struct rtmsg) &&
- ((struct rtmsg *)nlmsg_data(nlh))->rtm_flags & RTM_F_CLONED)
+ /* fib entries are never clones and ipv4 does not use prefix flag */
+ if (filter.flags & (RTM_F_PREFIX | RTM_F_CLONED))
return skb->len;
s_h = cb->args[0];
--
2.11.0
Powered by blists - more mailing lists