From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225NcnJKx/CqdYza6QikMiPArEgCdiVzjeRSd9yAZIcvEkHqKjdQLhXjUjDmUXpNMFm2FKV4 ARC-Seal: i=1; a=rsa-sha256; t=1517256383; cv=none; d=google.com; s=arc-20160816; b=NJwqbbXT7mt90F4wzrM2jQ02bPiuBoRukgiIYe2SsBf+BqNbC37dGSWNQMR95z1EqV e1ZXvR1GXE5lNeHuIsZuDPta4b9WGQU9ivrdI9ElS/UvA3rpH9+4rTiTN8pwU/bP+kyh bAhWDy6nW5MGyJhEjSHBzUvFs45uV6XohvlkIvQFRG7UJagAEQ1gtOvSd13Ay5+/g1jf S5Oc5r1KVNn871McjgZ3Yy5dY5EcThuSD2GygqaUYe/7MQ0DzL8lTp38+Q4xFUfHRmKh joM2oCYh3TOy9k5M8Wa9PNLxMOGL6OHzWcipUO2T2XPYc3+44jsbUTFz7biyvc8rjZ4y NmeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=GDOY0w2ayEGbwc//KJAoGBDg9DeE8UiBCMzjMM7AU6Y=; b=tc7/BaKHHNr2s3FMqDc9NEGe8U2n6gPPdJQAi465d/kAcZ1DCMZqSaKctKvireD59h eZJiaRWWytE4QM2X/xFAvazGa30xAlE57OBK/3M8U7lW7AzyZhG9V85FIV6R2kMiJjJF L4F2Hhns1HIxpG9W5q+SUeLfIaD1P4EZDnt7qyTuTTtSL1oeazl/bOpzOTCn42sMuKXg zWzpVKCbI4tFVmUlzTBgOf4LM7YhJnNdBh/bVd5hJEaYY/9udhqF40OpuL1SFlOJ/bY6 9pidqQ0ygp4nkC14IgjS9G6gyohyFGEe/NEhuqw6hf0PgVPEXKWCT+t0RjMSXN4F7u8m OETw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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 4.4 72/74] ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY Date: Mon, 29 Jan 2018 13:57:17 +0100 Message-Id: <20180129123850.784251431@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958544277885244?= X-GMAIL-MSGID: =?utf-8?q?1590958630082636642?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-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 @@ -19,6 +19,9 @@ static inline u32 arp_hashfn(const void static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key) { + if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) + key = INADDR_ANY; + return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev); } --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -223,11 +223,16 @@ static bool arp_key_eq(const struct neig 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) {