if (r == 0)
return 1; /* Polkit will call us back */
- r = link_reconfigure_full(l, LINK_RECONFIGURE_UNCONDITIONALLY, message, /* counter = */ NULL);
+ r = link_reconfigure_full(l, LINK_RECONFIGURE_UNCONDITIONALLY | LINK_RECONFIGURE_CLEANLY, message, /* counter = */ NULL);
if (r != 0)
return r; /* Will reply later when r > 0. */
/* Dropping old .network file */
- if (FLAGS_SET(flags, LINK_RECONFIGURE_UNCONDITIONALLY)) {
+ if (FLAGS_SET(flags, LINK_RECONFIGURE_CLEANLY)) {
/* Remove all static configurations. Note, dynamic configurations are dropped by
* link_stop_engines(), and foreign configurations will be removed later by
* link_configure() -> link_drop_unmanaged_config(). */
* For non-wireless interfaces, we have no way to detect the connected network change. So,
* we do not set any flags here. Note, both ssid and previous_ssid are NULL in that case. */
if (link->previous_ssid && !streq_ptr(link->previous_ssid, link->ssid))
- flags |= LINK_RECONFIGURE_UNCONDITIONALLY;
+ flags |= LINK_RECONFIGURE_UNCONDITIONALLY | LINK_RECONFIGURE_CLEANLY;
link->previous_ssid = mfree(link->previous_ssid);
/* AP and P2P-GO interfaces may have a new SSID - update the link properties in case a new .network
typedef enum LinkReconfigurationFlag {
LINK_RECONFIGURE_UNCONDITIONALLY = 1 << 0, /* Reconfigure an interface even if .network file is unchanged. */
+ LINK_RECONFIGURE_CLEANLY = 1 << 1, /* Drop all existing configs before reconfiguring. Otherwise, reuse existing configs as possible as we can. */
} LinkReconfigurationFlag;
typedef struct Manager Manager;