Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753009AbbETI4i (ORCPT ); Wed, 20 May 2015 04:56:38 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:37947 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157AbbETI4e (ORCPT ); Wed, 20 May 2015 04:56:34 -0400 Message-ID: <555C4C3F.8030003@6wind.com> Date: Wed, 20 May 2015 10:56:31 +0200 From: Nicolas Dichtel Reply-To: nicolas.dichtel@6wind.com Organization: 6WIND User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Michal Kubecek , "David S. Miller" CC: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , roopa Subject: Re: [PATCH net v3 2/2] ipv6: fix ECMP route replacement References: <239760fdec3e503029fae3e5bb9d4eb3c4c33c20.1431974706.git.mkubecek@suse.cz> In-Reply-To: <239760fdec3e503029fae3e5bb9d4eb3c4c33c20.1431974706.git.mkubecek@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1524 Lines: 33 Le 18/05/2015 20:54, Michal Kubecek a écrit : > When replacing an IPv6 multipath route with "ip route replace", i.e. > NLM_F_CREATE | NLM_F_REPLACE, fib6_add_rt2node() replaces only first > matching route without fixing its siblings, resulting in corrupted > siblings linked list; removing one of the siblings can then end in an > infinite loop. > > IPv6 ECMP implementation is a bit different from IPv4 so that route > replacement cannot work in exactly the same way. This should be a > reasonable approximation: > > 1. If the new route is ECMP-able and there is a matching ECMP-able one > already, replace it and all its siblings (if any). > > 2. If the new route is ECMP-able and no matching ECMP-able route exists, > replace first matching non-ECMP-able (if any) or just add the new one. > > 3. If the new route is not ECMP-able, replace first matching > non-ECMP-able route (if any) or add the new route. > > We also need to remove the NLM_F_REPLACE flag after replacing old > route(s) by first nexthop of an ECMP route so that each subsequent > nexthop does not replace previous one. > > Fixes: 51ebd3181572 ("ipv6: add support of equal cost multipath (ECMP)") > Signed-off-by: Michal Kubecek LGTM. Acked-by: Nicolas Dichtel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/