<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/net/ip_tunnels.h, branch v6.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-08-18T19:18:28Z</updated>
<entry>
<title>ip_tunnel: Respect tunnel key's "flow_flags" in IP tunnels</title>
<updated>2022-08-18T19:18:28Z</updated>
<author>
<name>Eyal Birger</name>
<email>eyal.birger@gmail.com</email>
</author>
<published>2022-08-18T07:41:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ec9fce4b31604f8415136a4c07f7dc8ad431aec'/>
<id>urn:sha1:7ec9fce4b31604f8415136a4c07f7dc8ad431aec</id>
<content type='text'>
Commit 451ef36bd229 ("ip_tunnels: Add new flow flags field to ip_tunnel_key")
added a "flow_flags" member to struct ip_tunnel_key which was later used by
the commit in the fixes tag to avoid dropping packets with sources that
aren't locally configured when set in bpf_set_tunnel_key().

VXLAN and GENEVE were made to respect this flag, ip tunnels like IPIP and GRE
were not.

This commit fixes this omission by making ip_tunnel_init_flow() receive
the flow flags from the tunnel key in the relevant collect_md paths.

Fixes: b8fff748521c ("bpf: Set flow flag to allow any source IP in bpf_tunnel_key")
Signed-off-by: Eyal Birger &lt;eyal.birger@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Paul Chaignon &lt;paul@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220818074118.726639-1-eyal.birger@gmail.com
</content>
</entry>
<entry>
<title>ip_tunnels: Add new flow flags field to ip_tunnel_key</title>
<updated>2022-07-26T10:43:16Z</updated>
<author>
<name>Paul Chaignon</name>
<email>paul@isovalent.com</email>
</author>
<published>2022-07-25T14:31:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=451ef36bd229f8aa329cb2258a859b4c636d08ef'/>
<id>urn:sha1:451ef36bd229f8aa329cb2258a859b4c636d08ef</id>
<content type='text'>
This commit extends the ip_tunnel_key struct with a new field for the
flow flags, to pass them to the route lookups. This new field will be
populated and used in subsequent commits.

Signed-off-by: Paul Chaignon &lt;paul@isovalent.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Link: https://lore.kernel.org/bpf/f8bfd4983bd06685a59b1e3ba76ca27496f51ef3.1658759380.git.paul@isovalent.com
</content>
</entry>
<entry>
<title>ip_tunnels: allow VXLAN/GENEVE to inherit TOS/TTL from VLAN</title>
<updated>2022-07-23T04:47:28Z</updated>
<author>
<name>Matthias May</name>
<email>matthias.may@westermo.com</email>
</author>
<published>2022-07-21T20:27:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7074732c8faee201a245a6f983008a5789c0be33'/>
<id>urn:sha1:7074732c8faee201a245a6f983008a5789c0be33</id>
<content type='text'>
The current code allows for VXLAN and GENEVE to inherit the TOS
respective the TTL when skb-protocol is ETH_P_IP or ETH_P_IPV6.
However when the payload is VLAN encapsulated, then this inheriting
does not work, because the visible skb-protocol is of type
ETH_P_8021Q or ETH_P_8021AD.

Instead of skb-&gt;protocol use skb_protocol().

Signed-off-by: Matthias May &lt;matthias.may@westermo.com&gt;
Link: https://lore.kernel.org/r/20220721202718.10092-1-matthias.may@westermo.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: adopt u64_stats_t in struct pcpu_sw_netstats</title>
<updated>2022-06-10T04:53:11Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-06-08T15:46:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9962acefbcb92736c268aafe5f52200948f60f3e'/>
<id>urn:sha1:9962acefbcb92736c268aafe5f52200948f60f3e</id>
<content type='text'>
As explained in commit 316580b69d0a ("u64_stats: provide u64_stats_t type")
we should use u64_stats_t and related accessors to avoid load/store tearing.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ip_gre, ip6_gre: Fix race condition on o_seqno in collect_md mode</title>
<updated>2022-04-25T10:40:45Z</updated>
<author>
<name>Peilin Ye</name>
<email>peilin.ye@bytedance.com</email>
</author>
<published>2022-04-21T22:09:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=31c417c948d7f6909cb63f0ac3298f3c38f8ce20'/>
<id>urn:sha1:31c417c948d7f6909cb63f0ac3298f3c38f8ce20</id>
<content type='text'>
As pointed out by Jakub Kicinski, currently using TUNNEL_SEQ in
collect_md mode is racy for [IP6]GRE[TAP] devices.  Consider the
following sequence of events:

1. An [IP6]GRE[TAP] device is created in collect_md mode using "ip link
   add ... external".  "ip" ignores "[o]seq" if "external" is specified,
   so TUNNEL_SEQ is off, and the device is marked as NETIF_F_LLTX (i.e.
   it uses lockless TX);
2. Someone sets TUNNEL_SEQ on outgoing skb's, using e.g.
   bpf_skb_set_tunnel_key() in an eBPF program attached to this device;
