lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080125025016.f6b08754.akpm@linux-foundation.org>
Date:	Fri, 25 Jan 2008 02:50:16 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	netdev@...r.kernel.org
Cc:	bugme-daemon@...zilla.kernel.org, bjorn@...k.no
Subject: Re: [Bugme-new] [Bug 9811] New: Loopback address to eth0 interface
 changes scope permanently

> On Fri, 25 Jan 2008 02:04:04 -0800 (PST) bugme-daemon@...zilla.kernel.org wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=9811
> 
>            Summary: Loopback address to eth0 interface changes scope
>                     permanently
>            Product: Networking
>            Version: 2.5
>      KernelVersion: 2.6.24-rc8
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: IPV4
>         AssignedTo: shemminger@...ux-foundation.org
>         ReportedBy: bjorn@...k.no
> 
> 
> Latest working kernel version: none
> Earliest failing kernel version: 2.6.18 (verified, but most likely "any")
> Distribution: Debian
> Hardware Environment: 
> Software Environment:
> Problem Description: 
> 
> >From gary.manchon@...il.com :
> 
> After a bad network interface configuration (ifconfig eth0 127.0.0.1),
> I cannot recover the network without rebooting the kernel.
> 
> This is my working configuration :
> 
> # ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:90:3E:1F:1C:17
>           inet addr:192.168.240.195  Bcast:192.168.247.255  Mask:255.255.248.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:26 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:2633 (2.5 KiB)  TX bytes:0 (0.0 B)
> 
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
> 
> # route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> 192.168.240.0   *               255.255.248.0   U     0      0        0 eth0
> default         192.168.240.1   0.0.0.0         UG    0      0        0 eth0
> 
> # ping -c 1 66.102.11.99
> PING 66.102.11.99 (66.102.11.99): 56 data bytes
> 64 bytes from 66.102.11.99: icmp_seq=0 ttl=63 time=4.5 ms
> 
> --- 66.102.11.99 ping statistics ---
> 1 packets transmitted, 1 packets received, 0% packet loss
> round-trip min/avg/max = 4.5/4.5/4.5 ms
> 
> Steps to reproduce:
> 
> # ifconfig eth0 127.0.0.1
> # ifconfig eth0 192.168.240.195 netmask 255.255.248.0
> # route add default gw 192.168.240.1
> 
> 
> >From Bjørn Mork <bjorn@...k.no> :
> 
> I suspect that the problem might be this code in net/ipv4/devinet.c ,
> which sets ifa_scope to RT_SCOPE_HOST if you configure a loopback
> address (127/8) on any interface.  I guess it's there to protect us from
> sending packets with a loopback source address, which woulnd't look too
> good:
> 
> static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
> {
>         struct in_device *in_dev = __in_dev_get_rtnl(dev);
> 
>         ASSERT_RTNL();
> 
>         if (!in_dev) {
>                 inet_free_ifa(ifa);
>                 return -ENOBUFS;
>         }
>         ipv4_devconf_setall(in_dev);
>         if (ifa->ifa_dev != in_dev) {
>                 BUG_TRAP(!ifa->ifa_dev);
>                 in_dev_hold(in_dev);
>                 ifa->ifa_dev = in_dev;
>         }
>         if (LOOPBACK(ifa->ifa_local))
>                 ifa->ifa_scope = RT_SCOPE_HOST;
>         return inet_insert_ifa(ifa);
> }
> 
> 
> 
> The real problem is that there's never anything resetting this scope if
> you change the address later.  The attached patch fixes this.
> 
> 
> dhcp232:~# ip addr show dev eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
>     link/ether 00:aa:00:ff:00:ff brd ff:ff:ff:ff:ff:ff
>     inet 192.168.3.232/24 brd 192.168.3.255 scope global eth0
>     inet6 2001:16d8:ffb4:0:2aa:ff:feff:ff/64 scope global dynamic 
>        valid_lft 2591971sec preferred_lft 604771sec
>     inet6 fe80::2aa:ff:feff:ff/64 scope link 
>        valid_lft forever preferred_lft forever
> dhcp232:~# ifconfig eth0 127.0.0.1
> dhcp232:~# ip addr show dev eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
>     link/ether 00:aa:00:ff:00:ff brd ff:ff:ff:ff:ff:ff
>     inet 127.0.0.1/8 brd 127.255.255.255 scope host eth0
>     inet6 2001:16d8:ffb4:0:2aa:ff:feff:ff/64 scope global dynamic 
>        valid_lft 2591951sec preferred_lft 604751sec
>     inet6 fe80::2aa:ff:feff:ff/64 scope link 
>        valid_lft forever preferred_lft forever
> dhcp232:~# ifconfig eth0 192.168.3.232
> dhcp232:~# ip addr show dev eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
>     link/ether 00:aa:00:ff:00:ff brd ff:ff:ff:ff:ff:ff
>     inet 192.168.3.232/24 brd 192.168.3.255 scope host eth0
>     inet6 2001:16d8:ffb4:0:2aa:ff:feff:ff/64 scope global dynamic 
>        valid_lft 2591933sec preferred_lft 604733sec
>     inet6 fe80::2aa:ff:feff:ff/64 scope link 
>        valid_lft forever preferred_lft forever
> 
> 
> 
> Notice how the scope changes from "global" to "host" when configuring
> 127.0.0.1, and just never changes back.  It will stay that way forever,
> or until something changes the scope or deletes the address.
> 
> Deleting the addresss and re-adding it will work around the problem:
> 
> dhcp232:~# ip addr del 192.168.3.232/24 dev eth0
> dhcp232:~# ifconfig eth0 192.168.3.232
> dhcp232:~# ip addr show dev eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
>     link/ether 00:aa:00:ff:00:ff brd ff:ff:ff:ff:ff:ff
>     inet 192.168.3.232/24 brd 192.168.3.255 scope global eth0
>     inet6 2001:16d8:ffb4:0:2aa:ff:feff:ff/64 scope global dynamic 
>        valid_lft 2591963sec preferred_lft 604763sec
>     inet6 fe80::2aa:ff:feff:ff/64 scope link 
>        valid_lft forever preferred_lft forever
> 
> 
> Bjørn
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