Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp370401ybe; Wed, 4 Sep 2019 00:41:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6OCw6hsVnmPgZBqhXq5IKaezMLnz2cq2Ijt61FuI2v32om8BilehIn8va9C5W3MIx8xHZ X-Received: by 2002:a65:500a:: with SMTP id f10mr33944683pgo.105.1567582878011; Wed, 04 Sep 2019 00:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567582878; cv=none; d=google.com; s=arc-20160816; b=yRkc7OtAMUtfOb4TS4P1/Umf8Bh1BWTrYWq7rG7/tXBG82tPNlGZ4+5FC9q2HAh9Ii fb8xo7Y8yH6CtdRAP66zFjw8rCooPzc1QzzqwbKGPy8JhlhrBjRYTspR16it8TbCZfte iY3KRPEjbUZ4/SPq+UP08nWumeE9py/jRD1NJNKyZ8h+tzxo/JH9zmHVGpE0xwO421/O joVDN6uk27VxMNLlLRAR3Pwt4D9FSHESyrjkMJwczRC+J7HgioQJXR8qBpOdx1BtsNPJ +ClfFTuYLxh7Reb3ZdmvWMUVIGq+XL53R09mzrt8ClP6sXiKID5RZYpPzZRqkl6C2ja8 tsbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=/R0MFZr2e1zmrzOMRKVk+P9qqJJ3LIh5frjgWUWpdA8=; b=Q2hoIaI0ssGmkcb5R6U4wdceJieN4APjZfZmINJ4oSNVHO6r9Jd0WSdIZA90E0GGxU LQ/IbRkIXQNZrYU5QgEwAVfj6/apE76qbRY7XhRSrLyDawdAS9gI42JC8LsB95/I7QwD PtaLeKrNH6Ck99Ygt9VHpz2VdE619dFsNaGIzJ71pgvRnpPezz/FPpv5EEC4w1GOzTFX uxpb1yB32A4ywK/yHVaMI8Oym9rttUu01CBuSBO6bKTwk7exXeDl3XVN0knGdNo0zifp H7MZqEhZVSgUOyRUmdevt2aovby4nAajFXmTjTQ5RE+c1Jb6Eo8cQoGbTEZz7sn+B2Ax TO7w== 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 l35si17004703plb.322.2019.09.04.00.41.02; Wed, 04 Sep 2019 00:41:18 -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; 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 S1729026AbfIDHkO (ORCPT + 99 others); Wed, 4 Sep 2019 03:40:14 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:7988 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728209AbfIDHkO (ORCPT ); Wed, 4 Sep 2019 03:40:14 -0400 X-IronPort-AV: E=Sophos;i="5.64,465,1559491200"; d="scan'208";a="74815429" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Sep 2019 15:40:06 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 2AF7B4CE14E6; Wed, 4 Sep 2019 15:40:07 +0800 (CST) Received: from localhost.localdomain (10.167.226.33) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 4 Sep 2019 15:40:10 +0800 From: Su Yanjun To: , , CC: , , Subject: [PATCH net] ipv4: fix ifa_flags reuse problem in using ifconfig tool Date: Wed, 4 Sep 2019 15:37:47 +0800 Message-ID: <1567582667-56549-1-git-send-email-suyj.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.33] X-yoursite-MailScanner-ID: 2AF7B4CE14E6.A1108 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suyj.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When NetworkManager has already set ipv4 address then uses ifconfig set another ipv4 address. It will use previous ifa_flags that will cause device route not be inserted. As NetworkManager has already support IFA_F_NOPREFIXROUTE flag [1], but ifconfig will reuse the ifa_flags. It's weird especially some old scripts or program [2] still use ifconfig. [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/ commit/fec80e7473ad16979af75ed299d68103e7aa3fe9 [2] LTP or TAHI Signed-off-by: Su Yanjun --- net/ipv4/devinet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index a4b5bd4..56ca339 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1159,6 +1159,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr) inet_del_ifa(in_dev, ifap, 0); ifa->ifa_broadcast = 0; ifa->ifa_scope = 0; + ifa->ifa_flags = 0; } ifa->ifa_address = ifa->ifa_local = sin->sin_addr.s_addr; -- 2.7.4