Skip to content

Commit e4e92fb

Browse files
dsaherndavem330
authored andcommitted
net/ipv4: Bail early if user only wants prefix entries
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@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 08e814c commit e4e92fb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎net/ipv4/fib_frontend.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,14 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
886886
err = ip_valid_fib_dump_req(net, nlh, &filter, cb);
887887
if (err < 0)
888888
return err;
889+
} else if (nlmsg_len(nlh) >= sizeof(struct rtmsg)) {
890+
struct rtmsg *rtm = nlmsg_data(nlh);
891+
892+
filter.flags = rtm->rtm_flags & (RTM_F_PREFIX | RTM_F_CLONED);
889893
}
890894

891-
if (nlmsg_len(nlh) >= sizeof(struct rtmsg) &&
892-
((struct rtmsg *)nlmsg_data(nlh))->rtm_flags & RTM_F_CLONED)
895+
/* fib entries are never clones and ipv4 does not use prefix flag */
896+
if (filter.flags & (RTM_F_PREFIX | RTM_F_CLONED))
893897
return skb->len;
894898

895899
if (filter.table_id) {

0 commit comments

Comments
 (0)