blob: 576e2925399867af583bddcc2597ff5171f946a5 [file] [log] [blame]
#!/bin/sh
wan_port=$(cat /etc/config/wanport)
lan_port=$(cat /etc/config/lanport)
mgmt_vlan=$(cat /etc/config/mgmtvlan)
hostname GFiberONU
case $1 in
start)
echo "Starting WAN."
# Creating this file tells the dhclient-script that it is okay to use
# IPv6 DNS. There's a bug in older uclib's that causes memory corruption
# and a crash, but it's fixed in Marvell's version 0.9.32.
echo 1 >/tmp/ipv6_dns_ok
# Configure dhclient with the right hostname etc.
setup-dhclient
echo "Starting interface."
ifup "$wan_port"
echo "Configuring data path."
if [ -z "$lan_port" ]; then
lan_arg=""
else
lan_arg="-l $lan_port"
fi
if runnable glaser; then
if [ -z "$mgmt_vlan" ]; then
# TODO(apenwarr): we should never rely on arbitrary delays like this.
sleep 3 && tpmadm -w "$wan_port" $lan_arg -v
else
sleep 3 && tpmadm -w "$wan_port" $lan_arg -m "$mgmt_vlan" -v
ip link add link "$wan_port" name man type vlan id "$mgmt_vlan"
fi
elif runnable start_sycl; then
echo "Starting sycl"
ip link add link pon0 name man type vlan id "$mgmt_vlan"
ifup man
start_sycl 2>&1 | logos sycl &
fi
;;
stop)
echo -n "Stopping WAN..."
if [ -n "$mgmt_vlan" ]; then
ifdown man
ip link del man
fi
ifdown "$wan_port"
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac