diff options
| author | Paul Donald | 2026-01-31 14:52:21 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-02-08 23:47:28 +0000 |
| commit | 436b090bc746441a658524a84b9e35afe468ec35 (patch) | |
| tree | f3bb1013e0f9d544b4721abc8a8854b17d1dca0f | |
| parent | f78d9d898c25cca3fa8757172f64cb9269a1d637 (diff) | |
| download | openwrt-436b090bc746441a658524a84b9e35afe468ec35.tar.gz | |
wireguard-tools: enable reload without teardown
- 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>
(cherry picked from commit 0a576dec7468b9d1185b383ba17ee9c7b2151a5d)
Link: https://github.com/openwrt/openwrt/pull/21840
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | package/network/utils/wireguard-tools/files/wireguard.sh | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/package/network/utils/wireguard-tools/files/wireguard.sh b/package/network/utils/wireguard-tools/files/wireguard.sh index e8867d65f7..738714e1c6 100644 --- a/package/network/utils/wireguard-tools/files/wireguard.sh +++ b/package/network/utils/wireguard-tools/files/wireguard.sh @@ -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 |