Bug 1315018 - RHEL6: network initscript touches wrong or inexistent interfaces when tunnel interface is present
RHEL6: network initscript touches wrong or inexistent interfaces when tunnel ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: initscripts (Show other bugs)
6.8
All Linux
medium Severity medium
: rc
: ---
Assigned To: David Kaspar [Dee'Kej]
Jan Ščotka
Clayton Spicer
: EasyFix, FastFix, Patch
Depends On:
Blocks: 1356056 1398679
  Show dependency treegraph
 
Reported: 2016-03-05 13:32 EST by Rodrigo A B Freire
Modified: 2017-03-21 07:53 EDT (History)
3 users (show)

See Also:
Fixed In Version: initscripts-9.03.55-1
Doc Type: Release Note
Doc Text:
The "service network stop" command no longer attempts to stop services which are already stopped Previously, when a tunnel interface was present, the "service network stop" command incorrectly attempted to stop services which had been stopped already, displaying an error message. With this update, this bug is fixed, and the "service network stop" command now only stops running services.
Story Points: ---
Clone Of:
: 1398679 (view as bug list)
Environment:
Last Closed: 2017-03-21 07:53:03 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)
Script misbehaviour (11.77 KB, text/plain)
2016-03-05 13:39 EST, Rodrigo A B Freire
no flags Details
Script working correctly (8.48 KB, text/plain)
2016-03-05 13:39 EST, Rodrigo A B Freire
no flags Details
Patch: initscripts: Fixes interface enumeration on shutdown test (377 bytes, patch)
2016-03-05 13:41 EST, Rodrigo A B Freire
no flags Details | Diff
[PATCH] network: Fixes ifdown var leak, add tunnel treatment (3.11 KB, patch)
2016-03-07 10:47 EST, Rodrigo A B Freire
no flags Details | Diff
[PATCH] network: Fixes ifdown var leak, add tunnel treatment (3.15 KB, patch)
2016-03-07 11:36 EST, Rodrigo A B Freire
no flags Details | Diff

  None (edit)
Description Rodrigo A B Freire 2016-03-05 13:32:35 EST
Description of problem:
* A "# service network stop" tries to stop already stopped interfaces when a 'tunnel' interface is present.

Version-Release number of selected component (if applicable):
* initscripts-9.03.49-1.el6_7.4.x86_64

How reproducible:
* Always

Steps to Reproduce:
0. Test this reproducer in a system with several eth interfaces defined in /etc/sysconfig/network-scripts. Even if your system has just a single ethernet attached to it.
1. Start your network;
2. Start a tunnel interface (defined by /etc/sysconfig/network-scripts/ifcfg-tunnel(x)
3. Set a verbose bash -x output in your /etc/init.d/network
4. Stop the network

Actual results:
* The function check_device_down will use tunnel0 as a reference interface (which is up) and the network script will try to stop every interface in the system, regardless if it actually exists or is up.

Expected results:
* check_device_down should check the correct interface and down/skip accordingly.

Additional info:
See bad-output.txt line 177 - 188. It uses tunnel0 as reference to stop eth0.
Going further, see lines 224 - 237, trying to shutdown a non-existent interface.

Fixed script: See good-output.txt.
Comment 1 Rodrigo A B Freire 2016-03-05 13:39 EST
Created attachment 1133382 [details]
Script misbehaviour
Comment 2 Rodrigo A B Freire 2016-03-05 13:39 EST
Created attachment 1133383 [details]
Script working correctly
Comment 3 Rodrigo A B Freire 2016-03-05 13:41 EST
Created attachment 1133384 [details]
Patch: initscripts: Fixes interface enumeration on shutdown test
Comment 5 Lukáš Nykrýn 2016-03-07 02:41:39 EST
Thanks for those patches, I will review them as soon as possible.

(I keep post status for the bugs that are already committed in upstream git)
Comment 6 Rodrigo A B Freire 2016-03-07 10:47 EST
Created attachment 1133824 [details]
[PATCH] network: Fixes ifdown var leak, add tunnel treatment

Lukáš Nykrýn píše v Po 07. 03. 2016 v 12:35 +0100: 
> Hello,
> 
> I don't think this patch is correct. I can have for example vlan 
> eth0.10 and in configuration in file ifcfg-myvlan, with this patch 
> the device would not be pulled down.
>
> This is totally untested guess, but I think that correct fix would be:
> 
> diff --git a/rc.d/init.d/network b/rc.d/init.d/network
> index cbb9ddf..8cf851d 100755
> --- a/rc.d/init.d/network
> +++ b/rc.d/init.d/network
> @@ -204,6 +204,7 @@ case "$1" in
>         done
>         
>         for i in $xdslinterfaces $bridgeinterfaces $vlaninterfaces
> $remaining; do
> +               unset DEVICE
>                 (. ./ifcfg-$i
>                 if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi

You are right. Very well spotted, Lukas. I rewrote the patch containing your suggestion and it now works accordingly, even with the scenario that you described.

[root@rf network-scripts]# service network start
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/6
                                                           [  OK  ]
Bringing up interface myvlan:  Determining if ip address 192.168.2.1 is already in use for device eth0.1...
                                                           [  OK  ]
[root@rf network-scripts]# 
[root@rf network-scripts]# 
[root@rf network-scripts]# ifup tunnel0
[root@rf network-scripts]# 
[root@rf network-scripts]# 
[root@rf network-scripts]# service network stop
Shutting down interface tunnel0:                           [  OK  ]
Shutting down interface myvlan:                            [  OK  ]
Shutting down interface eth0:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Comment 7 Rodrigo A B Freire 2016-03-07 11:36 EST
Created attachment 1133835 [details]
[PATCH] network: Fixes ifdown var leak, add tunnel treatment

Renamed %s/tunnelinterface/vpninterface/g.
Comment 8 Lukáš Nykrýn 2016-03-08 09:55:51 EST
Devel_Ack for mentioned patch for 6.9.
Comment 9 David Kaspar [Dee'Kej] 2016-10-28 07:59:52 EDT
The changes proposed by Rodrigo Freire have been commited ~8 months ago:
https://github.com/fedora-sysv/initscripts/commit/82c97b4ac121269ecb829
Comment 17 errata-xmlrpc 2017-03-21 07:53:03 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0786.html

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