From patchwork Mon Oct 28 10:30:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 286470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 0CB4E2C00AB for ; Mon, 28 Oct 2013 21:31:59 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vak6z-0006cE-J9; Mon, 28 Oct 2013 10:31:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vak5Q-0005ni-SO for kernel-team@lists.ubuntu.com; Mon, 28 Oct 2013 10:30:16 +0000 Received: from bl20-138-76.dsl.telepac.pt ([2.81.138.76] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Vak5Q-0001vv-Ew; Mon, 28 Oct 2013 10:30:16 +0000 From: Luis Henriques To: Marcelo Ricardo Leitner Subject: [3.5.y.z extended stable] Patch "ipv6: restrict neighbor entry creation to output flow" has been added to staging queue Date: Mon, 28 Oct 2013 10:30:15 +0000 Message-Id: <1382956215-14240-1-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.8.3.2 X-Extended-Stable: 3.5 Cc: Debabrata Banerjee , kernel-team@lists.ubuntu.com, Jiri Pirko , Hannes Frederic Sowa X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com This is a note to let you know that I have just added a patch titled ipv6: restrict neighbor entry creation to output flow to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Luis ------ From c76a934ed245a997d83a5a96deaff9b8172f726e Mon Sep 17 00:00:00 2001 From: Marcelo Ricardo Leitner Date: Tue, 8 Oct 2013 16:41:13 +0200 Subject: [PATCH] ipv6: restrict neighbor entry creation to output flow This patch is based on 3.2.y branch, the one used by reporter. Please let me know if it should be different. Thanks. The patch which introduced the regression was applied on stables: 3.0.64 3.4.31 3.7.8 3.2.39 The patch which introduced the regression was for stable trees only. ---8<--- Commit 0d6a77079c475033cb622c07c5a880b392ef664e "ipv6: do not create neighbor entries for local delivery" introduced a regression on which routes to local delivery would not work anymore. Like this: $ ip -6 route add local 2001::/64 dev lo $ ping6 -c1 2001::9 PING 2001::9(2001::9) 56 data bytes ping: sendmsg: Invalid argument As this is a local delivery, that commit would not allow the creation of a neighbor entry and thus the packet cannot be sent. But as TPROXY scenario actually needs to avoid the neighbor entry creation only for input flow, this patch now limits previous patch to input flow, keeping output as before that patch. Reported-by: Debabrata Banerjee Signed-off-by: Marcelo Ricardo Leitner Signed-off-by: Jiri Pirko Acked-by: Hannes Frederic Sowa CC: Hannes Frederic Sowa Signed-off-by: Luis Henriques --- net/ipv6/route.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 1.8.3.2 diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8253206..9659bd9 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -818,7 +818,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, } static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif, - struct flowi6 *fl6, int flags) + struct flowi6 *fl6, int flags, bool input) { struct fib6_node *fn; struct rt6_info *rt, *nrt; @@ -826,8 +826,11 @@ static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int attempts = 3; int err; int reachable = net->ipv6.devconf_all->forwarding ? 0 : RT6_LOOKUP_F_REACHABLE; + int local = RTF_NONEXTHOP; strict |= flags & RT6_LOOKUP_F_IFACE; + if (input) + local |= RTF_LOCAL; relookup: read_lock_bh(&table->tb6_lock); @@ -847,7 +850,7 @@ restart: read_unlock_bh(&table->tb6_lock); if (!dst_get_neighbour_noref_raw(&rt->dst) && - !(rt->rt6i_flags & (RTF_NONEXTHOP | RTF_LOCAL))) + !(rt->rt6i_flags & local)) nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr); else if (!(rt->dst.flags & DST_HOST)) nrt = rt6_alloc_clone(rt, &fl6->daddr); @@ -891,7 +894,7 @@ out2: static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table, struct flowi6 *fl6, int flags) { - return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); + return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags, true); } static struct dst_entry *ip6_route_input_lookup(struct net *net, @@ -924,7 +927,7 @@ void ip6_route_input(struct sk_buff *skb) static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, struct flowi6 *fl6, int flags) { - return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags); + return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags, false); } struct dst_entry * ip6_route_output(struct net *net, const struct sock *sk,