diff options
author | Dan Williams <dcbw@redhat.com> | 2013-09-26 12:45:15 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-09-26 12:45:15 -0500 |
commit | e4746a7bf6f8d9b499a02ca6953ca6ffe06b73dd (patch) | |
tree | 3c22e3816a73252f5ce142538e887573a0f019a1 | |
parent | a045c296385ca4937d34c47dcb308e00b8bed983 (diff) | |
download | NetworkManager-dcbw/rh1011698-ndp-init-error.tar.gz |
ipv6: don't abort if libndp can't intialize an NDP instance (rh #1011698)dcbw/rh1011698-ndp-init-error
Perhaps if the user has disabled IPv6 at a kernel level, or if for
whatever reason ndp_open() can't complete successfully, NM should
just fail IPv6 instead of crashing.
-rw-r--r-- | src/devices/nm-device.c | 7 | ||||
-rw-r--r-- | src/rdisc/nm-lndp-rdisc.c | 17 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index d99b3d726a..fc366c7877 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3167,13 +3167,14 @@ addrconf6_start (NMDevice *self) } priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self), nm_device_get_ip_iface (self)); - nm_platform_sysctl_set (priv->ip6_accept_ra_path, "0"); - if (!priv->rdisc) { - nm_log_err (LOGD_IP6, "Failed to start router discovery."); + nm_log_err (LOGD_IP6, "(%s): failed to start router discovery.", + nm_device_get_ip_iface (self)); return FALSE; } + nm_platform_sysctl_set (priv->ip6_accept_ra_path, "0"); + priv->rdisc_config_changed_sigid = g_signal_connect ( priv->rdisc, NM_RDISC_CONFIG_CHANGED, G_CALLBACK (rdisc_config_changed), self); diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c index ab27fa8327..456e376a18 100644 --- a/src/rdisc/nm-lndp-rdisc.c +++ b/src/rdisc/nm-lndp-rdisc.c @@ -50,10 +50,18 @@ G_DEFINE_TYPE (NMLNDPRDisc, nm_lndp_rdisc, NM_TYPE_RDISC) NMRDisc * nm_lndp_rdisc_new (int ifindex, const char *ifname) { - NMRDisc *rdisc = g_object_new (NM_TYPE_LNDP_RDISC, NULL); + NMRDisc *rdisc; + struct ndp *ndp = NULL; + int error; - g_assert (rdisc); + error = ndp_open (&ndp); + if (error) { + nm_log_warn (LOGD_IP6, "(%s): failed to initialize IPv6 NDP: %d", ifname, error); + return NULL; + } + rdisc = g_object_new (NM_TYPE_LNDP_RDISC, NULL); + NM_LNDP_RDISC_GET_PRIVATE (rdisc)->ndp = ndp; rdisc->ifindex = ifindex; rdisc->ifname = g_strdup (ifname); @@ -594,11 +602,6 @@ start (NMRDisc *rdisc) static void nm_lndp_rdisc_init (NMLNDPRDisc *lndp_rdisc) { - NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (lndp_rdisc); - int error; - - error = ndp_open (&priv->ndp); - g_assert (!error); } static void |