mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
udp_tunnel: Pass struct sock to udp_tunnel6_dst_lookup().
None of the udp_tunnel users need struct socket in their fast paths; it is only used for tunnel setup / teardown. Even udp_tunnel6_dst_lookup() does not need struct socket. Let's change udp_tunnel6_dst_lookup() to take struct sock instead of struct socket. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260502031401.3557229-4-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
2cba193628
commit
9333d5ff28
@@ -396,7 +396,7 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
|
||||
sport = udp_flow_src_port(bareudp->net, skb,
|
||||
bareudp->sport_min, USHRT_MAX,
|
||||
true);
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock, 0, &saddr,
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock->sk, 0, &saddr,
|
||||
key, sport, bareudp->port, key->tos,
|
||||
use_cache ?
|
||||
(struct dst_cache *) &info->dst_cache : NULL);
|
||||
@@ -532,7 +532,7 @@ static int bareudp_fill_metadata_dst(struct net_device *dev,
|
||||
if (!sock)
|
||||
return -ESHUTDOWN;
|
||||
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock,
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, bareudp->net, sock->sk,
|
||||
0, &saddr, &info->key,
|
||||
sport, bareudp->port, info->key.tos,
|
||||
use_cache ? &info->dst_cache : NULL);
|
||||
|
||||
@@ -1424,7 +1424,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
|
||||
geneve->cfg.port_min,
|
||||
geneve->cfg.port_max, true);
|
||||
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock, 0,
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock->sk, 0,
|
||||
&saddr, key, sport,
|
||||
geneve->cfg.info.key.tp_dst, prio,
|
||||
use_cache ?
|
||||
@@ -1592,7 +1592,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
|
||||
geneve->cfg.port_min,
|
||||
geneve->cfg.port_max, true);
|
||||
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock, 0,
|
||||
dst = udp_tunnel6_dst_lookup(skb, dev, geneve->net, gs6->sock->sk, 0,
|
||||
&saddr, &info->key, sport,
|
||||
geneve->cfg.info.key.tp_dst, prio,
|
||||
use_cache ? &info->dst_cache : NULL);
|
||||
|
||||
@@ -2559,7 +2559,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
|
||||
if (!ifindex)
|
||||
ifindex = sock6->sock->sk->sk_bound_dev_if;
|
||||
|
||||
ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock,
|
||||
ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock->sk,
|
||||
ifindex, &saddr, pkey,
|
||||
src_port, dst_port, tos,
|
||||
use_cache ? dst_cache : NULL);
|
||||
@@ -3254,7 +3254,7 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
|
||||
if (!sock6)
|
||||
return -EIO;
|
||||
|
||||
ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock,
|
||||
ndst = udp_tunnel6_dst_lookup(skb, dev, vxlan->net, sock6->sock->sk,
|
||||
0, &info->key.u.ipv6.src,
|
||||
&info->key,
|
||||
sport, dport, info->key.tos,
|
||||
|
||||
@@ -188,7 +188,7 @@ struct rtable *udp_tunnel_dst_lookup(struct sk_buff *skb,
|
||||
struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb,
|
||||
struct net_device *dev,
|
||||
struct net *net,
|
||||
struct socket *sock, int oif,
|
||||
struct sock *sk, int oif,
|
||||
struct in6_addr *saddr,
|
||||
const struct ip_tunnel_key *key,
|
||||
__be16 sport, __be16 dport, u8 dsfield,
|
||||
|
||||
@@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(udp_tunnel6_xmit_skb);
|
||||
* @skb: Packet for which lookup is done
|
||||
* @dev: Tunnel device
|
||||
* @net: Network namespace of tunnel device
|
||||
* @sock: Socket which provides route info
|
||||
* @sk: Socket which provides route info
|
||||
* @oif: Index of the output interface
|
||||
* @saddr: Memory to store the src ip address
|
||||
* @key: Tunnel information
|
||||
@@ -135,7 +135,7 @@ EXPORT_SYMBOL_GPL(udp_tunnel6_xmit_skb);
|
||||
struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb,
|
||||
struct net_device *dev,
|
||||
struct net *net,
|
||||
struct socket *sock,
|
||||
struct sock *sk,
|
||||
int oif,
|
||||
struct in6_addr *saddr,
|
||||
const struct ip_tunnel_key *key,
|
||||
@@ -162,7 +162,7 @@ struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb,
|
||||
fl6.fl6_dport = dport;
|
||||
fl6.flowlabel = ip6_make_flowinfo(dsfield, key->label);
|
||||
|
||||
dst = ip6_dst_lookup_flow(net, sock->sk, &fl6, NULL);
|
||||
dst = ip6_dst_lookup_flow(net, sk, &fl6, NULL);
|
||||
if (IS_ERR(dst)) {
|
||||
netdev_dbg(dev, "no route to %pI6\n", &fl6.daddr);
|
||||
return ERR_PTR(-ENETUNREACH);
|
||||
|
||||
Reference in New Issue
Block a user