Openwrt/package/network/services/odhcpd/files/odhcpd.defaults
Hans Dedecker 7ff5b12e90 odhcpd: update to latest git HEAD (FS#2019)
e73bf11 config: ra_management compatibility support
d818380 odhcpd: router: Fix out of scope memory access
94a1c94 dhcpv6-ia: free assignment when validity timer expires
752fc2c router: speed up initial router advertisements
09aa022 router: close socket upon NETEV_IFINDEX_CHANGE fixed
79eb160 router: fix previous commit
6034b5c router: close socket upon NETEV_IFINDEX_CHANGE
000182f router: fix lingering uloop socket descriptor
f6c2242 router: support ra_lifetime being 0
d111809 router: make RA flags configurable (FS#2019)

Update odhcpd defaults according to the new RA flags implementation

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2019-09-12 22:22:29 +02:00

33 lines
759 B
Bash

#!/bin/sh
uci -q get dhcp.odhcpd && exit 0
touch /etc/config/dhcp
. /usr/share/libubox/jshn.sh
json_load "$(cat /etc/board.json)"
json_select network
json_select lan
json_get_vars protocol
json_select ..
json_select ..
case "$protocol" in
# only enable server mode on statically addressed lan ports
"static") [ -e /proc/sys/net/ipv6 ] && MODE=server || MODE=disabled ;;
*) MODE=disabled ;;
esac
uci batch <<EOF
set dhcp.odhcpd=odhcpd
set dhcp.odhcpd.maindhcp=0
set dhcp.odhcpd.leasefile=/tmp/hosts/odhcpd
set dhcp.odhcpd.leasetrigger=/usr/sbin/odhcpd-update
set dhcp.odhcpd.loglevel=4
set dhcp.lan.dhcpv6=$MODE
set dhcp.lan.ra=$MODE
set dhcp.lan.ra_slaac=1
add_list dhcp.lan.ra_flags=managed-config
add_list dhcp.lan.ra_flags=other-config
commit dhcp
EOF