ip-tunnel: let update_properties_from_ifindex() clear properties on failure

This commit is contained in:
Thomas Haller
2015-12-01 23:39:47 +01:00
parent 8bbc6899b9
commit 2b51ecc9e5

View File

@@ -128,6 +128,7 @@ update_properties_from_ifindex (NMDevice *device, int ifindex)
char *key; char *key;
if (ifindex <= 0) { if (ifindex <= 0) {
clear:
if (priv->parent || priv->parent_ifindex) { if (priv->parent || priv->parent_ifindex) {
g_clear_object (&priv->parent); g_clear_object (&priv->parent);
priv->parent_ifindex = 0; priv->parent_ifindex = 0;
@@ -159,7 +160,7 @@ update_properties_from_ifindex (NMDevice *device, int ifindex)
lnk = nm_platform_link_get_lnk_gre (NM_PLATFORM_GET, ifindex, NULL); lnk = nm_platform_link_get_lnk_gre (NM_PLATFORM_GET, ifindex, NULL);
if (!lnk) { if (!lnk) {
_LOGW (LOGD_HW, "could not read %s properties", "gre"); _LOGW (LOGD_HW, "could not read %s properties", "gre");
return; goto clear;
} }
parent_ifindex = lnk->parent_ifindex; parent_ifindex = lnk->parent_ifindex;
@@ -204,7 +205,7 @@ update_properties_from_ifindex (NMDevice *device, int ifindex)
lnk = nm_platform_link_get_lnk_sit (NM_PLATFORM_GET, ifindex, NULL); lnk = nm_platform_link_get_lnk_sit (NM_PLATFORM_GET, ifindex, NULL);
if (!lnk) { if (!lnk) {
_LOGW (LOGD_HW, "could not read %s properties", "sit"); _LOGW (LOGD_HW, "could not read %s properties", "sit");
return; goto clear;
} }
parent_ifindex = lnk->parent_ifindex; parent_ifindex = lnk->parent_ifindex;
@@ -219,7 +220,7 @@ update_properties_from_ifindex (NMDevice *device, int ifindex)
lnk = nm_platform_link_get_lnk_ipip (NM_PLATFORM_GET, ifindex, NULL); lnk = nm_platform_link_get_lnk_ipip (NM_PLATFORM_GET, ifindex, NULL);
if (!lnk) { if (!lnk) {
_LOGW (LOGD_HW, "could not read %s properties", "ipip"); _LOGW (LOGD_HW, "could not read %s properties", "ipip");
return; goto clear;
} }
parent_ifindex = lnk->parent_ifindex; parent_ifindex = lnk->parent_ifindex;
@@ -235,7 +236,7 @@ update_properties_from_ifindex (NMDevice *device, int ifindex)
lnk = nm_platform_link_get_lnk_ip6tnl (NM_PLATFORM_GET, ifindex, NULL); lnk = nm_platform_link_get_lnk_ip6tnl (NM_PLATFORM_GET, ifindex, NULL);
if (!lnk) { if (!lnk) {
_LOGW (LOGD_HW, "could not read %s properties", "ip6tnl"); _LOGW (LOGD_HW, "could not read %s properties", "ip6tnl");
return; goto clear;
} }
parent_ifindex = lnk->parent_ifindex; parent_ifindex = lnk->parent_ifindex;