Bug 528281 - NM does not completely handle default routing
Summary: NM does not completely handle default routing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: NetworkManager
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Dan Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 490437 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-10 20:37 UTC by Gene Czarcinski
Modified: 2010-01-02 21:28 UTC (History)
5 users (show)

Fixed In Version: 0.2.997-4.git20091218.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-01-02 21:28:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
propose patch to handle default route with "never default" (1.82 KB, patch)
2009-10-11 18:47 UTC, Gene Czarcinski
no flags Details | Diff
proposed patch to add DEFROUTE=yes|no for default route handling (1.70 KB, patch)
2009-10-14 17:02 UTC, Gene Czarcinski
no flags Details | Diff

Description Gene Czarcinski 2009-10-10 20:37:13 UTC
Description of problem:

This is related to https://bugzilla.redhat.com/show_bug.cgi?id=523875 ... that was reported against F11 but I am giving up on getting a complete fix in F11.  I don't really expect the it will be fixed in F12 but (hopefully) it will be fixed post F12.

The problem can be seen in a system with two or more NICs (networks) each of which uses DHCP to provide addresses, etc.  They each also supply a default-route value.  Depending on the order that the NICs are activated, the desired correct default route may or may not be configured.

A current work-around is to add GATWAYDEV=xxx to /etc/sysconfig/network for the NIC which needs to be the default.  This is not a good/complete solution because it cannot be configured with nm-connection-editor.  Furthermore, if system-config-network is used to change a system configuration, the GATEWAYDEV=xxx option will be deleted from /etc/sysconfig/network.

The easiest way to see this is with a qemu-kvm F12 guest with two or more NICs defined.

I will provide more info later.

Version-Release number of selected component (if applicable):
Fedora 12 and beyond

Comment 1 Gene Czarcinski 2009-10-11 18:45:41 UTC
Attached is a proposed patch to "correct" the default route with system config 
(ifcfg-xxx) files.

I decided to follow the general approach used in the existing code which 
creates the "never-default" attribute for a NIC/connection.

The only changes are to ifcfg-rh/reader.c and ifcfg-rh/writer.c.  This change 
creates a new option/parameter for the ifcfg-xxx file in /etc/sysconfig/network-
scripts/:  NM_NEVER_DEFAULT=xxx

On input (reader.c), if NM_NEVER_DEFAULT=yes in the ifcfg-xxx file or 
GATWAYDEV=xxx in /etc/sysconfig/network indicate that this device should never 
have the default route then never-default is set to true, otherwise it is 
false.

On output: 

If never-default is true, then NM_NEVER_DEFAULT=yes is added/changed in the 
ifcfg-xxx file. 

If never-default is false and NM_NEVER_DEFAULT= is in the ifcfg-xxx file, it is 
changed to NM_NEVER_DEFAULT=no.

If never-default is false and NM_NEVER_DEFAULT= does not exist in the ifcfg-
xxx file, nothing is changed.

The GATEWAYDEV= code in reader.c remains.  However, consideration should be 
given to deleting the code since 1) it is poorly documented and 2) it is 
unnecessary with this patch.

The addition is NM_NEVER_DEFAULT= is compatible with system-config-network 
whereas GATEWAYDEV= is not compatible.

Comment 2 Gene Czarcinski 2009-10-11 18:47:10 UTC
Created attachment 364396 [details]
propose patch to handle default route with "never default"

Comment 3 Gene Czarcinski 2009-10-11 18:49:26 UTC
Some thought that went into this patch, etc:

I have been poking around the NM source code mainly with grep and gedit.  I 
believe it is possible/practical to fix things with any big re-write (which I 
believe is neither practical or desirable). [sure is a lot of code]  I mainly 
looked at how GATEWAYDEV=, GATEWAY=, and ONBOOT= (and their 
~/.gconf/system/networking/ counterparts) where handled.

Some characteristics/constraints --

1.  Having a system with one or more NICs and no default route is a valid 
configuration and should (must?) be supported by NM.

2. Regardless of having a default route or not, some connections should never 
be the default route (the intent, I believe, of the current implementation).

3.  Having GATEWAYDEV=xxx in /etc/sysconfig/network will cause all NICs other 
than xxx to be marked as "never-default".  This is and should continue to be 
supported.

4. Only if a NIC is marked as NOT for all users can I mark it for "connection 
only" (never-default).  This needs to be fixed.  I should be able to mark a NIC 
which is available to all users (an ifcfg-xxx system configuration in 
/etc/sysconfig/network-scripts/) as a "connection only" (never-default) NIC.

