Due to various ordering issues in ModemManager, when the Enable()
call fails because a PIN is required, MM will disable the modem
and *then* complete the dbus call. That means that NM gets the
Enable property change before the Enable() call completes, and NM
would then transition the device to DISCONNECTED. What we
really want to do is get the response from MM and then figure out
whether to fail activation or get secrets, not go to DISCONNECTED.
To fix this, ignore Enabled property changes to FALSE while
activating so we can handle it ourselves. There are still a few
fixes left in nm-applet to make the secrets request for PINs work
on-the-fly, but saved in the connection works fine.
If the user has already mapped the hostname to some other address,
assume the user knows what they are doing (since they probably do)
and leave that mapping alone, and create a minimal 127.0.0.1 entry.
If there was no hostname mapping, add it to the 127.0.0.1 entry
like NM did before.
Having the original hostname checks in the settings-service code
didn't allow the policy enough granularity to differentiate between
a plugin-provided hostname and the original hostname. We want to
fall back to the original hostname if there isn't a persistent
hostname (from a plugin) and if there isn't a DHCP-provided
hostname. Moving the original hostname checks to the policy
makes that possible. Clarify the precedence order at the same
time, and minimally validate the DHCP hostname as well.
Sometimes cause the cache not to refill with all interfaces,
meaning NM sometimes got the wrong carrier state from the
kernel which prevented NM from taking over existing connections.
nm_device_set_use_dhcp() and nm_device_get_use_dhcp() were somewhat
confusing and don't really reflect the new DHCP architecture with
NMDHCPClient. Now that timeout and state signals are specific to
the NMDHCPClient it doesn't make sense to check for DHCP use
in the callbacks for those signals since they'll never get called
if DHCP isn't in use. We might as well just keep the DHCP manager
around and check whether a DHCP client instance exists when we need
to figure out whether DHCP is in use.