#!/bin/bash
#
# Turn off given network interface and remove all its flags from Dracut.
#
# Author: Jiri Konecny
#

netif="$1"
# ip down/flush ensures that routing info goes away as well
ip link set $netif down
ip addr flush dev $netif
rm -f -- /tmp/*.$netif.*
if [ -e /sys/class/net/$netif/address ]; then
    address=$(cat /sys/class/net/$netif/address)
    rm -f -- /tmp/*.$address.*
fi
