#!/bin/sh

[ "x$IFACE" = "xlo" ] && exit 0
[ "x$IFACE" = "x--all" ] && exit 0
interface=$(grep -E "^#?\s*iface\s+${IFACE}\s+inet6\s+.*$" /etc/network/interfaces)
if [ -z "$interface" ]; then
    odhcp6c -Nnone -d -p /var/run/odhcp6c.${IFACE}.pid ${IFACE}
elif echo "$interface" | grep -q "^#"; then
    sysctl -w net.ipv6.conf.${IFACE}.disable_ipv6=1
else
    sysctl -w net.ipv6.conf.${IFACE}.disable_ipv6=0
fi
exit 0

