From 2884af6d370a27875c4df2411a89005a3f0a98f7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 1 Jun 2018 15:44:14 -0400 Subject: [PATCH 1/5] rt_protos: drop old experimental gated names No longer need these petroglyph values. Signed-off-by: Stephen Hemminger --- etc/iproute2/rt_protos | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/etc/iproute2/rt_protos b/etc/iproute2/rt_protos index 82cf9c46..2a9ee01b 100644 --- a/etc/iproute2/rt_protos +++ b/etc/iproute2/rt_protos @@ -16,16 +16,3 @@ 15 ntk 16 dhcp 42 babel - -# -# Used by me for gated -# -254 gated/aggr -253 gated/bgp -252 gated/ospf -251 gated/ospfase -250 gated/rip -249 gated/static -248 gated/conn -247 gated/inet -246 gated/default From 4c3493689ed3683ef59855cc47ed586b55e7ee6f Mon Sep 17 00:00:00 2001 From: David Ahern Date: Fri, 1 Jun 2018 08:50:16 -0700 Subject: [PATCH 2/5] iplink_vrf: Save device index from response for return code A recent commit changed rtnl_talk_* to return the response message in allocated memory so callers need to free it. The change to name_is_vrf did not save the device index which is pointing to a struct inside the now allocated and freed memory resulting in garbage getting returned in some cases. Fix by using a stack variable to save the return value and only set it to ifi->ifi_index after all checks are done and before the answer buffer is freed. Fixes: 86bf43c7c2fdc ("lib/libnetlink: update rtnl_talk to support malloc buff at run time") Cc: Hangbin Liu Cc: Phil Sutter Signed-off-by: David Ahern Acked-by: Phil Sutter Signed-off-by: Stephen Hemminger --- ip/iplink_vrf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ip/iplink_vrf.c b/ip/iplink_vrf.c index e9dd0df9..5d20f29d 100644 --- a/ip/iplink_vrf.c +++ b/ip/iplink_vrf.c @@ -191,6 +191,7 @@ int name_is_vrf(const char *name) struct rtattr *tb[IFLA_MAX+1]; struct rtattr *li[IFLA_INFO_MAX+1]; struct ifinfomsg *ifi; + int ifindex = 0; int len; addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, strlen(name) + 1); @@ -218,7 +219,8 @@ int name_is_vrf(const char *name) if (strcmp(RTA_DATA(li[IFLA_INFO_KIND]), "vrf")) goto out; + ifindex = ifi->ifi_index; out: free(answer); - return ifi->ifi_index; + return ifindex; } From b8e7799003e414fbe4f6f865500a3efffcfbbf67 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Wed, 30 May 2018 12:11:32 -0700 Subject: [PATCH 3/5] iproute2: fix 'ip xfrm monitor all' command Currently, calling 'ip xfrm monitor all' will actually invoke the 'all-nsid' command because the soft-match for 'all-nsid' occurs before the precise match for 'all'. This patch rearranges the checks so that the 'all' command, itself an alias for invoking 'ip xfrm monitor' with no argument, can be called consistent with the syntax for other ip commands that accept an 'all'. Signed-off-by: Nathan Harold Signed-off-by: Stephen Hemminger --- ip/xfrm_monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c index 2eabece0..5d086768 100644 --- a/ip/xfrm_monitor.c +++ b/ip/xfrm_monitor.c @@ -359,6 +359,8 @@ int do_xfrm_monitor(int argc, char **argv) if (matches(*argv, "file") == 0) { NEXT_ARG(); file = *argv; + } else if (strcmp(*argv, "all") == 0) { + /* fall out */ } else if (matches(*argv, "all-nsid") == 0) { listen_all_nsid = 1; } else if (matches(*argv, "acquire") == 0) { @@ -381,7 +383,7 @@ int do_xfrm_monitor(int argc, char **argv) groups = 0; } else if (matches(*argv, "help") == 0) { usage(); - } else if (strcmp(*argv, "all")) { + } else { fprintf(stderr, "Argument \"%s\" is unknown, try \"ip xfrm monitor help\".\n", *argv); exit(-1); } From eaf89d7d525eb3e507c3c921fa1089a33de85db7 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Thu, 31 May 2018 16:28:48 +0200 Subject: [PATCH 4/5] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support Parse and display those attributes. Example: ip l a type dummy ip netns add foo ip monitor link& ip l s dummy1 netns foo Deleted 6: dummy1: mtu 1500 qdisc noop state DOWN group default link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6 Signed-off-by: Nicolas Dichtel Signed-off-by: Stephen Hemminger --- ip/ipaddress.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 00da14c6..c7c7e7df 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who, } } + if (tb[IFLA_NEW_NETNSID]) { + int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]); + + print_int(PRINT_FP, NULL, " new-nsid %d", id); + } + if (tb[IFLA_NEW_IFINDEX]) { + int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]); + + print_int(PRINT_FP, NULL, " new-ifindex %d", id); + } + if (tb[IFLA_PROTO_DOWN]) { if (rta_getattr_u8(tb[IFLA_PROTO_DOWN])) print_bool(PRINT_ANY, From 9e4a92e5aa97c804bf684365df7c3d91b42cf96d Mon Sep 17 00:00:00 2001 From: Ivan Vecera Date: Fri, 1 Jun 2018 10:18:49 +0200 Subject: [PATCH 5/5] devlink: don't enforce NETLINK_{CAP,EXT}_ACK sock opts Since commit 049c58539f5d ("devlink: mnlg: Add support for extended ack") devlink requires NETLINK_{CAP,EXT}_ACK. This prevents devlink from working with older kernels that don't support these features. host # ./devlink/devlink Failed to connect to devlink Netlink Fixes: 049c58539f5d ("devlink: mnlg: Add support for extended ack") Cc: Arkadi Sharshevsky Cc: Stephen Hemminger Signed-off-by: Ivan Vecera Acked-by: Jiri Pirko --- devlink/mnlg.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/devlink/mnlg.c b/devlink/mnlg.c index 3d28453a..c33c90be 100644 --- a/devlink/mnlg.c +++ b/devlink/mnlg.c @@ -271,15 +271,9 @@ struct mnlg_socket *mnlg_socket_open(const char *family_name, uint8_t version) if (!nlg->nl) goto err_mnl_socket_open; - err = mnl_socket_setsockopt(nlg->nl, NETLINK_CAP_ACK, &one, - sizeof(one)); - if (err) - goto err_mnl_set_ack; - - err = mnl_socket_setsockopt(nlg->nl, NETLINK_EXT_ACK, &one, - sizeof(one)); - if (err) - goto err_mnl_set_ext_ack; + /* Older kernels may no support capped/extended ACK reporting */ + mnl_socket_setsockopt(nlg->nl, NETLINK_CAP_ACK, &one, sizeof(one)); + mnl_socket_setsockopt(nlg->nl, NETLINK_EXT_ACK, &one, sizeof(one)); err = mnl_socket_bind(nlg->nl, 0, MNL_SOCKET_AUTOPID); if (err < 0) @@ -305,8 +299,6 @@ struct mnlg_socket *mnlg_socket_open(const char *family_name, uint8_t version) err_mnlg_socket_recv_run: err_mnlg_socket_send: err_mnl_socket_bind: -err_mnl_set_ext_ack: -err_mnl_set_ack: mnl_socket_close(nlg->nl); err_mnl_socket_open: free(nlg->buf);