From 7b17832445259e942c1356de03924fc71d4b69b8 Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Tue, 12 Dec 2017 13:54:06 -0800 Subject: [PATCH 1/4] Show 'external' link mode in output Recently `external` support was added to the tunnel drivers, but there is no way to introspect this from userspace. This adds support for that. Now `ip -details link` shows it: ``` 7: tunl60@NONE: mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1 link/tunnel6 :: brd :: promiscuity 0 ip6tnl external any remote :: local :: encaplimit 0 hoplimit 0 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000) addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 ``` Signed-off-by: Phil Dibowitz --- ip/link_ip6tnl.c | 3 +++ ip/link_iptnl.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 43287ab3..af796c30 100644 --- a/ip/link_ip6tnl.c +++ b/ip/link_ip6tnl.c @@ -345,6 +345,9 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb if (!tb) return; + if (tb[IFLA_IPTUN_COLLECT_METADATA]) + print_bool(PRINT_ANY, "external", "external ", true); + if (tb[IFLA_IPTUN_FLAGS]) flags = rta_getattr_u32(tb[IFLA_IPTUN_FLAGS]); diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c index 4940b8b0..2804b8f4 100644 --- a/ip/link_iptnl.c +++ b/ip/link_iptnl.c @@ -393,6 +393,9 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[ if (!tb) return; + if (tb[IFLA_IPTUN_COLLECT_METADATA]) + print_bool(PRINT_ANY, "external", "external ", true); + if (tb[IFLA_IPTUN_REMOTE]) { unsigned int addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]); From 7827b37603f6ec575d303c7417b1991e93c6439e Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Wed, 13 Dec 2017 21:21:28 +0100 Subject: [PATCH 2/4] ip: add vxcan to help text Add missing tag 'vxcan' inside the help text which was missing in commit efe459c76d35f ('ip: link add vxcan support'). Signed-off-by: Oliver Hartkopp --- ip/ipaddress.c | 2 +- ip/iplink.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 8057011e..f150d919 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -74,7 +74,7 @@ static void usage(void) fprintf(stderr, "CONFFLAG := [ home | nodad | mngtmpaddr | noprefixroute | autojoin ]\n"); fprintf(stderr, "LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]\n"); fprintf(stderr, "LFT := forever | SECONDS\n"); - fprintf(stderr, "TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |\n"); + fprintf(stderr, "TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap |\n"); fprintf(stderr, " bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan | lowpan |\n"); fprintf(stderr, " gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti |\n"); fprintf(stderr, " nlmon | can | bond_slave | ipvlan | geneve | bridge_slave |\n"); diff --git a/ip/iplink.c b/ip/iplink.c index 0a8eb56f..e83f1477 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -109,7 +109,7 @@ void iplink_usage(void) "\n" " ip link help [ TYPE ]\n" "\n" - "TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |\n" + "TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap |\n" " bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan |\n" " gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan |\n" " vti | nlmon | team_slave | bond_slave | ipvlan | geneve |\n" From 1876ab0779df6e37ac294d414473c9b34f21567d Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Wed, 13 Dec 2017 20:56:16 +0100 Subject: [PATCH 3/4] tc: fix json array closing Fixes: 2704bd625583 ("tc: jsonify actions core") Signed-off-by: Jiri Pirko --- tc/m_action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/m_action.c b/tc/m_action.c index 13f942bf..8185819d 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -378,7 +378,7 @@ tc_print_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts) } } - close_json_object(); + close_json_array(PRINT_JSON, NULL); return 0; } From 83cf5bc73b858608d59c3c6126a9f37e793e15dd Mon Sep 17 00:00:00 2001 From: Chris Mi Date: Thu, 14 Dec 2017 18:09:00 +0900 Subject: [PATCH 4/4] tc: fix command "tc actions del" hang issue If command is RTM_DELACTION, a non-NULL pointer is passed to rtnl_talk(). Then flag NLM_F_ACK is not set on n->nlmsg_flags and netlink_ack() will not be called. Command tc will wait for the reply for ever. Fixes: 86bf43c7c2fd ("lib/libnetlink: update rtnl_talk to support malloc buff at run time") Reviewed-by: Jiri Pirko Signed-off-by: Chris Mi Signed-off-by: Stephen Hemminger --- tc/m_action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/m_action.c b/tc/m_action.c index 8185819d..fc422364 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -528,7 +528,7 @@ static int tc_action_gd(int cmd, unsigned int flags, req.n.nlmsg_seq = rth.dump = ++rth.seq; - if (rtnl_talk(&rth, &req.n, &ans) < 0) { + if (rtnl_talk(&rth, &req.n, cmd == RTM_DELACTION ? NULL : &ans) < 0) { fprintf(stderr, "We have an error talking to the kernel\n"); return 1; }