summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-05-08 14:42:40 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-05-08 15:01:39 +0200
commit8b73812062686472e4b082215872adc8f7d3ee9f (patch)
tree5f52c80ddcb7460c1cc073aa04975bb8aeb14dfb
parentaaaefd827e900f83770985660d936fda6a18ee6a (diff)
downloadNetworkManager-8b73812062686472e4b082215872adc8f7d3ee9f.tar.gz
device: fix check in addrconf6_start()
We check the return value of _get_stable_id(); when it is NULL priv->ndisc would stay NULL too and we would crash when dereferencing @error. Actually, _get_stable_id() can never return NULL, so replace the check with an assertion.
-rw-r--r--src/devices/nm-device.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 38800d5d75..821d4a8339 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7418,16 +7418,15 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
g_assert (s_ip6);
stable_id = _get_stable_id (self, connection, &stable_type);
- if (stable_id) {
- priv->ndisc = nm_lndp_ndisc_new (nm_device_get_platform (self),
- nm_device_get_ip_ifindex (self),
- nm_device_get_ip_iface (self),
- stable_type,
- stable_id,
- nm_setting_ip6_config_get_addr_gen_mode (s_ip6),
- ndisc_node_type (self),
- &error);
- }
+ g_assert (stable_id);
+ priv->ndisc = nm_lndp_ndisc_new (nm_device_get_platform (self),
+ nm_device_get_ip_ifindex (self),
+ nm_device_get_ip_iface (self),
+ stable_type,
+ stable_id,
+ nm_setting_ip6_config_get_addr_gen_mode (s_ip6),
+ ndisc_node_type (self),
+ &error);
if (!priv->ndisc) {
_LOGE (LOGD_IP6, "addrconf6: failed to start neighbor discovery: %s", error->message);
g_error_free (error);