From patchwork Thu Mar 17 16:11:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Bohac X-Patchwork-Id: 87393 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 7FC1BB6FD2 for ; Fri, 18 Mar 2011 03:11:38 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754667Ab1CQQLe (ORCPT ); Thu, 17 Mar 2011 12:11:34 -0400 Received: from cantor.suse.de ([195.135.220.2]:35490 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754455Ab1CQQLd (ORCPT ); Thu, 17 Mar 2011 12:11:33 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 4045893EE3; Thu, 17 Mar 2011 17:11:31 +0100 (CET) Date: Thu, 17 Mar 2011 17:11:29 +0100 From: Jiri Bohac To: Julian Anastasov Cc: Alex Sidorenko , David Miller , "netdev@vger.kernel.org" Subject: Re: Stale entries in RT_TABLE_LOCAL Message-ID: <20110317161129.GA6384@midget.suse.cz> References: <201102231243.23579.alexandre.sidorenko@hp.com> <201103101441.57105.alexandre.sidorenko@hp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, On Tue, Mar 15, 2011 at 10:47:20AM +0200, Julian Anastasov wrote: > On Thu, 10 Mar 2011, Alex Sidorenko wrote: > > >>IP1: 192.168.140.31/22, primary > >>IP2: 192.168.142.109/23, primary > >>IP3: 192.168.142.109/22, secondary for primary IP1 > >> > >> It is the route for IP3 that is leaked, with prefsrc=IP1. > >>We create local route for secondary IPs with prefsrc=ItsPrimaryIP. > >>Both local routes for 109 differ in prefsrc (fa_info) Is there any reason to set the prefsrc of a local route to the primary IP address of the subnet? I tried the following patch: The result with the teststcase mentioned previously is that only one local route is created per IP address. The local routes are correctly deleted after both identical IP addresses are removed from the interface. Furthemore, the testcase uncovers another weirdness with the prefsrc of the local routes. When a primary IP address is deleted and a secondary IP address is promoted to primary, its prefsrc is not updated. What is the prefrc of a local route good for? diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 1d2cdd4..2046b21 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -751,7 +751,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) } } - fib_magic(RTM_NEWROUTE, RTN_LOCAL, addr, 32, prim); + fib_magic(RTM_NEWROUTE, RTN_LOCAL, addr, 32, ifa); if (!(dev->flags & IFF_UP)) return;