#1107738 vpnc-scripts: vpnc-script adds several vpngateway routes, but deletes only one at disconnect

Package:
vpnc-scripts
Source:
vpnc-scripts
Submitter:
Vincent Lefevre
Date:
2026-08-21 16:51:01 UTC
Severity:
normal
Tags:
#1107738#5
Date:
2025-06-13 09:51:07 UTC
From:
To:
I've just reported the following bug upstream:

vpnc-script adds several vpngateway routes, but when disconnecting,
it does a single "ip route del", which has the effect to delete a
single route (though this is ambiguous in the ip-route(8) man page),
not all the routes to the VPN gateway.

For instance, I have the following default routes on my laptop:

default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.13 metric 100
default via 192.168.1.1 dev wlp0s20f3 proto dhcp src 192.168.1.14 metric 600

Connecting with OpenConnect to the Inria VPN after enabling tracing
in vpnc-script gives:

+ set_vpngateway_route
[...]
+ /sbin/ip -4 route add 192.134.164.161 via 192.168.1.1 dev eth0 src 192.168.1.13 metric 100
[...]
+ /sbin/ip -4 route add 192.134.164.161 via 192.168.1.1 dev wlp0s20f3 src 192.168.1.14 metric 600

So, 2 routes to the VPN gateway are added, corresponding to the
2 default routes.

But when disconnecting, I get:

+ del_vpngateway_route
+ /sbin/ip route del 192.134.164.161

which has the effect to delete a single route (apparently always
the first listed one).

The consequence is that after disconnecting, I get a spurious route
in the routing table output by "ip route".

#1107738#10
Date:
2026-08-21 16:48:25 UTC
From:
To:
I've attached the patch I've been using for a year now.

It corresponds to the same change as the one I proposed in the
following merge request:

https://gitlab.com/openconnect/vpnc-scripts/-/merge_requests/79