<feed xmlns='http://www.w3.org/2005/Atom'>
<title>android_external_iproute2/ip/iptunnel.c, branch cm-14.0</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/'/>
<entry>
<title>ip{,6}tunnel: have a shared stats parser/printer</title>
<updated>2015-12-18T19:46:21+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-12-18T10:58:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=7d6aadcd0a1dc795d72e1ab311aee333c763fe71'/>
<id>7d6aadcd0a1dc795d72e1ab311aee333c763fe71</id>
<content type='text'>
This has a slight side-effect of not aborting when /proc/net/dev is
malformed, but OTOH stats are not parsed for uninteresting interfaces.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This has a slight side-effect of not aborting when /proc/net/dev is
malformed, but OTOH stats are not parsed for uninteresting interfaces.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ip: fix format string when reading statistics</title>
<updated>2015-12-10T16:52:10+00:00</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemming@brocade.com</email>
</author>
<published>2015-12-10T16:52:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=654ae881de57467642c8c2ed16ffc3a8d57fafa2'/>
<id>654ae881de57467642c8c2ed16ffc3a8d57fafa2</id>
<content type='text'>
The tunnel code was doing sscanf(buf, "%ld", &amp;x) where x was unsigned
long.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The tunnel code was doing sscanf(buf, "%ld", &amp;x) where x was unsigned
long.
</pre>
</div>
</content>
</entry>
<entry>
<title>iptunnel: cleanup code</title>
<updated>2015-11-29T20:05:39+00:00</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemming@brocade.com</email>
</author>
<published>2015-11-29T20:05:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=a96a5d94c6bd58cb455c66a38cff6077841e7aab'/>
<id>a96a5d94c6bd58cb455c66a38cff6077841e7aab</id>
<content type='text'>
Make iptunnel pass checkpatch (mostly).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make iptunnel pass checkpatch (mostly).
</pre>
</div>
</content>
</entry>
<entry>
<title>ip_tunnel: determine tunnel address family from the tunnel type</title>
<updated>2015-11-29T19:57:21+00:00</updated>
<author>
<name>Konstantin Shemyak</name>
<email>konstantin@shemyak.com</email>
</author>
<published>2015-11-26T16:22:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=cc9c1dfaee04030f1c2a80fb28d99c62ce0fca6a'/>
<id>cc9c1dfaee04030f1c2a80fb28d99c62ce0fca6a</id>
<content type='text'>
On 24.11.2015 02:26, Stephen Hemminger wrote:
&gt; On Thu, 12 Nov 2015 21:10:08 +0000
&gt; Konstantin Shemyak &lt;konstantin@shemyak.com&gt; wrote:
&gt;
&gt;&gt; When creating an IP tunnel over IPv6, the address family must be passed in
&gt;&gt; the option, e.g.
&gt;&gt;
&gt;&gt; ip -6 tunnel add mode ip6gre local 1::1 remote 2::2
&gt;&gt;
&gt;&gt; This makes it impossible to create both IPv4 and IPv6 tunnels in one batch.
&gt;&gt;
&gt;&gt; In fact the address family option is redundant here, as each tunnel mode is
&gt;&gt; relevant for only one address family.
&gt;&gt; The patch determines whether the applicable address family is AF_INET6
&gt;&gt; instead of the default AF_INET and makes the "-6" option unnecessary for
&gt;&gt; "ip tunnel add".
&gt;&gt;
&gt;&gt; Signed-off-by: Konstantin Shemyak &lt;konstantin@shemyak.com&gt;
&gt;&gt; ---
&gt;&gt;   ip/iptunnel.c                          | 26 ++++++++++++++++++++++++++
&gt;&gt;   testsuite/tests/ip/tunnel/add_tunnel.t | 14 ++++++++++++++
&gt;&gt;   2 files changed, 40 insertions(+)
&gt;&gt;   create mode 100755 testsuite/tests/ip/tunnel/add_tunnel.t
&gt;&gt;
&gt;&gt; diff --git a/ip/iptunnel.c b/ip/iptunnel.c
&gt;&gt; index 78fa988..7826a37 100644
&gt;&gt; --- a/ip/iptunnel.c
&gt;&gt; +++ b/ip/iptunnel.c
&gt;&gt; @@ -629,8 +629,34 @@ static int do_6rd(int argc, char **argv)
&gt;&gt;          return tnl_6rd_ioctl(cmd, medium, &amp;ip6rd);
&gt;&gt;   }
&gt;&gt;
&gt;&gt; +static int tunnel_mode_is_ipv6(char *tunnel_mode) {
&gt;&gt; +       char *ipv6_modes[] = {
&gt;&gt; +               "ipv6/ipv6", "ip6ip6",
&gt;&gt; +               "vti6",
&gt;&gt; +               "ip/ipv6", "ipv4/ipv6", "ipip6", "ip4ip6",
&gt;&gt; +               "ip6gre", "gre/ipv6",
&gt;&gt; +               "any/ipv6", "any"
&gt;&gt; +       };
&gt;&gt; +       int i;
&gt;&gt; +
&gt;&gt; +       for (i = 0; i &lt; sizeof(ipv6_modes) / sizeof(char *); i++) {
&gt;&gt; +               if (strcmp(ipv6_modes[i], tunnel_mode) == 0)
&gt;&gt; +                       return 1;
&gt;&gt; +       }
&gt;&gt; +       return 0;
&gt;&gt; +}
&gt;&gt; +
&gt;
&gt; The ipv6_modes table should be static const.

