On Sun, Jun 17, 2018 at 4:57 PM Matthias Schiffer
<mschif...@universe-factory.net> wrote:
>
> On 05/08/2018 12:37 AM, hux wrote:
> > Signed-off-by: hux <xinxing.hu...@gmail.com>
> > ---
> > Right now interface.update events are sent out by netifd upon interface 
> > state, route, address (lifetime), prefix lifetime changes. Dnsmasq is only 
> > interested in interface state changes and currently adds an interface 
> > trigger for all the "interface.*" events.
> >
> > In combination with commit 23bba9cb330, which triggers a SIGHUP signal to 
> > dnsmasq, IPv6 address/prefix lifetime changes on the wan will trigger 
> > dnsmasq reloads which can become frequent in case of shorter lifetimes.
> >
> > To avoid frequent dnsmasq reload, this patch adds specific interface 
> > triggers. During dnsmasq init, it loops dhcp uci section. If the value of 
> > the ignore option is set to 0, then the corresponding interface trigger is 
> > not installed. Otherwise, if the ignore option value is 1, then 
> > procd_add_interface_trigger is called and the trigger is added.
>
> Together with the '[ -n "$BOOT" ] && return' line in service_start(), this
> patch breaks the start of dnsmasq when no DHCP interfaces are configured in
> /etc/config/dhcp (i.e., dnsmasq is used for DNS only).
>
> I'd argue that DNS should always work (serving statically configured
> records when nothing else is available) even when no interfaces are up, so
> maybe the '[ -n "$BOOT" ] && return' should simply be removed? CCing Hans,
> he has a better grasp of the dnsmasq init script than me.
Hi Matthias,

I will look into the issue in the coming days; DNS should indeed
always work even if no dhcp interfaces are configured.

Hans
>
> Regards,
> Matthias
>
>
>
> >
> >  package/network/services/dnsmasq/Makefile           |  2 +-
> >  package/network/services/dnsmasq/files/dnsmasq.init | 14 +++++++++++++-
> >  2 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/package/network/services/dnsmasq/Makefile 
> > b/package/network/services/dnsmasq/Makefile
> > index b6502bf5d0..60ed9ed6fb 100644
> > --- a/package/network/services/dnsmasq/Makefile
> > +++ b/package/network/services/dnsmasq/Makefile
> > @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=dnsmasq
> >  PKG_VERSION:=2.79
> > -PKG_RELEASE:=3
> > +PKG_RELEASE:=4
> >
> >  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
> >  PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/
> > diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
> > b/package/network/services/dnsmasq/files/dnsmasq.init
> > index 1881b2bcdc..2c71a777c3 100644
> > --- a/package/network/services/dnsmasq/files/dnsmasq.init
> > +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> > @@ -1042,10 +1042,22 @@ dnsmasq_stop()
> >       rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp
> >  }
> >
> > +add_interface_trigger()
> > +{
> > +     local interface ignore
> > +
> > +     config_get interface "$1" interface
> > +     config_get_bool ignore "$1" ignore 0
> > +
> > +     [ -n "$interface" -a $ignore -eq 0 ] && procd_add_interface_trigger 
> > "interface.*" "$interface" /etc/init.d/dnsmasq reload
> > +}
> > +
> >  service_triggers()
> >  {
> >       procd_add_reload_trigger "dhcp" "system"
> > -     procd_add_raw_trigger "interface.*" 2000 /etc/init.d/dnsmasq reload
> > +
> > +     config_load dhcp
> > +     config_foreach add_interface_trigger dhcp
> >  }
> >
> >  boot()
> >
>
>

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

Reply via email to