5.  I should be able to mark a NIC as the default route device.  I think this 
is needed for completeness but am not sure it is really required.

6.  If two or more NICs with static IPs are configured with different default 
route, I do not care ... this is a mis-configuration.

7.  The problem is not really with NICs that have static IPs but with those 
that use dhcp where each dhcp server supplies a default route.

8. system-config-network currently has a problem with GATEWAYDEV=xxx being in 
the /etc/sysconfig/network file and will delete it if you use s-c-n to change 
the NIC system configuration files.  Any solution needs to avoid this problem.
---------------------------------------------
What I propose is also something Dan mentioned ... add a new option/parameter 
to the ifcfg-xxx file.  I tried adding "FOOBARBS=yes" to the file and this is 
left alone by system-config-network and ignored by NM.  

So, I propose adding a new option/parameter such as "DEFAULTGW=yes|no" to the 
system configuration file.

Upon loading the file (in ifcfg-rh/reader.c), if DEFAULTGW=no is specified, then 
mark that connection as "never-default".

When saving the file (applying updates), if the connection is "never-default", 
then set DEFAULTGW=no.

Comment 4 Gene Czarcinski 2009-10-13 17:38:12 UTC
The patch has been tested with both F12 and F11 and fits on both and works on both.

Comment 5 Dan Williams 2009-10-13 21:08:44 UTC
Gene, can you respin with DEFROUTE as the option name instead of NM_NEVER_DEFAULT, and using svTrueValue() when reading?  That will ensure that we parse all the possibly combinations of true/false/yes/no/etc when reading it.

Thanks!

Comment 6 Dan Williams 2009-10-13 21:14:12 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=528822 for the initscripts side of this.

Comment 7 Gene Czarcinski 2009-10-14 17:00:25 UTC
I am attaching the re-worked patch for "DEFROUTE="

This only changes ifcfg-rh/reader.c and ifcfg-rh/writer.c

This patch has been tested with both F11 and F12-rawhide qemu-kvm guests.

Comment 8 Gene Czarcinski 2009-10-14 17:02:52 UTC
Created attachment 364781 [details]
proposed patch to add DEFROUTE=yes|no for default route handling

Comment 9 Jerry Amundson 2009-11-10 20:14:34 UTC
Should PEERROUTES also be considered here? I see that nm-applet manipulates it in ifcfg-*.

Comment 10 Dan Williams 2009-11-11 16:36:09 UTC
*** Bug 490437 has been marked as a duplicate of this bug. ***

Comment 11 Bug Zapper 2009-11-16 13:29:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 12 Fedora Update System 2009-12-07 07:35:52 UTC
mobile-broadband-provider-info-1.20090918-1.fc11, NetworkManager-0.7.2-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2009-12-08 08:23:41 UTC
NetworkManager-0.7.997-1.fc12,ModemManager-0.2.997-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/NetworkManager-0.7.997-1.fc12,ModemManager-0.2.997-1.fc12

Comment 14 Fedora Update System 2009-12-10 04:24:16 UTC
NetworkManager-0.7.997-1.fc12, ModemManager-0.2.997-1.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update NetworkManager ModemManager'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-13012

Comment 15 Fedora Update System 2009-12-14 22:49:19 UTC
NetworkManager-0.7.997-2.git20091214.fc12,ModemManager-0.2.997-2.git20091214.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/NetworkManager-0.7.997-2.git20091214.fc12,ModemManager-0.2.997-2.git20091214.fc12

Comment 16 Fedora Update System 2009-12-16 01:08:47 UTC
NetworkManager-0.7.997-2.git20091214.fc12, ModemManager-0.2.997-2.git20091214.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update NetworkManager ModemManager'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-13165

Comment 17 Fedora Update System 2009-12-18 04:26:44 UTC
ModemManager-0.2.997-3.git20091216.fc12, NetworkManager-0.7.997-2.git20091214.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update ModemManager NetworkManager'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-13165

Comment 18 Fedora Update System 2009-12-22 04:49:05 UTC
ModemManager-0.2.997-4.git20091218.fc12, NetworkManager-0.7.997-2.git20091214.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update ModemManager NetworkManager'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-13165

Comment 19 Fedora Update System 2010-01-02 21:27:26 UTC
ModemManager-0.2.997-4.git20091218.fc12, NetworkManager-0.7.997-2.git20091214.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


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