Skip to content

Commit 7c1e8a3

Browse files
Arthur Gautierdavem330
authored andcommitted
netlink: fixup regression in RTM_GETADDR
This commit fixes a regression in AF_INET/RTM_GETADDR and AF_INET6/RTM_GETADDR. Before this commit, the kernel would stop dumping addresses once the first skb was full and end the stream with NLMSG_DONE(-EMSGSIZE). The error shouldn't be sent back to netlink_dump so the callback is kept alive. The userspace is expected to call back with a new empty skb. Changes from V1: - The error is not handled in netlink_dump anymore but rather in inet_dump_ifaddr and inet6_dump_addr directly as suggested by David Ahern. Fixes: d7e3861 ("net/ipv4: Put target net when address dump fails due to bad attributes") Fixes: 242afaa ("net/ipv6: Put target net when address dump fails due to bad attributes") Cc: David Ahern <[email protected]> Cc: "David S . Miller" <[email protected]> Cc: [email protected] Signed-off-by: Arthur Gautier <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1492623 commit 7c1e8a3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/ipv4/devinet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
18261826
if (fillargs.netnsid >= 0)
18271827
put_net(tgt_net);
18281828

1829-
return err < 0 ? err : skb->len;
1829+
return skb->len ? : err;
18301830
}
18311831

18321832
static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,

net/ipv6/addrconf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5154,7 +5154,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
51545154
if (fillargs.netnsid >= 0)
51555155
put_net(tgt_net);
51565156

5157-
return err < 0 ? err : skb->len;
5157+
return skb->len ? : err;
51585158
}
51595159

51605160
static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)

0 commit comments

Comments
 (0)