On Mon, Feb 05, 2024 at 08:47:54PM +0200, Heikki Linnakangas wrote:
> 
> If dnsmasq is used in DHCP-only mode, i.e. --port==0, resolv.conf is
> not used for anything. No need to set up inotify watch on it in that
> case.
> ---
>  src/inotify.c | 2 +-
>  src/dnsmasq.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/inotify.c b/src/inotify.c
> index a944c62..0c775de 100644
> --- a/src/inotify.c
> +++ b/src/inotify.c
> @@ -94,7 +94,7 @@ void inotify_dnsmasq_init()
>    if (daemon->inotifyfd == -1)
>      die(_("failed to create inotify: %s"), NULL, EC_MISC);
>  
> -  if (option_bool(OPT_NO_RESOLV))
> +  if (daemon->port == 0 || option_bool(OPT_NO_RESOLV))

Nice and clean


>      return;
>    
>    for (res = daemon->resolv_files; res; res = res->next)
> diff --git a/src/dnsmasq.c b/src/dnsmasq.c
> index ce897ae..5520511 100644
> --- a/src/dnsmasq.c
> +++ b/src/dnsmasq.c
> @@ -429,8 +429,8 @@ int main (int argc, char **argv)
>      }
>  
>  #ifdef HAVE_INOTIFY
> -  if ((daemon->port != 0 || daemon->dhcp || daemon->doing_dhcp6)
> -      && (!option_bool(OPT_NO_RESOLV) || daemon->dynamic_dirs))
> +  if ((daemon->port != 0 && !option_bool(OPT_NO_RESOLV))
> +      || ((daemon->dhcp || daemon->doing_dhcp6) && daemon->dynamic_dirs))

Mmm, not so clean.  So I didn't give it further attention.



>      inotify_dnsmasq_init();
>    else
>      daemon->inotifyfd = -1;


 
Groeten
Geert "patches should get some feedback" Stappers
-- 
Silence is hard to parse

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to