Commit 148f9729 authored by Bjorn Mork's avatar Bjorn Mork Committed by David S. Miller
Browse files

[IPV4]: Reset scope when changing address

This bug did bite at least one user, who did have to resort to rebooting
the system after an "ifconfig eth0" typo.

Deleting the address and adding a new is a less intrusive workaround.
But I still beleive this is a bug that should be fixed.  Some way or

Another possibility would be to remove the scope mangling based on
address.  This will always be incomplete (are 127/8 the only address
space with host scope requirements?)

We set the scope to RT_SCOPE_HOST if an IPv4 interface is configured
with a loopback address (127/8).  The scope is never reset, and will
remain set to RT_SCOPE_HOST after changing the address. This patch
resets the scope if the address is changed again, to restore normal
Signed-off-by: default avatarBjorn Mork <>
Signed-off-by: default avatarDavid S. Miller <>
parent f1243c2d
......@@ -752,6 +752,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
inet_del_ifa(in_dev, ifap, 0);
ifa->ifa_broadcast = 0;
ifa->ifa_anycast = 0;
ifa->ifa_scope = 0;
ifa->ifa_address = ifa->ifa_local = sin->sin_addr.s_addr;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment