Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2361381ybi; Sun, 9 Jun 2019 09:52:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyv3tL8nwq1wkle/cctP8tCULb/iVpTeYzMa88F5Ner03LNsb5HpxoWl7AgXt5NpO9f6zgq X-Received: by 2002:a63:4509:: with SMTP id s9mr11935170pga.231.1560099124124; Sun, 09 Jun 2019 09:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560099124; cv=none; d=google.com; s=arc-20160816; b=0+YJCudQE2kuQBzqhcHmBWEakfC+eeuQ1YgbzW2W+M/XPqE5gDrttqwp59cn7glnkL P25ZmDVs2GkAhU66VXBNe6Vow68cWaWmHt0oEaoOJhQFvB4xaBJLEQus/hM1pnkqP2Zc HpeNtELxCDm7s1OfL1Bipf3KI3FLXpPSuiM3MjK6jgc/9mCyNeUyIlJmgwxsCGJ73vtJ cpLaIrNiyNopAB/sqb5YgYAxoFGsF6q9UGAg6zBZR+q4LDCbyCR9EgvCaIYbxSWk2ueM hAhySc98I8azkSPUCn5KEPhyAw0l/eXH/6ikCNiwU/l/cOZQxuoW8+pwxkfhiX5g3dMs 047Q== 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=D81b6h4BGXynq99bFlK0RjFxmAATZpd9EoelTjXHFog=; b=HTAUbQajWtmeYuMxm0ucwZ/w/pR7oipTwMZn7NvjLXflncRs6BJ+V+An1aDKh+5jc6 McZ/gpTqZdTyP2oPhemLZwXyVo0uWkcPtrMnwl4qasl/ttkcgMZIIfjyW9qr/t+XwiYD EmaMGKx2C+Qitrh33Bor68D7TRLGx/pq00JlMKDXjAl5PQgqhNB+d/Fdx2VMauATGPng rxs+3rrL8/xj3F49W/1wNYVjuP5jPLUwjGVjvGMBSje1AwHU6FjEvn6d0cZGmQp4ltUH EoOTiHjvbQ/iF8JhIw6jyP6W4VnfuDOfIky1rA4fjoYGBJ1AmF0TMRh/T6xpJ9EAFftt DXqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FQxFxDgY; 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 s97si7499584pjc.9.2019.06.09.09.51.48; Sun, 09 Jun 2019 09:52:04 -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=FQxFxDgY; 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 S1731658AbfFIQuJ (ORCPT + 99 others); Sun, 9 Jun 2019 12:50:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:49904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731623AbfFIQuI (ORCPT ); Sun, 9 Jun 2019 12:50:08 -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 2CBCD205ED; Sun, 9 Jun 2019 16:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099007; bh=k8CGv8f5XE7Kbg6pDU4ISW3mz33GDZH/BES2sdt2JlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FQxFxDgY5PMbulX+XgpW4mWNuDn/wpc9fUGxb6zXEDMqXq1aTEXi8FG3rtsWgnaPs pYVqr/PpQsl41ejvDAo6UQhJm8UzoU00BFplCgje2wcghUufmZLpKs+PhofdHgw/iW Id+N4gosh742+Owv92TSgSqjwH9CHDM7WwKFqxGY= 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.14 03/35] neighbor: Call __ipv4_neigh_lookup_noref in neigh_xmit Date: Sun, 9 Jun 2019 18:42:09 +0200 Message-Id: <20190609164125.756810906@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164125.377368385@linuxfoundation.org> References: <20190609164125.377368385@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 @@ -2528,7 +2529,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);