#!/bin/sh
exit 0 # This script breaks ppp accounting

[ "$LINKNAME" ] || exit 0

PATH=/bin:/usr/sbin:$PATH
if ip link show dev $LINKNAME >/dev/null;then
	logger "$0: interface '$LINKNAME' already exists, cannot rename '$IFNAME'."
	exit 0
fi

if ip route | grep -qE "^default.*dev $IFNAME *$"; then DEFAULT_ROUTE=1; fi

ip link set $IFNAME down
ip link set $IFNAME name $LINKNAME
ip link set $LINKNAME up
if [ -n "$DEFAULT_ROUTE" ]; then ip route add default via $IPREMOTE; fi
