Bug 23282

Summary: libdrakx-net and the graphical tool that edits network interfaces in mga5
Product: Mageia Reporter: Paul Bichis <servere>
Component: RPM PackagesAssignee: Olav Vitters <olav>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Normal CC: mageia, mariusavram83, marja11, olav, shlomif
Version: CauldronKeywords: PATCH
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: MGA6TOO, MGA5TOO
Source RPM: drakx-net-2.24.2-1.mga5.src.rpm, initscripts CVE:
Status comment: initscripts should handle both 1/yes/0/no cases
Attachments: nozeroconf - patch
spec file diff
Patch rebased against git master

Description Paul Bichis 2018-07-04 16:10:44 CEST
Description of problem:

    There is a small issue with libdrakx-net and the graphical tool that edits network interfaces in mga5.
    It overwrites any custom settings written in /etc/sysconfig/network file.

    I know mga5 is not on support anymore, but I hope this scenario won't repeat in the future for mga6/mga7 and so on.


    On all of our servers we added line NOZEROCONF=yes to /etc/sysconfig/network, in order to get rid of martians (both logs in journalctl and routes from ip route).
    If someone edits the network with the GUI, this setting is lost.

    I've attached a patch that adds a check box to the graphical interface for 'NOZEROCONF'

    I've also have the .src.rpm but is for mga5. - If you think it helps I can attach it in other email.

    Thank you! 

Version-Release number of selected component (if applicable):
drakx-net-2.24.2-1.mga5.src.rpm

How reproducible:


Steps to Reproduce:
1. Add NOZEROCONF=yes to /etc/sysconfig/network, save
2. Edit network interface with the graphical tool, save
3. Check /etc/sysconfig/network file again.







[afk@mageia5][~/Proiecte/libdrakx]$ cat drakx-net-2.24-nozeroconf.patch
--- drakx-net-2.24.2/lib/network/network.pm.orig        2016-06-27 12:43:23.000000000 +0300
+++ drakx-net-2.24.2/lib/network/network.pm     2018-06-19 11:29:12.300656198 +0300
@@ -109,7 +109,7 @@ sub write_network_conf {
     }
     $net->{network}{NETWORKING} = 'yes';
 
-    setVarsInSh($::prefix . $network_file, $net->{network}, qw(HOSTNAME NETWORKING GATEWAY GATEWAYDEV NISDOMAIN FORWARD_IPV4 NETWORKING_IPV6 IPV6_DEFAULTDEV CRDA_DOMAIN));
+    setVarsInSh($::prefix . $network_file, $net->{network}, qw(HOSTNAME NETWORKING GATEWAY GATEWAYDEV NISDOMAIN FORWARD_IPV4 NETWORKING_IPV6 IPV6_DEFAULTDEV NOZEROCONF CRDA_DOMAIN));
     output($::prefix . $hostname_file, ($net->{network}{HOSTNAME} || "localhost") . "\n");
 }
 
