]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
wireguard-tools: enable reload without teardown 21784/head
authorPaul Donald <newtwen+github@gmail.com>
Sat, 31 Jan 2026 14:52:21 +0000 (15:52 +0100)
committerRobert Marko <robimarko@gmail.com>
Mon, 2 Feb 2026 11:25:52 +0000 (12:25 +0100)
- preserve (active) interface (at reload)

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21784
Signed-off-by: Robert Marko <robimarko@gmail.com>
package/network/utils/wireguard-tools/files/wireguard.sh

index e8867d65f7fd008f7d90742a535205e07279add3..738714e1c6bd424840731db376913fbbb78db4a6 100644 (file)
@@ -56,12 +56,10 @@ proto_wireguard_setup() {
        config_get nohostroute "${config}" "nohostroute"
        config_get tunlink "${config}" "tunlink"
 
-       ip link del dev "${config}" 2>/dev/null
-       ip link add dev "${config}" type wireguard
+       # Add the link only if it didn't already exist
+       ip -br link show "${config}" >/dev/null 2>&1 || ip link add dev "${config}" type wireguard
 
-       if [ "${mtu}" ]; then
-               ip link set mtu "${mtu}" dev "${config}"
-       fi
+       [ -n "${mtu}" ] && ip link set mtu "${mtu}" dev "${config}"
 
        proto_init_update "${config}" 1