device/bridge: minor cleanup in NMDeviceBridge's act_stage1_prepare()

Only reset "vlan_configured" when deactivating. stage1() should be
re-entrant.
This commit is contained in:
Thomas Haller 2019-08-21 17:05:20 +02:00
parent aef9594fa6
commit f0775963c2

View file

@ -225,7 +225,7 @@ commit_option (NMDevice *device, NMSetting *setting, const Option *option, gbool
GParamSpec *pspec;
GValue val = G_VALUE_INIT;
guint32 uval = 0;
gs_free char *value = NULL;
char value[100];
g_assert (setting);
@ -258,10 +258,10 @@ commit_option (NMDevice *device, NMSetting *setting, const Option *option, gbool
if (option->user_hz_compensate)
uval *= 100;
} else
g_assert_not_reached ();
nm_assert_not_reached ();
g_value_unset (&val);
value = g_strdup_printf ("%u", uval);
nm_sprintf_buf (value, "%u", uval);
if (slave)
nm_platform_sysctl_slave_set_option (nm_device_get_platform (device), ifindex, option->sysname, value);
else
@ -502,14 +502,13 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
NMSetting *s_bridge;
const Option *option;
NM_DEVICE_BRIDGE (device)->vlan_configured = FALSE;
ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage1_prepare (device, out_failure_reason);
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
return ret;
connection = nm_device_get_applied_connection (device);
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
s_bridge = (NMSetting *) nm_connection_get_setting_bridge (connection);
g_return_val_if_fail (s_bridge, NM_ACT_STAGE_RETURN_FAILURE);
@ -555,6 +554,10 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
static void
deactivate (NMDevice *device)
{
NMDeviceBridge *self = NM_DEVICE_BRIDGE (device);
self->vlan_configured = FALSE;
if (nm_bt_vtable_network_server) {
/* always call unregister. It does nothing if the device
* isn't registered as a hotspot bridge. */