public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Duan Jiong <djduanjiong@gmail•com>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org
Subject: [PATCH]ipv6:  fix the bug when we do not have a socket context
Date: Wed, 21 Nov 2012 19:12:28 +0800	[thread overview]
Message-ID: <50ACB71C.4080101@gmail.com> (raw)


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.

Signed-off-by: Duan Jiong <djduanjiong@gmail•com>
---
 net/ipv6/raw.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index d8e95c7..b10f478 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -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);
 }
-- 
1.7.1

             reply	other threads:[~2012-11-21 11:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 11:12 Duan Jiong [this message]
2012-11-21 14:40 ` [PATCH]ipv6: fix the bug when we do not have a socket context Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50ACB71C.4080101@gmail.com \
    --to=djduanjiong@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox