[th/unrealized-vpn-crash] device: avoid crash setting VPN config during unrealize
During nm_device_unrealize()
, we first clear the device's ifindex. Then
we call _set_state_full(NM_DEVICE_STATE_UNMANAGED)
.
NMVpnConnection
are subclasses of NMActiveConnection
, it is that way
connected to NM_DEVICE_STATE_CHANGED
signal. And this leads to a call
to _set_vpn_state()
, which then calls nm_device_replace_vpn6_config()
to unregister the config. Thereby an assertion fails because the
ifindex no longer matches.
Fix that by relaxing the assertion. Also, don't apply the IP configuration in unexpected device states.