summaryrefslogtreecommitdiff
path: root/drivers/net/bareudp.c
diff options
context:
space:
mode:
authorBeniamino Galvani <b.galvani@gmail.com>2023-10-20 13:55:27 +0200
committerDavid S. Miller <davem@davemloft.net>2023-10-23 08:48:57 +0100
commit946fcfdbc5b97e26d31339ebca2d9a51a4f975ff (patch)
treea3dc11694aa04984f0958886eca2527cd7413483 /drivers/net/bareudp.c
parent7e937dcf96d0489b3cdd1cff9dfd049617d28492 (diff)
downloadlwn-946fcfdbc5b97e26d31339ebca2d9a51a4f975ff.tar.gz
lwn-946fcfdbc5b97e26d31339ebca2d9a51a4f975ff.zip
ipv6: add new arguments to udp_tunnel6_dst_lookup()
We want to make the function more generic so that it can be used by other UDP tunnel implementations such as geneve and vxlan. To do that, add the following arguments: - source and destination UDP port; - ifindex of the output interface, needed by vxlan; - the tos, because in some cases it is not taken from struct ip_tunnel_info (for example, when it's inherited from the inner packet); - the dst cache, because not all tunnel types (e.g. vxlan) want to use the one from struct ip_tunnel_info. With these parameters, the function no longer needs the full struct ip_tunnel_info as argument and we can pass only the relevant part of it (struct ip_tunnel_key). This is similar to what already done for IPv4 in commit 72fc68c6356b ("ipv4: add new arguments to udp_tunnel_dst_lookup()"). Suggested-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bareudp.c')
-rw-r--r--drivers/net/bareudp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 9eb5e11c09b4..9c11a0d0273b 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -371,8 +371,10 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
if (!sock)
return -ESHUTDOWN;
- dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock, &saddr, info,
- use_cache);
+ dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock, 0, &saddr,
+ key, 0, 0, key->tos,
+ use_cache ?
+ (struct dst_cache *) &info->dst_cache : NULL);
if (IS_ERR(dst))
return PTR_ERR(dst);
@@ -499,7 +501,9 @@ static int bareudp_fill_metadata_dst(struct net_device *dev,
struct socket *sock = rcu_dereference(bareudp->sock);
dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock,
- &saddr, info, use_cache);
+ 0, &saddr, &info->key,
+ 0, 0, info->key.tos,
+ use_cache ? &info->dst_cache : NULL);
if (IS_ERR(dst))
return PTR_ERR(dst);