Bug 870271 - ifdown of an alias removes all ipv6 addresses of parent interface
ifdown of an alias removes all ipv6 addresses of parent interface
Status: CLOSED DUPLICATE of bug 842421
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: initscripts (Show other bugs)
6.3
All Linux
unspecified Severity high
: rc
: ---
Assigned To: David Kaspar [Dee'Kej]
qe-baseos-daemons
:
Depends On:
Blocks: 1356047
  Show dependency treegraph
 
Reported: 2012-10-25 22:17 EDT by Tom Lanyon
Modified: 2017-05-02 02:48 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Release Note
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-10-27 05:00:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch we're using to fix this issue (474 bytes, patch)
2012-10-25 22:17 EDT, Tom Lanyon
no flags Details | Diff

  None (edit)
Description Tom Lanyon 2012-10-25 22:17:27 EDT
Created attachment 633606 [details]
Patch we're using to fix this issue

Description of problem:
shutting down an (ipv4) interface alias (e.g. eth0:1) flushes/removes all ipv6 addresses on the parent interface (e.g. eth0).


Version-Release number of selected component (if applicable):
initscripts-9.03.31-2.el6.x86_64


How reproducible:
every time

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

2.  'ifdown' one of the aliases
$ ifdown eth0:3


Actual results:
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



Expected results:
The interface alias is shutdown, and the ipv6 addresses of the parent interface remain:

$ 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


Additional info:


/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
Comment 2 Lukáš Nykrýn 2012-10-29 08:57:20 EDT
With you patch (I assume it should be backwards) ifdown-ipv6 will still call some sysctl on parent device and I don't think that this is desired behavior.
Comment 4 Jarrod Makin 2015-12-31 06:45:51 EST
I have recently encountered a variation of this behaviour with the latest 9.03.49-2.3 initscript package.
Running ifdown on an alias interface is dropping all ipv4 addresses from the parent interface, which is extremely dangerous.
Comment 5 Lukáš Nykrýn 2016-01-04 06:46:21 EST
ipv4 is a separate new issue. So far only fixed in upstream. https://git.fedorahosted.org/cgit/initscripts.git/commit/?id=18d3aae0b1a9e58d5a970602d756a9ecf7cd1515
Comment 6 David Kaspar [Dee'Kej] 2016-10-27 05:00:32 EDT

*** This bug has been marked as a duplicate of bug 842421 ***

Note You need to log in before you can comment on or make changes to this bug.