Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26579C433F5 for ; Tue, 16 Nov 2021 02:23:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1177561B68 for ; Tue, 16 Nov 2021 02:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348211AbhKPC0S (ORCPT ); Mon, 15 Nov 2021 21:26:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:53144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236664AbhKORYf (ORCPT ); Mon, 15 Nov 2021 12:24:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC76563245; Mon, 15 Nov 2021 17:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636996520; bh=xVNybSjRMjabkMP7ytBXCizcFjmPeyolraqCAv9ppN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UusjWqbm/5av1IopAdT8uTSLKNvK5Q9hcWLE9blcGYOLi+Ks+de4dt/AxlWi1EQbS u8GW17OoRPLDPmmGL0mfFWsTG6PNun1rWS3ct1uH63BmS/VD0MT4war2pIo48ZD/oy Oh25DhslfXI81nLM2oV1G7DfQv8+q9MiZKYh5lto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Suryaputra , Antonio Quartulli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 168/355] gre/sit: Dont generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE Date: Mon, 15 Nov 2021 18:01:32 +0100 Message-Id: <20211115165319.225193521@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115165313.549179499@linuxfoundation.org> References: <20211115165313.549179499@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Suryaputra [ Upstream commit 61e18ce7348bfefb5688a8bcd4b4d6b37c0f9b2a ] When addr_gen_mode is set to IN6_ADDR_GEN_MODE_NONE, the link-local addr should not be generated. But it isn't the case for GRE (as well as GRE6) and SIT tunnels. Make it so that tunnels consider the addr_gen_mode, especially for IN6_ADDR_GEN_MODE_NONE. Do this in add_v4_addrs() to cover both GRE and SIT only if the addr scope is link. Signed-off-by: Stephen Suryaputra Acked-by: Antonio Quartulli Link: https://lore.kernel.org/r/20211020200618.467342-1-ssuryaextr@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/addrconf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 366c3792b8604..d1f29a3eb70be 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3111,6 +3111,9 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4); if (idev->dev->flags&IFF_POINTOPOINT) { + if (idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_NONE) + return; + addr.s6_addr32[0] = htonl(0xfe800000); scope = IFA_LINK; plen = 64; -- 2.33.0