3. gre_fb_xmit() or __gre6_xmit() processes these skb's:

	gre_build_header(skb, tun_hlen,
			 flags, protocol,
			 tunnel_id_to_key32(tun_info-&gt;key.tun_id),
			 (flags &amp; TUNNEL_SEQ) ? htonl(tunnel-&gt;o_seqno++)
					      : 0);   ^^^^^^^^^^^^^^^^^

Since we are not using the TX lock (&amp;txq-&gt;_xmit_lock), multiple CPUs may
try to do this tunnel-&gt;o_seqno++ in parallel, which is racy.  Fix it by
making o_seqno atomic_t.

As mentioned by Eric Dumazet in commit b790e01aee74 ("ip_gre: lockless
xmit"), making o_seqno atomic_t increases "chance for packets being out
of order at receiver" when NETIF_F_LLTX is on.

Maybe a better fix would be:

1. Do not ignore "oseq" in external mode.  Users MUST specify "oseq" if
   they want the kernel to allow sequencing of outgoing packets;
2. Reject all outgoing TUNNEL_SEQ packets if the device was not created
   with "oseq".

Unfortunately, that would break userspace.

We could now make [IP6]GRE[TAP] devices always NETIF_F_LLTX, but let us
do it in separate patches to keep this fix minimal.

Suggested-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Fixes: 77a5196a804e ("gre: add sequence number for collect md mode.")
Signed-off-by: Peilin Ye &lt;peilin.ye@bytedance.com&gt;
Acked-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Handle l3mdev in ip_tunnel_init_flow</title>
<updated>2022-04-15T21:27:30Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@kernel.org</email>
</author>
<published>2022-04-13T17:43:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=db53cd3d88dc328dea2e968c9c8d3b4294a8a674'/>
<id>urn:sha1:db53cd3d88dc328dea2e968c9c8d3b4294a8a674</id>
<content type='text'>
Ido reported that the commit referenced in the Fixes tag broke
a gre use case with dummy devices. Add a check to ip_tunnel_init_flow
to see if the oif is an l3mdev port and if so set the oif to 0 to
avoid the oif comparison in fib_lookup_good_nhc.

Fixes: 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices")
Reported-by: Ido Schimmel &lt;idosch@idosch.org&gt;
Signed-off-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>sit: add net device refcount tracking to ip_tunnel</title>
<updated>2021-12-07T00:05:11Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2021-12-05T04:22:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c0fd407a0666a583a765cfb129c4dc492590ca89'/>
<id>urn:sha1:c0fd407a0666a583a765cfb129c4dc492590ca89</id>
<content type='text'>
Note that other ip_tunnel users do not seem to hold a reference
on tunnel-&gt;dev. Probably needs some investigations.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ip_tunnel: use ndo_siocdevprivate</title>
<updated>2021-07-27T19:11:44Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2021-07-27T13:45:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3e7a1c7c561ed8508fbdb98ed5708175bbcf7938'/>
<id>urn:sha1:3e7a1c7c561ed8508fbdb98ed5708175bbcf7938</id>
<content type='text'>
The various ipv4 and ipv6 tunnel drivers each implement a set
of 12 SIOCDEVPRIVATE commands for managing tunnels. These
all work correctly in compat mode.

Move them over to the new .ndo_siocdevprivate operation.

Cc: Hideaki YOSHIFUJI &lt;yoshfuji@linux-ipv6.org&gt;
Cc: David Ahern &lt;dsahern@kernel.org&gt;
Cc: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net</title>
<updated>2020-11-20T03:08:46Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2020-11-20T03:08:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=56495a2442a47d0ea752db62434913b3346fe5a5'/>
<id>urn:sha1:56495a2442a47d0ea752db62434913b3346fe5a5</id>
<content type='text'>
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ip_tunnels: Set tunnel option flag when tunnel metadata is present</title>
<updated>2020-11-14T00:58:10Z</updated>
<author>
<name>Yi-Hung Wei</name>
<email>yihung.wei@gmail.com</email>
</author>
<published>2020-11-11T00:16:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9c2e14b48119b39446031d29d994044ae958d8fc'/>
<id>urn:sha1:9c2e14b48119b39446031d29d994044ae958d8fc</id>
<content type='text'>
Currently, we may set the tunnel option flag when the size of metadata
is zero.  For example, we set TUNNEL_GENEVE_OPT in the receive function
no matter the geneve option is present or not.  As this may result in
issues on the tunnel flags consumers, this patch fixes the issue.

Related discussion:
* https://lore.kernel.org/netdev/1604448694-19351-1-git-send-email-yihung.wei@gmail.com/T/#u

Fixes: 256c87c17c53 ("net: check tunnel option type in tunnel flags")
Signed-off-by: Yi-Hung Wei &lt;yihung.wei@gmail.com&gt;
Link: https://lore.kernel.org/r/1605053800-74072-1-git-send-email-yihung.wei@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
