From patchwork Thu Jan 17 08:09:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Klassert X-Patchwork-Id: 213159 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5B83F2C007C for ; Thu, 17 Jan 2013 19:09:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759272Ab3AQIJx (ORCPT ); Thu, 17 Jan 2013 03:09:53 -0500 Received: from a.mx.secunet.com ([195.81.216.161]:54751 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759234Ab3AQIJw (ORCPT ); Thu, 17 Jan 2013 03:09:52 -0500 Received: from localhost (alg1 [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 76F731A007A; Thu, 17 Jan 2013 09:09:51 +0100 (CET) X-Virus-Scanned: by secunet Received: from mail-srv1.secumail.de (unknown [10.53.40.200]) by a.mx.secunet.com (Postfix) with ESMTP id 600721A0079; Thu, 17 Jan 2013 09:09:50 +0100 (CET) Received: from gauss.dd.secunet.de ([10.182.7.102]) by mail-srv1.secumail.de with Microsoft SMTPSVC(6.0.3790.4675); Thu, 17 Jan 2013 09:09:50 +0100 Received: by gauss.dd.secunet.de (Postfix, from userid 1000) id EF04C5C069E; Thu, 17 Jan 2013 09:09:49 +0100 (CET) Date: Thu, 17 Jan 2013 09:09:49 +0100 From: Steffen Klassert To: David Miller Cc: Duan Jiong , netdev@vger.kernel.org Subject: [PATCH] ipv6: Add an error handler for icmp6 Message-ID: <20130117080949.GA24987@secunet.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginalArrivalTime: 17 Jan 2013 08:09:50.0284 (UTC) FILETIME=[05C170C0:01CDF48A] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org pmtu and redirect events are now handled in the protocols error handler, so add an error handler for icmp6 to do this. It is needed in the case when we have no socket context. Based on a patch by Duan Jiong. Reported-by: Duan Jiong Signed-off-by: Steffen Klassert --- net/ipv6/icmp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index b4a9fd5..fff5bdd 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -81,10 +81,22 @@ static inline struct sock *icmpv6_sk(struct net *net) return net->ipv6.icmp_sk[smp_processor_id()]; } +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); + + if (type == ICMPV6_PKT_TOOBIG) + ip6_update_pmtu(skb, net, info, 0, 0); + else if (type == NDISC_REDIRECT) + ip6_redirect(skb, net, 0, 0); +} + static int icmpv6_rcv(struct sk_buff *skb); static const struct inet6_protocol icmpv6_protocol = { .handler = icmpv6_rcv, + .err_handler = icmpv6_err, .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, };