#!/bin/ash
. /etc/functions.sh

type=$1
if=$(nvram get ${type}_ifname)
if [ "${if%%[0-9]}" = "ppp" ]; then
	if=$(nvram get ${type}_device)
	test -z "$if" && if=$(nvram get pppoe_ifname)
fi

kill $(cat /var/run/${if}.pid 2>&-) 2>&-
ip -f inet addr flush dev $if
ip link set dev $if down
