On Thu, Aug 31, 2017 at 11:35 PM, Karl Palsson <ka...@tweak.net.au> wrote: > > > > Daniel Golle <dan...@makrotopia.org> wrote: > >> Hi Karl, > >> > >> On Thu, Aug 31, 2017 at 05:17:38PM +0000, Karl Palsson wrote: > >> > Instead of blindly enabling the odhcpd v6 server and RA server on the > >> > lan port, only do that if the lan port isn't set to DHCP. > >> > > >> > This prevents the unhelpful case of a device being a dhcpv4 > client and > >> > v6 server on the same ethernet port. > >> > >> Generating UCI from presumingly already generated UCI has > >> proven to be a bad practise in the past. See inline for an > >> alternative approach. > > > > Cool with me, the json_load approach is..... kinda opaque still > > at the moment, but if that's the future and meant to be magically > > more stable, awesome. (This file was _already_ looking at "uci -q > > get dhcp.odhcpd" not using any json loading, so... I just > > followed the course) > > > > But the general concept? Is that ok? That's more interesting to > > me :) > I like the idea > I wonder if enabling DHCPv6 and RA as server on interfaces having a > non static protocol is usefull; so can we just check for the protocol > being static to enable DHCPv6 and RA as server ? > > Hans > > > > Sincerely, > > Karl Palsson > > > >> > uci -q get dhcp.odhcpd && exit 0 > >> > touch /etc/config/dhcp > >> > > >> > +LANPROTO=$(uci -q get network.lan.proto) > >> > >> Imho it'd be nicer to read this via > >> ``` > >> . /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 .. > >> ``` > >> > >> > >> > +MODE=server > >> > + > >> > +case "$LANPROTO" in > >> > +"dhcp") > >> > + echo "odhcpd: Not enabling server mode on a dhcp lan!" > > /dev/kmsg > >> > + 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=server > >> > -set dhcp.lan.ra=server > >> > +set dhcp.lan.dhcpv6=$MODE > >> > +set dhcp.lan.ra=$MODE > >> > commit dhcp > >> > EOF > >> > -- > >> > 2.4.11
This is just a consideration, not a complete thought. odhcpd is a light weight server so it doesnt participate with fail over controls (without scripting). But fail-over DHCP severs can configure from the master/acting DHCP sever; then remain on standby until needed. An dynamic LAN protocol could then re-serve on the same interface. - Eric _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev