Thread (7 messages) 7 messages, 2 authors, 2021-12-02

Re: [patch RFC net-next v2 3/3] udp6: Use Segment Routing Header for dest address if present

flat view

From: David Ahern <hidden>
Date: 2021-12-02 16:40:37

On 12/1/21 1:25 PM, Andrew Lunn wrote:
quoted hunk ↗ jump to hunk
@@ -563,12 +564,18 @@ int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	const struct in6_addr *saddr = &hdr->saddr;
 	const struct in6_addr *daddr = &hdr->daddr;
 	struct udphdr *uh = (struct udphdr *)(skb->data+offset);
+	struct ipv6_sr_hdr *srh;
 	bool tunnel = false;
 	struct sock *sk;
 	int harderr;
 	int err;
 	struct net *net = dev_net(skb->dev);
 
+	if (opt->flags & IP6SKB_SEG6) {
+		srh = (struct ipv6_sr_hdr *)(skb->data + opt->srhoff);
+		daddr = &srh->segments[0];
+	}
+
 	sk = __udp6_lib_lookup(net, daddr, uh->dest, saddr, uh->source,
 			       inet6_iif(skb), inet6_sdif(skb), udptable, NULL);
 
similarly for this one, have a helper in seg6.h that returns in6_addr
pointer. It will be referencing within skb->data so should be fine.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help