diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2015-04-15 14:00:53 +0200 |
---|---|---|
committer | Stephen Hemminger <shemming@brocade.com> | 2015-04-20 10:04:20 -0700 |
commit | 782cf01dc01a7af01928bb12f60683f2bfe25a96 (patch) | |
tree | ae8dc7543bf044dc0b71a1f34c8aef354ae8924b /ip/xfrm_state.c | |
parent | d652ccbf8195e63ff6eedb923fad060b065fd18a (diff) | |
download | platform_external_iproute2-782cf01dc01a7af01928bb12f60683f2bfe25a96.tar.gz platform_external_iproute2-782cf01dc01a7af01928bb12f60683f2bfe25a96.tar.bz2 platform_external_iproute2-782cf01dc01a7af01928bb12f60683f2bfe25a96.zip |
ipxfrm: wrong nl msg sent on deleteall cmd
XFRM netlink family is independent from the route netlink family. It's wrong
to call rtnl_wilddump_request(), because it will add a 'struct ifinfomsg' into
the header and the kernel will complain (at least for xfrm state):
netlink: 24 bytes leftover after parsing attributes in process `ip'.
Reported-by: Gregory Hoggarth <Gregory.Hoggarth@alliedtelesis.co.nz>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Diffstat (limited to 'ip/xfrm_state.c')
-rw-r--r-- | ip/xfrm_state.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 2ad3d8d3..04af50b3 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -1148,13 +1148,23 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall) xb.rth = &rth; for (i = 0; ; i++) { + struct { + struct nlmsghdr n; + char buf[NLMSG_BUF_SIZE]; + } req = { + .n.nlmsg_len = NLMSG_HDRLEN, + .n.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST, + .n.nlmsg_type = XFRM_MSG_GETSA, + .n.nlmsg_seq = rth.dump = ++rth.seq, + }; + xb.offset = 0; xb.nlmsg_count = 0; if (show_stats > 1) fprintf(stderr, "Delete-all round = %d\n", i); - if (rtnl_wilddump_request(&rth, preferred_family, XFRM_MSG_GETSA) < 0) { + if (rtnl_send(&rth, (void *)&req, req.n.nlmsg_len) < 0) { perror("Cannot send dump request"); exit(1); } |