Thank you for the note! attached the corrected patch.

&gt; Also is it possible to use strstr for ipv6 and ip6 or even strchr(tunnel_mode, '6')
&gt; to simplify this?

There is IPv6 tunnel mode 'any', and IPv4 tunnel mode 'ipv6/ip' (aka
'sit'). It looks to me that attempts to find some substring match
would not make the code much shorter, but definitely less readable.

Konstantin Shemyak.

&gt;From 42d27db0055c3a114fe6eb86d680bef9ec098ad4 Mon Sep 17 00:00:00 2001
From: Konstantin Shemyak &lt;konstantin@shemyak.com&gt;
Date: Thu, 12 Nov 2015 20:52:02 +0200
Subject: [PATCH] Tunnel address family is determined from the tunnel mode

When the tunnel mode already tells the IP address family, "ip tunnel"
command determines it and does not require option "-4"/"-6" to be passed.

This makes possible creating both IPv4 and IPv6 tunnels in one batch.

Signed-off-by: Konstantin Shemyak &lt;konstantin@shemyak.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On 24.11.2015 02:26, Stephen Hemminger wrote:
&gt; On Thu, 12 Nov 2015 21:10:08 +0000
&gt; Konstantin Shemyak &lt;konstantin@shemyak.com&gt; wrote:
&gt;
&gt;&gt; When creating an IP tunnel over IPv6, the address family must be passed in
&gt;&gt; the option, e.g.
&gt;&gt;
&gt;&gt; ip -6 tunnel add mode ip6gre local 1::1 remote 2::2
&gt;&gt;
&gt;&gt; This makes it impossible to create both IPv4 and IPv6 tunnels in one batch.
&gt;&gt;
&gt;&gt; In fact the address family option is redundant here, as each tunnel mode is
&gt;&gt; relevant for only one address family.
&gt;&gt; The patch determines whether the applicable address family is AF_INET6
&gt;&gt; instead of the default AF_INET and makes the "-6" option unnecessary for
&gt;&gt; "ip tunnel add".
&gt;&gt;
&gt;&gt; Signed-off-by: Konstantin Shemyak &lt;konstantin@shemyak.com&gt;
&gt;&gt; ---
&gt;&gt;   ip/iptunnel.c                          | 26 ++++++++++++++++++++++++++
&gt;&gt;   testsuite/tests/ip/tunnel/add_tunnel.t | 14 ++++++++++++++
&gt;&gt;   2 files changed, 40 insertions(+)
&gt;&gt;   create mode 100755 testsuite/tests/ip/tunnel/add_tunnel.t
&gt;&gt;
&gt;&gt; diff --git a/ip/iptunnel.c b/ip/iptunnel.c
&gt;&gt; index 78fa988..7826a37 100644
&gt;&gt; --- a/ip/iptunnel.c
&gt;&gt; +++ b/ip/iptunnel.c
&gt;&gt; @@ -629,8 +629,34 @@ static int do_6rd(int argc, char **argv)
&gt;&gt;          return tnl_6rd_ioctl(cmd, medium, &amp;ip6rd);
&gt;&gt;   }
&gt;&gt;
&gt;&gt; +static int tunnel_mode_is_ipv6(char *tunnel_mode) {
&gt;&gt; +       char *ipv6_modes[] = {
&gt;&gt; +               "ipv6/ipv6", "ip6ip6",
&gt;&gt; +               "vti6",
&gt;&gt; +               "ip/ipv6", "ipv4/ipv6", "ipip6", "ip4ip6",
&gt;&gt; +               "ip6gre", "gre/ipv6",
&gt;&gt; +               "any/ipv6", "any"
&gt;&gt; +       };
&gt;&gt; +       int i;
&gt;&gt; +
&gt;&gt; +       for (i = 0; i &lt; sizeof(ipv6_modes) / sizeof(char *); i++) {
&gt;&gt; +               if (strcmp(ipv6_modes[i], tunnel_mode) == 0)
&gt;&gt; +                       return 1;
&gt;&gt; +       }
&gt;&gt; +       return 0;
&gt;&gt; +}
&gt;&gt; +
&gt;
&gt; The ipv6_modes table should be static const.

