From 88202316a523409ca5f28b41c8c530dd731769b7 Mon Sep 17 00:00:00 2001 From: Danilo Egea Gondolfo Date: Fri, 4 Oct 2024 12:45:14 +0100 Subject: [PATCH] wpa_supplicant: add ExecReload to the service unit Add an ExecReload command to call "wpa_cli reconfigure" on the interface. With that we can use "systemctl reload" to reconfigure a wireless device without having to call stop/start. --- src/networkd.c | 2 ++ tests/generator/base.py | 1 + 2 files changed, 3 insertions(+) diff --git a/src/networkd.c b/src/networkd.c index 814fabc6e..aed0273f6 100644 --- a/src/networkd.c +++ b/src/networkd.c @@ -1341,6 +1341,8 @@ write_wpa_unit(const NetplanNetDefinition* def, const char* rootdir) g_string_append(s, " -Dnl80211,wext\n"); } + g_string_append_printf(s, "ExecReload=/sbin/wpa_cli -i %s reconfigure\n", stdouth); + g_autofree char* new_s = _netplan_scrub_systemd_unit_contents(s->str); g_string_free(s, TRUE); s = g_string_new(new_s); diff --git a/tests/generator/base.py b/tests/generator/base.py index b32b04234..30f42adde 100644 --- a/tests/generator/base.py +++ b/tests/generator/base.py @@ -99,6 +99,7 @@ [Service] Type=simple ExecStart=/sbin/wpa_supplicant -c /run/netplan/wpa-%(iface)s.conf -i%(iface)s -D%(drivers)s +ExecReload=/sbin/wpa_cli -i %(iface)s reconfigure ''' NM_MANAGED = 'SUBSYSTEM=="net", ACTION=="add|change|move", ENV{ID_NET_NAME}=="%s", ENV{NM_UNMANAGED}="0"\n' NM_UNMANAGED = 'SUBSYSTEM=="net", ACTION=="add|change|move", ENV{ID_NET_NAME}=="%s", ENV{NM_UNMANAGED}="1"\n'