]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
vpnc-script: use iproute to create ptp link if possible
authorDave Reisner <dreisner@archlinux.org>
Mon, 15 Aug 2011 00:39:11 +0000 (20:39 -0400)
committerDave Reisner <dreisner@archlinux.org>
Mon, 15 Aug 2011 00:42:09 +0000 (20:42 -0400)
This should make net-tools completely optional on Linux.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
vpnc-script

index 0b4a4ee3fd393d1f74ae4bc3bf6e53c64c833c25..3c534e478b63340251e461a1f26ec01db1ea3fa9 100755 (executable)
@@ -107,7 +107,12 @@ do_ifconfig() {
        fi
 
        # Point to point interface require a netmask of 255.255.255.255 on some systems
-       ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu ${MTU} up
+       if [ -n "$IPROUTE" ]; then
+               $IPROUTE link set dev "$TUNDEV" up mtu "$MTU"
+               $IPROUTE addr add "$INTERNAL_IP4_ADDRESS/255.255.255.255" peer "$INTERNAL_IP4_ADDRESS" dev "$TUNDEV"
+       else
+               ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu ${MTU} up
+       fi
 
        if [ -n "$INTERNAL_IP4_NETMASK" ]; then
                set_network_route $INTERNAL_IP4_NETADDR $INTERNAL_IP4_NETMASK $INTERNAL_IP4_NETMASKLEN