This enables persist tun device to be reused in future
connections.
ipv6 is not tested.
Maybe it would be cleaner to define functions for address
manipulation, not sure.
To be simple, this patch only handles iproute2.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
vpnc-script | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/vpnc-script b/vpnc-script
index c8483ee..1af6f4d 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -726,6 +726,20 @@ do_disconnect() {
if [ -n "$INTERNAL_IP4_DNS" ]; then
$RESTORERESOLVCONF
fi
+
+ if [ -n "$IPROUTE" ]; then
+ if [ -n "$INTERNAL_IP4_ADDRESS" ]; then
+ $IPROUTE addr del "$INTERNAL_IP4_ADDRESS/255.255.255.255" peer "$INTERNAL_IP4_ADDRESS" dev "$TUNDEV"
+ fi
+ # If the netmask is provided, it contains the address _and_ netmask
+ if [ -n "$INTERNAL_IP6_ADDRESS" ] && [ -z "$INTERNAL_IP6_NETMASK" ]; then
+ INTERNAL_IP6_NETMASK="$INTERNAL_IP6_ADDRESS/128"
+ fi
+ if [ -n "$INTERNAL_IP6_NETMASK" ]; then
+ $IPROUTE -6 addr del $INTERNAL_IP6_NETMASK dev $TUNDEV
+ fi
+ fi
+
destroy_tun_device
}
--
1.8.3.2
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
connections.
ipv6 is not tested.
Maybe it would be cleaner to define functions for address
manipulation, not sure.
To be simple, this patch only handles iproute2.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
vpnc-script | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/vpnc-script b/vpnc-script
index c8483ee..1af6f4d 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -726,6 +726,20 @@ do_disconnect() {
if [ -n "$INTERNAL_IP4_DNS" ]; then
$RESTORERESOLVCONF
fi
+
+ if [ -n "$IPROUTE" ]; then
+ if [ -n "$INTERNAL_IP4_ADDRESS" ]; then
+ $IPROUTE addr del "$INTERNAL_IP4_ADDRESS/255.255.255.255" peer "$INTERNAL_IP4_ADDRESS" dev "$TUNDEV"
+ fi
+ # If the netmask is provided, it contains the address _and_ netmask
+ if [ -n "$INTERNAL_IP6_ADDRESS" ] && [ -z "$INTERNAL_IP6_NETMASK" ]; then
+ INTERNAL_IP6_NETMASK="$INTERNAL_IP6_ADDRESS/128"
+ fi
+ if [ -n "$INTERNAL_IP6_NETMASK" ]; then
+ $IPROUTE -6 addr del $INTERNAL_IP6_NETMASK dev $TUNDEV
+ fi
+ fi
+
destroy_tun_device
}
--
1.8.3.2
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/