Skip to contentSkip to conversation

Show 'external' link mode in output

PATCH Applied Phil Dibowitz 3 participants 4 messages Dec 12, 2017 – Dec 13, 2017

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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: <NOARP> 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
```
---
 ip/link_ip6tnl.c | 3 +++
 ip/link_iptnl.c  | 3 +++
 2 files changed, 6 insertions(+)
ip/link_ip6tnl.c +3 -0
index 43287ab..5d0efc8 100644
@@ -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]);
 
ip/link_iptnl.c +3 -0
index 4940b8b..e345b5c 100644
@@ -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]);
 
Signature · 1 line
2.9.5
#1 lore raw

Hello!

Quoted 23 lines · Phil Dibowitz

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: <NOARP> 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
```
---
  ip/link_ip6tnl.c | 3 +++
  ip/link_iptnl.c  | 3 +++
  2 files changed, 6 insertions(+)
ip/link_ip6tnl.c +0 -0
index 43287ab..5d0efc8 100644

ip/link_ip6tnl.c static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb · line 350

Quoted 6 lines
ip/link_ip6tnl.c +3 -0
@@ -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);
+

The original code is indented with tabs, you're using spaces. Not good. :-)

Quoted 8 lines
ip/link_ip6tnl.c +0 -0
  	if (tb[IFLA_IPTUN_FLAGS])
  		flags = rta_getattr_u32(tb[IFLA_IPTUN_FLAGS]);
 
ip/link_iptnl.c +0 -0
index 4940b8b..e345b5c 100644

ip/link_iptnl.c static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[ · line 401

Quoted 9 lines
ip/link_iptnl.c +3 -0
@@ -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]);
 

Here as well...

MBR, Sergei

#2 lore raw
Quoted 1 line · Sergei Shtylyov

Hello!

Hi!

Quoted 2 lines

  The original code is indented with tabs, you're using spaces. Not good. :-)

I sent a v2 of the patch later yesterday that fixed this.

Thanks!

Signature · 7 lines
Phil Dibowitz                             [email protected]
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't
 matter and those who matter don't mind."
 - Dr. Seuss
#3 lore raw
In reply to Phil Dibowitz
Quoted 5 lines · On Tue, 12 Dec 2017 12:23:19 -0800 Phil Dibowitz <[email protected]> wrote:

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:

Quoted 8 lines
```
7: tunl60@NONE: <NOARP> 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
```

Applied, thanks.