After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 738268 - NM changes external interface route metrics
NM changes external interface route metrics
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: IP and DNS config
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on: 735512
Blocks:
 
 
Reported: 2014-10-09 23:17 UTC by Dan Williams
Modified: 2014-11-07 15:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-core-don-t-override-external-route-metrics-bgo-73826.patch (3.09 KB, patch)
2014-10-13 21:33 UTC, Dan Williams
none Details | Review

Description Dan Williams 2014-10-09 23:17:19 UTC
The root problem is that NMSettingIP4Config has always treated a metric of '0' as default, meaning that it should apply the device priority as the metric.

Unfortunately with assumed devices, their NMSettingIP4Config gets generated from the device IP configuration, and often the metric is 0 because that's what the external program that created the route set the metric to.

So when nm-device.c::ip4_config_merge_and_apply() calls nm_ip4_config_merge_setting(), 'composite' will already have the right routes + metrics because they were added to 'composite' when merging priv->ext_ip4_config.  But the NMSettingIP4Config *also* has the same routes (and with a metric of 0 too) because external routes are added to the connection.

nm_ip4_config_merge_setting() overwrites anything that's already in the IP4Config on purpose, assuming that user-specified routes should override whatever existed on the system because the user specified those routes themselves. Unfortunately we (a) lost the fact that these aren't actually user-provided routes and (b) treat 0 as 'device priority' when merging a setting.

Maybe if the connection is generated/assumed we don't merge the NMSettingIP4Config at all, since that would be redundant?  If the user changes anything we already reset the 'generated' flag on the NMConnection so that we know it's been changed.
Comment 1 Thomas Haller 2014-10-10 07:31:55 UTC
This should be coordinated with bug 735512
Comment 2 Dan Williams 2014-10-13 21:33:28 UTC
Created attachment 288424 [details] [review]
0001-core-don-t-override-external-route-metrics-bgo-73826.patch
Comment 3 Thomas Haller 2014-10-14 07:38:42 UTC
Looks right to me
Comment 4 Dan Williams 2014-10-17 20:10:59 UTC
Pushed to git master and nm-0-9-10.