]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net/ipv6: Bail early if user only wants cloned entries
authorDavid Ahern <dsahern@gmail.com>
Tue, 16 Oct 2018 01:56:50 +0000 (18:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Oct 2018 07:14:07 +0000 (00:14 -0700)
Similar to IPv4, IPv6 fib no longer contains cloned routes. If a user
requests a route dump for only cloned entries, no sense walking the FIB
and returning everything.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_fib.c

index 5562c77022c6798e10b7f507bef3d5a8eb60b839..2a058b408a6a996bb2ee413c389a20384c5a5f8c 100644 (file)
@@ -586,10 +586,13 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
        } else if (nlmsg_len(nlh) >= sizeof(struct rtmsg)) {
                struct rtmsg *rtm = nlmsg_data(nlh);
 
-               if (rtm->rtm_flags & RTM_F_PREFIX)
-                       arg.filter.flags = RTM_F_PREFIX;
+               arg.filter.flags = rtm->rtm_flags & (RTM_F_PREFIX|RTM_F_CLONED);
        }
 
+       /* fib entries are never clones */
+       if (arg.filter.flags & RTM_F_CLONED)
+               return skb->len;
+
        w = (void *)cb->args[2];
        if (!w) {
                /* New dump: