Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHBZ] ifdown on alias removes all IPv6 addresses of parent interface #17

Open
deekej opened this issue Oct 27, 2016 · 2 comments
Open
Assignees

Comments

@deekej
Copy link
Contributor

deekej commented Oct 27, 2016

Shutting down an (ipv4) interface alias (e.g. eth0:1) flushes/removes all ipv6 addresses on the parent interface (e.g. eth0). [RHBZ #870271 | RHBZ #842421]

Steps to Reproduce:

  1. configure some interface aliases - parent eth0 has ipv6 connectivity (ipv6 autoconfig):
$ ifconfig | egrep 'Link|inet'
eth0       Link encap:Ethernet  HWaddr 52:54:00:37:1D:02
          inet addr:192.0.2.1  Bcast:192.0.2.255  Mask:255.255.255.0
          inet6 addr: 2001:db8::5054:ff:fe37:1d02/64 Scope:Global
          inet6 addr: fe80::5054:ff:fe37:1d02/64 Scope:Link
eth0:2    Link encap:Ethernet  HWaddr 52:54:00:37:1D:02
          inet addr:192.0.2.2  Bcast:192.0.2.255  Mask:255.255.255.0
eth0:3    Link encap:Ethernet  HWaddr 52:54:00:37:1D:02  
          inet addr:192.0.2.3  Bcast:192.0.2.255  Mask:255.255.255.0

The interface alias is shutdown, however all ipv6 addresses of the parent interface are also removed:

$ ifconfig | egrep 'Link|inet'
eth0      Link encap:Ethernet  HWaddr 52:54:00:37:1D:02  
          inet addr:192.0.2.1  Bcast:192.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe37:1d02/64 Scope:Link
eth0:2    Link encap:Ethernet  HWaddr 52:54:00:37:1D:02  
          inet addr:192.0.2.2  Bcast:192.0.2.255  Mask:255.255.255.0

/sbin/ifdown calls ifdown-eth which correctly shuts down the alias address and then calls ifdown-ipv6 on the alias device.

ifdown-ipv6 munges the alias device name from "eth0:X" to the realdevice name of "eth0" and then issues an "ipv6_cleanup_device eth0" which erroneously removes all addresses on the parent device.

We have fixed this by modifying ifdown-ipv6 to only attempt to shutdown the alias, which will be a silent noop because the 'eth0:X' alias interface has no ipv6 addresses:

% diff -ur ifdown-ipv6.*
--- ifdown-ipv6.a   2012-10-26 12:22:52.000000000 +1030
+++ ifdown-ipv6.b   2012-10-26 12:22:59.000000000 +1030
@@ -46,6 +46,7 @@
 source_config

 REALDEVICE=${DEVICE%%:*}
+DEVICE=$REALDEVICE

 [ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
 . /etc/sysconfig/network-scripts/network-functions-ipv6
@@ -131,4 +132,4 @@
 fi

 # Delete all current configured IPv6 addresses on this interface
-ipv6_cleanup_device $REALDEVICE
+ipv6_cleanup_device $DEVICE

NOTE: Similar behaviour for IPv4 has been fixed by this commit.

@deekej deekej added the bug label Oct 27, 2016
@deekej
Copy link
Contributor Author

deekej commented Oct 27, 2016

According to @lnykryn:
"ifdown-ipv6 will still call some sysctl on parent device and I don't think that this is desired behavior."

@deekej deekej assigned pavlix and unassigned pavlix Oct 27, 2016
@deekej
Copy link
Contributor Author

deekej commented Oct 27, 2016

Additional steps to reproduce this:


No IPv6 IPs established:

sl112-0-0-1:/root-$ ip -6 addr show dev eth2.10
6: eth2.10@eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
inet6 fe80::20c:29ff:fec4:aa4a/64 scope link
valid_lft forever preferred_lft forever

Bring up first IP (config named test6):

sl112-0-0-1:/root-$ ifup test6; ip -6 addr show dev eth2.10
RTNETLINK answers: File exists
6: eth2.10@eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
inet6 1000:1000::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fec4:aa4a/64 scope link
valid_lft forever preferred_lft forever

Bring up second IP (config named test6A):

sl112-0-0-1:/root-$ ifup test6A; ip -6 addr show dev eth2.10
RTNETLINK answers: File exists
6: eth2.10@eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
inet6 1000:1000::7/64 scope global tentative
valid_lft forever preferred_lft forever
inet6 1000:1000::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fec4:aa4a/64 scope link
valid_lft forever preferred_lft forever

Bring down second IP (config named test6A):

sl112-0-0-1:/root-$ ifdown test6A; ip -6 addr show dev eth2.10
RTNETLINK answers: Cannot assign requested address
6: eth2.10@eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
inet6 fe80::20c:29ff:fec4:aa4a/64 scope link
valid_lft forever preferred_lft forever

Result: first IP also torn down - 1000:1000::1/64 is no longer on interface.

@deekej deekej added this to the initscripts-10.0 milestone Mar 22, 2017
@deekej deekej self-assigned this Mar 22, 2017
@deekej deekej added the Fedora label Mar 22, 2017
@deekej deekej removed this from the initscripts-10.0 milestone Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants