From e08ac827f673c734aad95d5a90da9b7f4407e550 Mon Sep 17 00:00:00 2001 From: "Sean E. Millichamp" Date: Tue, 4 Aug 2015 13:50:10 -0400 Subject: [PATCH 1/2] Silence errors from 'ip' if device is absent Quiet the scenario where the tun device is already absent by the time the script is invoked and 'ip' emits errors about the absent device. Signed-off-by: Sean E. Millichamp --- vpnc-script | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vpnc-script b/vpnc-script index 2a38bcd..b70011f 100755 --- a/vpnc-script +++ b/vpnc-script @@ -254,7 +254,8 @@ if [ -n "$IPROUTE" ]; then NETWORK="$1" NETMASK="$2" NETMASKLEN="$3" - $IPROUTE route $route_syntax_del "$NETWORK/$NETMASKLEN" dev "$TUNDEV" + # Quiet stderr because interface may no longer exist at this stage: + $IPROUTE route $route_syntax_del "$NETWORK/$NETMASKLEN" dev "$TUNDEV" 2>/dev/null $IPROUTE route flush cache } @@ -780,7 +781,7 @@ do_disconnect() { 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" + $IPROUTE addr del "$INTERNAL_IP4_ADDRESS/255.255.255.255" peer "$INTERNAL_IP4_ADDRESS" dev "$TUNDEV" 2>/dev/null fi # If the netmask is provided, it contains the address _and_ netmask if [ -n "$INTERNAL_IP6_ADDRESS" ] && [ -z "$INTERNAL_IP6_NETMASK" ]; then -- 2.4.3