#!/bin/sh

ipv6_dns_on() {
	uci -q delete 'dhcp.@dnsmasq[0].filter_aaaa'
}

ipv6_half_mode() {
	uci -q batch <<-EOF >/dev/null
		del network.wan.ipv6
		del network.wan6.auto

		del dhcp.wan6

		set dhcp.lan.ra='relay'
		del dhcp.lan.ra_slaac
		del dhcp.lan.ra_flags
		set dhcp.lan.dhcpv6='relay'
		set dhcp.lan.ndp='relay'
EOF
	ipv6_dns_on
}

ipv6_half_mode

uci -q batch <<-EOF >/dev/null
	commit dhcp
	commit network
EOF

/etc/init.d/odhcpd reload
/etc/init.d/dnsmasq reload
/etc/init.d/network reload

echo "Done"
