diff options
author | Andrew Lunn <andrew@lunn.ch> | 2022-01-03 20:11:32 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-27 13:05:05 +0300 |
commit | 591a1e2ef0f11cb37fb8ebb6479885229425e784 (patch) | |
tree | 03f35490a4c9720765c5f72cb72c1a22ce9d05c2 /net | |
parent | af58dbc08ea3e736a47394da75d9c849a18e606c (diff) | |
download | linux-591a1e2ef0f11cb37fb8ebb6479885229425e784.tar.xz |
udp6: Use Segment Routing Header for dest address if present
[ Upstream commit 222a011efc839ca1f51bf89fe7a2b3705fa55ccd ]
When finding the socket to report an error on, if the invoking packet
is using Segment Routing, the IPv6 destination address is that of an
intermediate router, not the end destination. Extract the ultimate
destination address from the segment address.
This change allows traceroute to function in the presence of Segment
Routing.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/udp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 8cd8c0bce098..932c6f2a5494 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -40,6 +40,7 @@ #include <net/transp_v6.h> #include <net/ip6_route.h> #include <net/raw.h> +#include <net/seg6.h> #include <net/tcp_states.h> #include <net/ip6_checksum.h> #include <net/ip6_tunnel.h> @@ -561,7 +562,7 @@ int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, struct ipv6_pinfo *np; const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; const struct in6_addr *saddr = &hdr->saddr; - const struct in6_addr *daddr = &hdr->daddr; + const struct in6_addr *daddr = seg6_get_daddr(skb, opt) ? : &hdr->daddr; struct udphdr *uh = (struct udphdr *)(skb->data+offset); bool tunnel = false; struct sock *sk; |