From: Duan Jiong <djduanjiong@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH]ipv6: Add an ICMP error handler icmpv6_err
Date: Tue, 23 Oct 2012 23:24:29 +0800 [thread overview]
Message-ID: <5086B6AD.8060306@gmail.com> (raw)
Add an ICMP error handler icmpv6_err 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/icmp.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 24d69db..d3cb61d 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -82,9 +82,12 @@ static inline struct sock *icmpv6_sk(struct net *net)
}
static int icmpv6_rcv(struct sk_buff *skb);
+static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+ u8 type, u8 code, int offset, __be32 info);
static const struct inet6_protocol icmpv6_protocol = {
.handler = icmpv6_rcv,
+ .err_handler = icmpv6_err,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
@@ -782,6 +785,26 @@ drop_no_count:
return 0;
}
+static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+ u8 type, u8 code, int offset, __be32 info)
+{
+ struct net *net = dev_net(skb->dev);
+ struct icmp6hdr *hdr = icmp6_hdr(skb);
+
+ switch (hdr->icmp6_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;
+ }
+}
+
void icmpv6_flow_init(struct sock *sk, struct flowi6 *fl6,
u8 type,
const struct in6_addr *saddr,
--
1.7.11.4
next reply other threads:[~2012-10-23 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 15:24 Duan Jiong [this message]
2012-10-24 5:01 ` [PATCH]ipv6: Add an ICMP error handler icmpv6_err Steffen Klassert
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=5086B6AD.8060306@gmail.com \
--to=djduanjiong@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).