Thank you for the note! attached the corrected patch.

&gt; Also is it possible to use strstr for ipv6 and ip6 or even strchr(tunnel_mode, '6')
&gt; to simplify this?

There is IPv6 tunnel mode 'any', and IPv4 tunnel mode 'ipv6/ip' (aka
'sit'). It looks to me that attempts to find some substring match
would not make the code much shorter, but definitely less readable.

Konstantin Shemyak.

&gt;From 42d27db0055c3a114fe6eb86d680bef9ec098ad4 Mon Sep 17 00:00:00 2001
From: Konstantin Shemyak &lt;konstantin@shemyak.com&gt;
Date: Thu, 12 Nov 2015 20:52:02 +0200
Subject: [PATCH] Tunnel address family is determined from the tunnel mode

When the tunnel mode already tells the IP address family, "ip tunnel"
command determines it and does not require option "-4"/"-6" to be passed.

This makes possible creating both IPv4 and IPv6 tunnels in one batch.

Signed-off-by: Konstantin Shemyak &lt;konstantin@shemyak.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ip{,6}tunnel: put spaces around non-unary operators</title>
<updated>2015-11-23T23:26:37+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-11-13T17:09:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=04ce8d3edaa1d6021921a074fa90fc9db4d3f6b7'/>
<id>04ce8d3edaa1d6021921a074fa90fc9db4d3f6b7</id>
<content type='text'>
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>iptunnel: sanitize copying tunnel name</title>
<updated>2015-11-23T23:26:37+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-11-13T17:09:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=f53ecee818280961d86c4ffb07c367144b91490d'/>
<id>f53ecee818280961d86c4ffb07c367144b91490d</id>
<content type='text'>
Since p-&gt;name is only IFNAMSIZ bytes, do not copy more than IFNAMSIZ - 1
bytes into it so there remains at least a single null byte in the end.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since p-&gt;name is only IFNAMSIZ bytes, do not copy more than IFNAMSIZ - 1
bytes into it so there remains at least a single null byte in the end.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>iptunnel: share common code when determining the default interface name</title>
<updated>2015-11-23T23:26:37+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-11-13T17:09:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=c957821b186e799fc86ae82c7d153b598a7a9c61'/>
<id>c957821b186e799fc86ae82c7d153b598a7a9c61</id>
<content type='text'>
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>iptunnel: simplify parsing TTL, allow 'hlim' as identifier</title>
<updated>2015-11-23T23:26:37+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-11-13T17:09:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=0dd4d2b37fb4f88518f73e4635435e918093397f'/>
<id>0dd4d2b37fb4f88518f73e4635435e918093397f</id>
<content type='text'>
Instead of parsing an unsigned integer and checking boundaries, simply
parse u8. This and the added ttl alias 'hlim' provide consistency with
ip6tunnel.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of parsing an unsigned integer and checking boundaries, simply
parse u8. This and the added ttl alias 'hlim' provide consistency with
ip6tunnel.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>iptunnel: share common code when setting tunnel mode</title>
<updated>2015-11-23T23:26:37+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-11-13T17:09:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=2520598a1aa846c51d023714f7e713cd6e2dd56b'/>
<id>2520598a1aa846c51d023714f7e713cd6e2dd56b</id>
<content type='text'>
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ip{,6}tunnel: align do_tunnels_list() a bit</title>
<updated>2015-11-23T23:26:37+00:00</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-11-13T17:08:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/LineageOS/android_external_iproute2/commit/?id=c4527d7ba36edd214d5e1a700affd5bf89c5cecc'/>
<id>c4527d7ba36edd214d5e1a700affd5bf89c5cecc</id>
<content type='text'>
In iptunnel, declare loop variables inside the loop as done in
ip6tunnel.

Fix and simplify goto logic in ip6tunnel:
- Failure to read over header lines would have left fp opened.
- By returning directly upon fopen() failure, fp can be closed
  unconditionally in the end.

Use the same goto logic in iptunnel, as well.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In iptunnel, declare loop variables inside the loop as done in
ip6tunnel.

Fix and simplify goto logic in ip6tunnel:
- Failure to read over header lines would have left fp opened.
- By returning directly upon fopen() failure, fp can be closed
  unconditionally in the end.

Use the same goto logic in iptunnel, as well.

Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
</pre>
</div>
</content>
</entry>
</feed>
