# Set net.<iface>.winsN properties that contain the
# WINS server addresses given by the DHCP server.

set_wins_props()
{
    case "${new_netbios_name_servers}" in
    "")   return 0;;
    esac
    count=1
    for i in 1 2; do
        setprop dhcp.${interface}.wins${i} ""
    done

    count=1
    for winsaddr in ${new_netbios_name_servers}; do
        setprop dhcp.${interface}.wins${count} ${winsaddr}
        count=$(($count + 1))
    done
}

unset_wins_props()
{
    for i in 1 2; do
        setprop dhcp.${interface}.wins${i} ""
    done
}

case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|IPV4LL)       set_wins_props;;
EXPIRE|FAIL|RELEASE|STOP)                unset_wins_props;;
esac
