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 <suyj.f...@cn.fujitsu.com> --- 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