device: deal with non-existing IP settings in get_ip_config_may_fail()

If the IP setting does not exist, consider the IP method as
may-fail=yes. This simplifies the decision path in check_ip_state(),
where the value of may-fail is used to decide whether we must wait for
the IP method to complete. If there is no IP setting (i.e. the device
is a slave), we don't have to wait for it to be applied.

Fixes the following:

nm_setting_ip_config_get_may_fail: assertion 'NM_IS_SETTING_IP_CONFIG (setting)' failed
Process terminating with default action of signal 5 (SIGTRAP): dumping core
    at 0x6C95643: g_logv (gmessages.c:1086)
    by 0x6C957BE: g_log (gmessages.c:1119)
    by 0x193CB3: nm_setting_ip_config_get_may_fail (nm-setting-ip-config.c:2336)
    by 0x2431D0: check_ip_state (nm-device.c:4643)
    by 0x24770B: nm_device_activate_stage3_ip6_start (nm-device.c:7594)
    by 0x247EC7: nm_device_master_enslave_slave (nm-device.c:1769)
    by 0x8659DCB: ffi_call_unix64 (unix64.S:76)
    by 0x86596F4: ffi_call (ffi64.c:522)
    by 0x6801147: g_cclosure_marshal_generic (gclosure.c:1487)
    by 0x6800907: g_closure_invoke (gclosure.c:801)
    by 0x6812A1C: signal_emit_unlocked_R (gsignal.c:3627)
    by 0x681AAB0: g_signal_emit_valist (gsignal.c:3383)
    by 0x681AD9E: g_signal_emit (gsignal.c:3439)
    by 0x241F04: _set_state_full (nm-device.c:12272)
    by 0x248E86: activate_stage3_ip_config_start (nm-device.c:7626)
    by 0x227D83: activation_source_handle_cb (nm-device.c:4204)
    by 0x227E3D: activation_source_handle_cb4 (nm-device.c:4141)
    by 0x6C8ED79: g_main_dispatch (gmain.c:3152)
    by 0x6C8ED79: g_main_context_dispatch (gmain.c:3767)
    by 0x6C8F0B7: g_main_context_iterate.isra.24 (gmain.c:3838)
    by 0x6C8F389: g_main_loop_run (gmain.c:4032)
    by 0x139A80: main (main.c:425)
This commit is contained in:
Beniamino Galvani 2017-03-24 13:57:17 +01:00
parent 996e081af3
commit f20bdebae9

View file

@ -4278,7 +4278,7 @@ get_ip_config_may_fail (NMDevice *self, int family)
g_assert_not_reached ();
}
return nm_setting_ip_config_get_may_fail (s_ip);
return !s_ip || nm_setting_ip_config_get_may_fail (s_ip);
}
static void