From 771a894f5a085b4f7d99b16301466305ee73a190 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Tue, 12 May 2026 21:53:00 +0800 Subject: [PATCH] fix: enhance route deletion logic in vpnc-script to handle multiple routes #609 --- packaging/files/usr/libexec/gpclient/vpnc-script | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/files/usr/libexec/gpclient/vpnc-script b/packaging/files/usr/libexec/gpclient/vpnc-script index 92b6051..d14c911 100755 --- a/packaging/files/usr/libexec/gpclient/vpnc-script +++ b/packaging/files/usr/libexec/gpclient/vpnc-script @@ -336,7 +336,11 @@ if [ -n "$IPROUTE" ]; then del_vpngateway_route() { echo "$VPNGATEWAY" | grep -q : && FAMILY=-6 || FAMILY=-4 - $IPROUTE route $route_syntax_del "$VPNGATEWAY" + # iproute2 deletes only one matching route at a time. The connect path may + # add one host route per matching uplink, so remove them until none remain. + while $IPROUTE $FAMILY route $route_syntax_del "$VPNGATEWAY" 2>/dev/null ; do + : + done if [ $FAMILY != -4 ]; then $IPROUTE $FAMILY route flush cache 2>/dev/null fi