Skip to contentSkip to conversation

ipv6: fix the bug when we do not have a socket context

PATCH In review Duan Jiong 2 participants 2 messages Nov 21, 2012

Subsystems (2)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ipv6: fix the bug when we do not have a socket context

call the ip6_update_pmtu/ip6_redirect function to deal with ICMPV6 Error Messages and Redirect Message, when we do not have a socket context.

---
 net/ipv6/raw.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
net/ipv6/raw.c +15 -1
index d8e95c7..b10f478 100644
@@ -354,7 +354,9 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 	const struct in6_addr *saddr, *daddr;
 	struct net *net;
 
+
 	hash = nexthdr & (RAW_HTABLE_SIZE - 1);
+	net = dev_net(skb->dev);
 
 	read_lock(&raw_v6_hashinfo.lock);
 	sk = sk_head(&raw_v6_hashinfo.ht[hash]);
@@ -363,7 +365,6 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 		const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
 		saddr = &ip6h->saddr;
 		daddr = &ip6h->daddr;
-		net = dev_net(skb->dev);
 
 		while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr,
 						IP6CB(skb)->iif))) {
@@ -371,6 +372,19 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 					inner_offset, info);
 			sk = sk_next(sk);
 		}
+	} else {
+		switch (type) {
+			case ICMPV6_PKT_TOOBIG:
+				ip6_update_pmtu(skb, net, info, 0, 0);
+				break;
+			
+			case NDISC_REDIRECT:
+				ip6_redirect(skb, net, 0, 0);
+				break;
+
+			default:
+				break;
+		}		
 	}
 	read_unlock(&raw_v6_hashinfo.lock);
 }
Signature · 1 line
1.7.1
#1 lore raw
Quoted 6 lines · Duan Jiong

call the ip6_update_pmtu/ip6_redirect function to deal with ICMPV6 Error Messages and Redirect Message, when we do not have a socket context.

---

What is the exact problem you want to solve ?

What is the possible impact on the routing table size ?

Thanks