diff options
author | Thomas Haller <thaller@redhat.com> | 2019-07-30 18:50:15 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-07-31 10:22:03 +0200 |
commit | dc219662fa31b6bc453c177c10e03442483de21e (patch) | |
tree | a392b53faae58e27a7ac0bb2a57fea8a5df928ad | |
parent | 47fc1a4293437a88adfd247734e32fa1b86ca7a9 (diff) | |
download | NetworkManager-dc219662fa31b6bc453c177c10e03442483de21e.tar.gz |
wireguard: clear cached auto-default-route setting in act_stage1_prepare()
We call _auto_default_route_init() at various places, for example during
coerce_route_table(). We cannot be sure that we don't call it before
activation starts (before stage1) or after device-cleanup.
That means, upon activation, we need to clear the state first. Do that in
act_stage1_prepare().
-rw-r--r-- | src/devices/nm-device-wireguard.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/devices/nm-device-wireguard.c b/src/devices/nm-device-wireguard.c index e997d2e823..0f357a1106 100644 --- a/src/devices/nm-device-wireguard.c +++ b/src/devices/nm-device-wireguard.c @@ -1625,6 +1625,17 @@ link_config_delayed_resolver_cb (gpointer user_data) } static NMActStageReturn +act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) +{ + NMDeviceWireGuardPrivate *priv = NM_DEVICE_WIREGUARD_GET_PRIVATE (device); + + priv->auto_default_route_initialized = FALSE; + priv->auto_default_route_priority_initialized = FALSE; + + return NM_DEVICE_CLASS (nm_device_wireguard_parent_class)->act_stage1_prepare (device, out_failure_reason); +} + +static NMActStageReturn act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason) { @@ -2064,6 +2075,7 @@ nm_device_wireguard_class_init (NMDeviceWireGuardClass *klass) device_class->connection_type_check_compatible = NM_SETTING_WIREGUARD_SETTING_NAME; device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_WIREGUARD); + device_class->act_stage1_prepare = act_stage1_prepare; device_class->state_changed = device_state_changed; device_class->create_and_realize = create_and_realize; device_class->act_stage2_config = act_stage2_config; |