Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2403803ybi; Sun, 9 Jun 2019 10:54:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqy64dGyATDIEiDQSk9O5SiyS/PEHhtkM2Fvnok25X7lYGeKSGtVGyjTLRtSJXcWrtGAFKc/ X-Received: by 2002:a17:902:124:: with SMTP id 33mr5340448plb.145.1560102885797; Sun, 09 Jun 2019 10:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560102885; cv=none; d=google.com; s=arc-20160816; b=uatRpTCFFr/YBLRY3A96mk5THYML5shO320uxLBosD/Fyb0AnSHAna2chKr2LBA/Be zMSgELdUTiribCxic5WfByFLuSUXlMEiKxsqtpQGGR2SlU/kTZlLD0VY6HktxgnheetM hrcg3Eo53GspH0ic0+9LPaZOSgFmbYQ0BEoWeRO677NbqNJe/6Y2CvX0zS0805cRTfk5 YItgDK/hKaSJmHgBUl5GAbWRMbK3m+dyOFaCYM8PhZGHuHql1ltYh3yb7LiDu9czzPyA dUgTyF1AbeI+IgTT0CIcYpKQ63zZ0SDOTYK33Vvz5w351CATPYxG97DTWYK8fto0mUVG OoEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ly2vgSB3e7wHthNulOdXVdK7vtSWoNUDNlQckw/mDP0=; b=zq2o3QyALY58JrZhQiXNQm+0rJds5IecbixIUzaZUi8q2HYiGaxUSDIj4sFOFFdklz z+FlB9E9pyjQE9+1nCFbzmzG2ljqlY+QwFMu4tUe+SL2Qvve4v4c0XGa4r1GxHlKpoSS 9GbtKU1AWttEL9OmSnrBF0gh3qw/vXSS8820AOhkNcY+gVs3JxWXsF7RsSj+3qlBHceF aCJPJI9EfT62F8mY6W3fC5poeh8ZWTr8YdaPA/LSsAFV/6yny3YKrItUJX7B5O/TUR1K B7gX7XyRbQtj3btwrXW4TCjL0YUcmbIf5ThLUXT1QVuqkV9PbuUQTbfSv6X365YyGNxh Opdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rCEl0VVR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si7516201pgb.104.2019.06.09.10.54.29; Sun, 09 Jun 2019 10:54:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rCEl0VVR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731217AbfFIQsc (ORCPT + 99 others); Sun, 9 Jun 2019 12:48:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:47592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731207AbfFIQs3 (ORCPT ); Sun, 9 Jun 2019 12:48:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7509E20868; Sun, 9 Jun 2019 16:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560098909; bh=h4DRqV1hZBCbesC0KVb+8vcMks8nL2rorqRaFUE/zSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCEl0VVRVBOJmgq79zpjkoz9l8/GVQJG/TK19D1YNmGsClNXftxdmhvAQbwhIQ09U kaNZuH1R0zqwcGebmhvS6P89YfCugHGs+hS4g7VP9PZSl2iM94HujOXqqbPxkfK/lD eh8cIPltuKLaXI/IMwuwgrkZ/gjszwFF4MVpvh4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Maguire , David Ahern , "David S. Miller" Subject: [PATCH 4.19 05/51] neighbor: Call __ipv4_neigh_lookup_noref in neigh_xmit Date: Sun, 9 Jun 2019 18:41:46 +0200 Message-Id: <20190609164127.431979915@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.123076536@linuxfoundation.org> References: <20190609164127.123076536@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Ahern [ Upstream commit 4b2a2bfeb3f056461a90bd621e8bd7d03fa47f60 ] Commit cd9ff4de0107 changed the key for IFF_POINTOPOINT devices to INADDR_ANY but neigh_xmit which is used for MPLS encapsulations was not updated to use the altered key. The result is that every packet Tx does a lookup on the gateway address which does not find an entry, a new one is created only to find the existing one in the table right before the insert since arp_constructor was updated to reset the primary key. This is seen in the allocs and destroys counters: ip -s -4 ntable show | head -10 | grep alloc which increase for each packet showing the unnecessary overhread. Fix by having neigh_xmit use __ipv4_neigh_lookup_noref for NEIGH_ARP_TABLE. Fixes: cd9ff4de0107 ("ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY") Reported-by: Alan Maguire Signed-off-by: David Ahern Tested-by: Alan Maguire Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/neighbour.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -2536,7 +2537,13 @@ int neigh_xmit(int index, struct net_dev if (!tbl) goto out; rcu_read_lock_bh(); - neigh = __neigh_lookup_noref(tbl, addr, dev); + if (index == NEIGH_ARP_TABLE) { + u32 key = *((u32 *)addr); + + neigh = __ipv4_neigh_lookup_noref(dev, key); + } else { + neigh = __neigh_lookup_noref(tbl, addr, dev); + } if (!neigh) neigh = __neigh_create(tbl, addr, dev, false); err = PTR_ERR(neigh);