@@ -530,6 +530,7 @@ sub advanced_choose {
          { text => N("Disable IPv6"), val => \$u->{ipv6_disabled}, type => "bool" },
          { text => N("Disable TCP Window Scaling"), val => \$u->{disable_window_scaling}, type => "bool" },
          { text => N("Disable TCP Timestamps"), val => \$u->{disable_tcp_timestamps}, type => "bool" },
+         { text => N("Disable ZEROCONF Route"), val => \$net->{network}{NOZEROCONF}, type => "bool" },
          { label => "<b>" . N("Security settings (defined by MSEC policy)") . "</b>" },
          { text => N("Disable ICMP echo"), val => \$u->{disable_icmp}, type => "bool", disabled => sub { $u->{msec} } },
          { text => N("Disable ICMP echo for broadcasting messages"), val => \$u->{disable_icmp_broadcasts}, type => "bool", disabled => sub { $u->{msec} } },
[afk@mageia5][~/Proiecte/libdrakx]$ cat drakx-net-2.24-nozeroconf.spec.patch
--- drakx-net.spec.orig 2016-06-27 12:42:06.000000000 +0300
+++ drakx-net.spec      2018-06-19 11:42:14.262294269 +0300
@@ -10,8 +10,9 @@
 Summary: %_vendor network tools
 Name: drakx-net
 Version: 2.24.2
-Release: %mkrel 1
+Release: %mkrel 2
 Source0: %{name}-%{version}.tar.xz
+Patch0: drakx-net-2.24-nozeroconf.patch
 License: GPL
 Group: System/Networking
 Url: http://www.mageia.org/
@@ -81,6 +82,7 @@ This package contains the %_vendor netwo
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %make
@@ -164,6 +166,9 @@ exit 0
 
 
 %changelog
+* Tue Jun 19 2018 Paul Bichis <paulb@ss7ware.com>
+- Patch to set/preserve NOZEROCONF routes
+
 * Mon Jun 27 2016 tv <tv> 2.24.2-1.mga5
 + Revision: 1037731
 - drakconnect:
[afk@mageia5][~/Proiecte/libdrakx]$
Comment 1 Shlomi Fish 2018-07-04 16:15:18 CEST
Please add the patch as an attachment.

CC: (none) => shlomif

Comment 2 Shlomi Fish 2018-07-04 16:18:54 CEST
also see https://wiki.mageia.org/en/Mgarepo .
Comment 3 Marja Van Waes 2018-07-05 15:57:15 CEST
(In reply to Paul Bichis from comment #0)
> Description of problem:
> 
>     There is a small issue with libdrakx-net and the graphical tool that
> edits network interfaces in mga5.
>     It overwrites any custom settings written in /etc/sysconfig/network file.
> 
>     I know mga5 is not on support anymore, but I hope this scenario won't
> repeat in the future for mga6/mga7 and so on.
> 
> 

This issue is most likely still valid in Cauldron and Mageia 6

Patches for our own tools should not be created against the package, but against our git sources, though: 
gitweb.mageia.org/software/drakx-net/tree/lib/network/network.pm

There is nothing that resembles your patch in "sub advanced_choose {" http://gitweb.mageia.org/software/drakx-net/tree/lib/network/network.pm#n522

Would you manage to attach a git patch? (Then, if the patch is accepted, you're automatically set as author)

Version: 5 => Cauldron
Whiteboard: (none) => MGA6TOO, MGA5TOO
CC: (none) => marja11
Assignee: bugsquad => mageiatools

Comment 4 Paul Bichis 2019-01-22 13:57:16 CET
Created attachment 10685 [details]
nozeroconf - patch
Comment 5 Paul Bichis 2019-01-22 13:57:40 CET
Created attachment 10686 [details]
spec file diff
Marja Van Waes 2019-01-22 14:38:36 CET

CC: (none) => mageia
Keywords: (none) => PATCH

Comment 6 Martin Whitaker 2019-01-28 22:45:15 CET
Created attachment 10691 [details]
Patch rebased against git master

This looks OK to me. I've tested it in a cauldron system.

Attachment 10686 is obsolete: 0 => 1
Attachment 10685 is obsolete: 0 => 1

Comment 7 Martin Whitaker 2019-01-30 21:52:57 CET
This is now included in cauldron. As it is a new feature, and adds a new string to be translated, I don't think it will get backported to Mageia 6.

Resolution: (none) => FIXED
Status: NEW => RESOLVED

Comment 8 Marius Avram 2021-06-08 12:25:49 CEST
Description of the problem:

The graphical editor adds the NOZEROCONF parameter with the value 1 in /etc/sysconfig/network, and overwrites the NOZEROCONF parameter even if it is already with "yes" in that file.

Before using the graphical editor:

cat /etc/sysconfig/network
NETWORKING=yes
CRDA_DOMAIN=US
NOZEROCONF=yes

After using the graphical editor:

cat /etc/sysconfig/network
NETWORKING=yes
NOZEROCONF=1
CRDA_DOMAIN=US

The /etc/sysconfig/network-scripts/ifup-eth adds the route to 169.254.0.0/16 in case the NOZEROCONF parameter is not "yes":

grep -A3 "NOZEROCONF" /etc/sysconfig/network-scripts/ifup-eth 
if [ "${NOZEROCONF}" != "yes" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo" ]; then
    ip route add 169.254.0.0/16 dev ${REALDEVICE} metric $((1000 + $(cat /sys/class/net/${REALDEVICE}/ifindex))) scope link
fi

Resolution: FIXED => (none)
Status: RESOLVED => UNCONFIRMED
CC: (none) => mariusavram83
Ever confirmed: 1 => 0

Comment 9 Olav Vitters 2021-06-16 10:19:07 CEST
Any boolean (yes/no/0/1) setting in /etc/sysconfig/network that doesn't allow y/1 and n/0 is IMO a bug in initscripts. In newer initscripts various things have been fixed to use is_true and is_false functions which allow both.

I've noticed that initscripts 10.04 (not in Cauldron) seems to have dropped the ifup-eth somehow. Need to check why. Secondly, upstream initscripts still doesn't use is_true/is_false for NOZEROCONF.

I think the real problem is in initscripts. Unfortunately, the is a problem pushing the new initscripts to Cauldron (urpmi issue causing it not to see the new initscripts). Anyway, as no progress was made anyway, maybe fixing it properly and still not being able to get this into Cauldron easily is ok.

CC: (none) => olav
Source RPM: drakx-net-2.24.2-1.mga5.src.rpm => drakx-net-2.24.2-1.mga5.src.rpm, initscripts
Ever confirmed: 0 => 1
Status: UNCONFIRMED => NEW
Status comment: (none) => initscripts should handle both 1/yes/0/no cases
Assignee: mageiatools => olav

Comment 10 Olav Vitters 2021-06-16 12:39:48 CEST
Note to self, the ifup-eth was moved to network-scripts, generated from same initscripts spec file (≥10.04).