nm-device: avoid starting ac6 if l3cfg is not there

If the ovs interface goes away, the ifindex gets zeroed out and l3cfg is
cleaned. Avoid starting ac6 in that case -- add checks similar to what
we do for ll6.

Bad things happen otherwise:

  #0  0x00007f769734c895 in _g_log_abort (breakpoint=1) at gmessages.c:580
  #1  0x00007f769734db98 in g_logv (log_domain=0x55b2472d8840 "nm",
        log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>,
        args=args@entry=0x7fff4041b9d0) at gmessages.c:1391
  #2  0x00007f769734dd63 in g_log (log_domain=log_domain@entry=0x55b2472d8840 "nm",
        log_level=log_level@entry=G_LOG_LEVEL_CRITICAL,
        format=format@entry=0x7f769739a620 "%s: assertion '%s' failed") at gmessages.c:1432
  #3  0x00007f769734e59d in g_return_if_fail_warning
      (log_domain=log_domain@entry=0x55b2472d8840 "nm",
        pretty_function=pretty_function@entry=0x55b2472d5fe0 <__func__.39677> "nm_lndp_ndisc_new",
        expression=expression@entry=0x55b2472d5fa3 "NM_IS_L3CFG(config->l3cfg)")
        at gmessages.c:2809
  #4  0x000055b2471ce3fa in nm_lndp_ndisc_new (config=config@entry=0x7fff4041bb30)
        at src/core/ndisc/nm-lndp-ndisc.c:680
  #5  0x000055b247123b32 in _dev_ipac6_start (self=self@entry=0x55b248078360 [NMDeviceOvsInterface])
        at src/core/devices/nm-device.c:11287
  #6  0x000055b2471232f8 in _dev_ipac6_start_continue (self=0x55b248078360 [NMDeviceOvsInterface])
        at src/core/devices/nm-device.c:11338
  #7  0x000055b2471232f8 in _dev_ipll6_set_llstate (self=0x55b248078360 [NMDeviceOvsInterface],
        llstate=<optimized out>, lladdr=<optimized out>) at src/core/devices/nm-device.c:10541
  #8  0x000055b2471c9e8b in _emit_changed_on_idle_cb (user_data=user_data@entry=0x55b24807bdd0)
        at src/core/nm-l3-ipv6ll.c:221
  #9  0x00007f769734327b in g_idle_dispatch (source=0x55b248119200,
        callback=0x55b2471c9ce0 <_emit_changed_on_idle_cb>,
        user_data=0x55b24807bdd0) at gmain.c:5579
  #10 0x00007f769734695d in g_main_dispatch (context=0x55b247f56bc0) at gmain.c:3193
  #11 0x00007f769734695d in g_main_context_dispatch (context=context@entry=0x55b247f56bc0)
        at gmain.c:3873
  #12 0x00007f7697346d18 in g_main_context_iterate (context=0x55b247f56bc0,
        block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3946
  #13 0x00007f7697347042 in g_main_loop_run (loop=0x55b247f320f0) at gmain.c:4142
  #14 0x000055b246f26b64 in main (argc=<optimized out>,
        argv=<optimized out>) at src/core/main.c:511
This commit is contained in:
Lubomir Rintel 2021-12-09 12:56:53 +01:00
parent 9ab22dbc80
commit bb0a31e6eb

View file

@ -11252,6 +11252,18 @@ _dev_ipac6_start(NMDevice *self)
guint32 default_ra_timeout;
NMUtilsIPv6IfaceId iid;
gboolean is_token;
const char *ifname;
if (!priv->l3cfg) {
_LOGD(LOGD_IP6, "addrconf6: no IP link for IPv6");
return;
}
ifname = nm_device_get_ip_iface(self);
if (!ifname) {
_LOGD(LOGD_IP6, "addrconf6: no interface name for IPv6");
return;
}
if (priv->ipac6_data.state == NM_DEVICE_IP_STATE_NONE) {
if (!g_file_test("/proc/sys/net/ipv6", G_FILE_TEST_IS_DIR)) {
@ -11306,8 +11318,8 @@ _dev_ipac6_start(NMDevice *self)
{
const NMNDiscConfig config = {
.l3cfg = nm_device_get_l3cfg(self),
.ifname = nm_device_get_ip_iface(self),
.l3cfg = priv->l3cfg,
.ifname = ifname,
.stable_type = stable_type,
.network_id = stable_id,
.addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode(s_ip),