[OpenWrt-Devel] [PATCH] odhcpd: add network dependent start trigger

Hans Dedecker dedeckeh at gmail.com
Mon Feb 25 02:46:03 EST 2019


Hi,
On Sun, Feb 24, 2019 at 7:06 AM Eric Luehrsen <ericluehrsen at gmail.com> wrote:
>
> Recent (20190207) changes to odhcpd makee it dependent on OpenWrt
> logical interfaces. Boot time race conditions may make odhcpd binding

Even before the most recent changes odhcpd was dependent on OpenWRT logical
interfaces nothing has changed in that sense
> a challenge. Intermittent or inconsistent problems can occur with DHCP
> requests until odhcpd is restarted. Change start up scripts to use

Can you elaborate a bit more on what issues you're observing and provide odhcpd
tracing  (loglevel 7) when you observe issues ?
> procd interface triggers such as dnsmasq and others have already.

This does not really make sense to me as odhcpd is subscribed to ubus
network event
messages triggering config reload logic in case the network state of
an interface changes

Hans
>
> Signed-off-by: Eric Luehrsen <ericluehrsen at gmail.com>
> ---
>   .../network/services/odhcpd/files/odhcpd.init | 20 +++++++++++++++++--
>   1 file changed, 18 insertions(+), 2 deletions(-)
>
> --- a/package/network/services/odhcpd/files/odhcpd.init
> +++ b/package/network/services/odhcpd/files/odhcpd.init
> @@ -1,10 +1,20 @@
>   #!/bin/sh /etc/rc.common
>
> -START=35
> +START=19
>   STOP=85
>   USE_PROCD=1
>
> +boot() {
> +       ODHCPD_BOOT=1
> +       start "$@"
> +}
> +
>   start_service() {
> +       if [ -n "$ODHCPD_BOOT" ] ; then
> +               # odhcpd needs to wait for OpenWrt logical interfaces
> +               return 0
> +       fi
> +
>         procd_open_instance
>         procd_set_param command /usr/sbin/odhcpd
>         procd_set_param respawn
> @@ -17,6 +27,12 @@ reload_service() {
>
>   service_triggers()
>   {
> -       procd_add_reload_trigger "dhcp"
> +       if [ -n "$ODHCPD_BOOT" ] ; then
> +               # one time trigger at boot to wait for logical interface setup
> +               procd_add_raw_trigger "interface.*.up" 3000 /etc/init.d/odhcpd restart
> +       else
> +               # reload odhcpd also for network reconfiguration
> +               procd_add_reload_trigger "dhcp" "network"
> +       fi
>   }
>
> --
> 2.20.1
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list