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 740443 - [review] th/bgo740443_device_ip_changes - IP configuration to show actually configured addresses and routes
[review] th/bgo740443_device_ip_changes - IP configuration to show actually c...
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-11-20 16:37 UTC by Thomas Haller
Modified: 2015-01-24 17:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Thomas Haller 2014-11-20 16:37:18 UTC
On platform changes, we call update_ip_config(), which eventually calls ip4_config_merge_and_apply() with commit=FALSE.

In this case we construct priv->ip4_config based on settings that we expect (such as content from nm_setting_ip_config()). This is not necessarily the same that is actually configured on the physical interface.

See https://bugzilla.gnome.org/show_bug.cgi?id=735512#c51 for a longer discussion
Comment 1 Thomas Haller 2014-11-21 19:54:03 UTC
Pushed branch for review:

th/bgo740443_device_ip_changes


This contains yet another major change to default routes :)
But this time it is great. NM will now gladly accept any default route you configure externally. Even for managed, non-assumed interfaces.
Comment 2 Dan Williams 2014-11-26 21:42:50 UTC
> core: add intersect() functions to NMIP?Config

Should the intersect logic for 'gateway' be a bit more complete?  eg

if (!nm_ip4_config_get_num_addresses (dst) ||
    (nm_ip4_config_get_gateway (src) != nm_ip4_config_get_gateway (dst)))
	nm_ip4_config_set_gateway (dst, 0);

(same for IPv6)


> device: refactor ipx_config_merge_and_apply()

This conflicts with some of the VPN routing changes in git master so it'll need a careful rebase.

Also there are some double-newlines in ip6_merge_and_apply() around the has_direct_route bit.


> device: better accept external IP changes

I would call it "ensure_con_ip_configs()" to better match other places that do the same type of thing.

I'd also put short comments into update_ip_config() about both the intersection and the subtraction, about what exactly the intended result of each operation is supposed to be.

For example the intersection will remove any IP configuration from priv->XXX_ip4_config that is not actually present in the kernel.  The subtraction will remove any auto-or-settings-sourced configuration from priv->ext_ip4_config, leaving only external changes in priv->ext_ip4_config.


> device: always pickup externally configured default routes for a device

Commit message has "new configuraiton tobe" -> "new configuration to be"

This comment is now wrong:

+	/* In the (!has_direct_route && !commit) case it is not clear whether
+	 * adding the default route will succeed. Still give it a try and add it */

because this code path is never encountered for !commit cases.

Which means this "commit" is also dead code because at this point commit == TRUE
:

+	if (!has_direct_route && commit) {

Same for IPv6.

Rest looks good.
Comment 3 Thomas Haller 2014-12-01 13:38:06 UTC
(In reply to comment #2)
> > core: add intersect() functions to NMIP?Config
> 
> Should the intersect logic for 'gateway' be a bit more complete?  eg
> 
> if (!nm_ip4_config_get_num_addresses (dst) ||
>     (nm_ip4_config_get_gateway (src) != nm_ip4_config_get_gateway (dst)))
>     nm_ip4_config_set_gateway (dst, 0);
> 
> (same for IPv6)

done.


> > device: refactor ipx_config_merge_and_apply()
> 
> This conflicts with some of the VPN routing changes in git master so it'll need
> a careful rebase.
> 
> Also there are some double-newlines in ip6_merge_and_apply() around the
> has_direct_route bit.

the double-newlines are there to mirror the v4 code. I like to see them side by side to confirm that they mostly identical -- up to s/4/6/


> > device: better accept external IP changes
> 
> I would call it "ensure_con_ip_configs()" to better match other places that do
> the same type of thing.
>
> I'd also put short comments into update_ip_config() about both the intersection
> and the subtraction, about what exactly the intended result of each operation
> is supposed to be.
> 
> For example the intersection will remove any IP configuration from
> priv->XXX_ip4_config that is not actually present in the kernel.  The
> subtraction will remove any auto-or-settings-sourced configuration from
> priv->ext_ip4_config, leaving only external changes in priv->ext_ip4_config.

done

> > device: always pickup externally configured default routes for a device
> 
> Commit message has "new configuraiton tobe" -> "new configuration to be"
> 
> This comment is now wrong:
> 
> +    /* In the (!has_direct_route && !commit) case it is not clear whether
> +     * adding the default route will succeed. Still give it a try and add it
> */
> 
> because this code path is never encountered for !commit cases.
> 
> Which means this "commit" is also dead code because at this point commit ==
> TRUE
> :
> 
> +    if (!has_direct_route && commit) {
> 
> Same for IPv6.

done.



Rebased on master.
Comment 4 Thomas Haller 2014-12-15 17:23:33 UTC
Rebased on master
Comment 5 Dan Williams 2015-01-19 23:48:54 UTC
LGTM, though lets re-test it again to make sure it still has the behavior we expect.  FYI it rebases on git master without problems.
Comment 6 Thomas Haller 2015-01-20 14:09:08 UTC
It tests as expected to me after fixing a few bugs.

Added two minor new commits:
>> device: require a direct route for IPv6 gateway
>> default-route: improve logging format for default route entries


Rebased on master. IMO it's good to go now
Comment 7 Dan Williams 2015-01-23 19:16:34 UTC
New commits LGTM