~alfonsosanchezbeato/snappy-hwe-snaps/+git/network-manager:primary-is-last-dhcp

Last commit made on 2019-01-11
Get this branch:
git clone -b primary-is-last-dhcp https://git.launchpad.net/~alfonsosanchezbeato/snappy-hwe-snaps/+git/network-manager
Only Alfonso Sanchez-Beato can upload to this branch. If you are Alfonso Sanchez-Beato please log in for upload directions.

Branch merges

Branch information

Name:
primary-is-last-dhcp
Repository:
lp:~alfonsosanchezbeato/snappy-hwe-snaps/+git/network-manager

Recent commits

74d24ff... by Alfonso Sanchez-Beato

Some debug stuff

6b6e925... by Alfonso Sanchez-Beato

core: ignore IPv6 multicast in route comparison

The default multicas for IPv6 is some times set. Just ignore it to avoid
duplicating a connection due to this.

dff2cbe... by Thomas Haller

core: ignore host-routes routes when matching generated connection

When we generate the connection in nm_device_generate_connection(), we
add all routes that have rt_source (roundtrip(NM_IP_CONFIG_SOURCE_USER)).
Especially since commit e470e1392242a088573c4fc317b7b5ffaca4df19, this
includes automatically added host-routes to the gateway, added by
ip4_config_merge_and_apply().

Later, during nm_utils_match_connection() this route most not prevent
matching. Either nm_device_generate_connection() should not add it, or
nm_utils_match_connection() should ignore it.

I think adjusting the matching is better, because ip-configs are used
for several things, including exposing routes on D-Bus. We don't want
to hide this route on D-Bus.

Fixes: e470e1392242a088573c4fc317b7b5ffaca4df19

https://bugzilla.redhat.com/show_bug.cgi?id=1487384

30a7470... by Thomas Haller

core: add nm_utils_ipx_address_clear_host_address() util

568c263... by Thomas Haller

src: only compare network parts of routes in nm_utils_match_connection()

Kernel requires that routes have a host part of zero. For NetworkManager
configuration we allow non-zero host parts (but ignore them). Fix
route_compare() to ignore the host part.

This has only effect during assuming connections. That means, on
restart NM would fail to match a connection with static routes
if it has a non-zero host part. So, the impact is rather small.

(cherry picked from commit 034b7fb51c1d16a4002d2902c60aac05e946bb4f)

847e4c7... by Thomas Haller

core: fix matching routes for assuming connections

If the connection candidate contains a static route
without route-metric, but overrides the default
route-metric, matching would have failed:

  ipv4.route-metric: 200
  ipv4.routes: { ip = 192.168.5.0/32 }

Then, we must not compare existing routes using the device's
metric, but must use the overwrite from the connection.

fc2aa58... by Beniamino Galvani <email address hidden>

platform: fix detection of primary/secondary addresses

ip4_addr_subnets_is_secondary() should fill the list of addresses in
the same subnet also when returning FALSE, because
nm_platform_ip4_address_sync() uses it.

Fixes: 2f68a5004153cea9878999bf3a442ecda263e5f7

be796c6... by Beniamino Galvani <email address hidden>

platform: fix the order of addition of primary and secondary IPv4 addresses

nm_platform_ip4_address_sync() tries to apply the new configuration
with the minimum effort and doesn't delete addresses if they are
already present on the interface. This can break the ordering, as an
existing address would be promoted by kernel to primary, even if it
was last in our configuration.

Add some logic to ensure the correct order of addresses is always
enforced. This fixes situations like:

 # nmcli connection add type ethernet ifname eth0 con-name t \
                        ipv4.method manual \
                        ipv4.addresses "1.1.1.1/24,1.1.1.2/24,1.1.1.5/24"
 # nmcli connection up t

  => addresses are applied in the right order:
     inet 1.1.1.1/24 brd 1.1.1.255 scope global eth0
     inet 1.1.1.2/24 brd 1.1.1.255 scope global secondary eth0
     inet 1.1.1.5/24 brd 1.1.1.255 scope global secondary eth0

 # nmcli connection mod t ipv4.addresses "1.1.1.5/24,1.1.1.2/24,1.1.1.1/24"
 # nmcli device reapply eth0

  => order is wrong:
     inet 1.1.1.2/24 brd 1.1.1.255 scope global eth0
     inet 1.1.1.5/24 brd 1.1.1.255 scope global secondary eth0
     inet 1.1.1.1/24 brd 1.1.1.255 scope global secondary eth0

Co-Authored-By: Thomas Haller <email address hidden>

06511d9... by Beniamino Galvani <email address hidden>

device: take care of default route of DHCP generated-assumed connections

In general we don't touch the externally set default route on devices
that use a generated-assumed connection. When the IP method is AUTO
(or DHCP), this means that we are not able to restore the default
route after a temporary expiration of the lease which removes
addresses/routes from the device.

Change this, and let NM update the default route for generated-assumed
devices using dynamic addressing.

https://bugzilla.redhat.com/show_bug.cgi?id=1265239
(cherry picked from commit 9b7f9af0776c5b741c616d3af4b0cda522c27295)

c8196c5... by Beniamino Galvani <email address hidden>

device: don't update applied connection for generated assumed devices

The applied connection must describe the configuration that was
initially activated on the device. Even if the IP configuration
changes, we shouldn't reset the applied connection for devices using a
generated-assumed connection, otherwise we would lose information on
the IP method we're trying on the device.

(cherry picked from commit c84fd50287086082a8037ccb112f99b1026edd17)