Received: by 10.223.176.5 with SMTP id f5csp3370086wra; Mon, 29 Jan 2018 12:15:39 -0800 (PST) X-Google-Smtp-Source: AH8x226vw2Z9/pcYVUFhD420d2F/je3mJKOt9iFZtAe8Ff7nnqpUSGi6HeKFyGMrieQTPEUcw+xg X-Received: by 10.98.202.84 with SMTP id n81mr27729797pfg.226.1517256939308; Mon, 29 Jan 2018 12:15:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517256939; cv=none; d=google.com; s=arc-20160816; b=yLJfEz43cPXJ3o53NGXwcFb65AeuLW0/ZkDaeK32z08z3eftlPbDxEi1J5t2qW3PU4 gWv9Nu662VZIHRTsgKYzr9hqYV8K+qG/Y3qJ+qeZAeQq7a6Pl7JNOS1at81thoUi1gax VB8z2rUYgfAI9j77QmZ+3nSD0RwUybVTPY8Dq0AeybVHCVtECMrIC1QVlZKtpuJVpX6A p0LTlZ+L0uE9EvM8DAq1QkzqSASTeSj9HuBi6v4fj2L0fZbEvQEzKetSXswjHl6JvANN yj/dIxT8Xl/NFZZePmmCQcp/dkSkus3ZM18+i0hDyZKksV22XYkkCmn3mFu6NbiojjpS AkzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6Dp/P8H+VDg1pyGoNDyEBXndo4Tx/gbpVLj4q1OOQ6E=; b=yPNG9Kzy9BF+gueLZwbRs9vAd0zVPKbrnT94MtAx9QTDVveK1sKRA0rYGK2ErA1D3L OUNRjExgzg3GqVvqBwpEmxXGxnlNxW4qhZhWFSKV86dIxjm6YweX3g6b1WZCvJimmBSH Xmmz4FhQI7hnqmH/RiKpBMBSf4+WLKz7sh8R2MjQrnnnKmIwlEfHZHZGAx2Kcus1t2nV fbV3dqChghn3fZk7gp8AQjrmaTzYvAK0Hhvj/iiujg0BkmWgDE7zvN32KM/LPhYNEmcx OTd1y78cWwAqh0/2Wqc9ssV/19+Xmd5aUWFN3zv6lWPGRQ/+fVbMJZvlVGYD6uEp1P/Y NbKQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h187si11443pgc.531.2018.01.29.12.15.24; Mon, 29 Jan 2018 12:15:39 -0800 (PST) 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; 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 S1754182AbeA2UN4 (ORCPT + 99 others); Mon, 29 Jan 2018 15:13:56 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39032 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753370AbeA2UNz (ORCPT ); Mon, 29 Jan 2018 15:13:55 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C1B122EB5; Mon, 29 Jan 2018 13:00:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Westfall , "David S. Miller" Subject: [PATCH 3.18 52/52] ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY Date: Mon, 29 Jan 2018 13:57:10 +0100 Message-Id: <20180129123630.439271490@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123628.168904217@linuxfoundation.org> References: <20180129123628.168904217@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jim Westfall [ Upstream commit cd9ff4de0107c65d69d02253bb25d6db93c3dbc1 ] Map all lookup neigh keys to INADDR_ANY for loopback/point-to-point devices to avoid making an entry for every remote ip the device needs to talk to. This used the be the old behavior but became broken in a263b3093641f (ipv4: Make neigh lookups directly in output packet path) and later removed in 0bb4087cbec0 (ipv4: Fix neigh lookup keying over loopback/point-to-point devices) because it was broken. Signed-off-by: Jim Westfall Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/arp.h | 3 +++ net/ipv4/arp.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) --- a/include/net/arp.h +++ b/include/net/arp.h @@ -37,6 +37,9 @@ static inline struct neighbour *__ipv4_n { struct neighbour *n; + if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) + key = INADDR_ANY; + rcu_read_lock_bh(); n = __ipv4_neigh_lookup_noref(dev, key); if (n && !atomic_inc_not_zero(&n->refcnt)) --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -221,11 +221,16 @@ static u32 arp_hash(const void *pkey, static int arp_constructor(struct neighbour *neigh) { - __be32 addr = *(__be32 *)neigh->primary_key; + __be32 addr; struct net_device *dev = neigh->dev; struct in_device *in_dev; struct neigh_parms *parms; + u32 inaddr_any = INADDR_ANY; + if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) + memcpy(neigh->primary_key, &inaddr_any, arp_tbl.key_len); + + addr = *(__be32 *)neigh->primary_key; rcu_read_lock(); in_dev = __in_dev_get_rcu(dev); if (in_dev == NULL) {