Am 20.05.2017 um 22:50 schrieb Simon Kelley:
> I've just mase the fourth, and probably final, release candidate for
> dnsmasq-27. Please download, compile and run, and report any problems
> ASAP. If all looks OK, 2.77 will happen in the next week.
>
> http://www.thekelleys.org.uk/dnsmasq/release-candidates/dnsmasq-2.77rc4.tar.gz

Three issues during compilation on FreeBSD 10.3 amd64, which look like
genuine bugs, and the forward.c seem critical
- these should likely be "server->flags & SERV_DO_DNSSEC), with & not &&.

> forward.c:902:60: warning: use of logical '&&' with constant operand
> [-Wconstant-logical-operand]
>                                                   
> option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC),
> NULL, NULL);
>                                                                               
>                       
> ^  ~~~~~~~~~~~~~~
> forward.c:902:60: note: use '&' for a bitwise operation
>                                                   
> option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC),
> NULL, NULL);
>                                                                               
>                       
> ^~
>                                                                               
>                       
> &
> forward.c:902:60: note: remove constant to silence this warning
>                                                   
> option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC),
> NULL, NULL);
>                                                                               
>                      
> ~^~~~~~~~~~~~~~~~~
> forward.c:1480:59: warning: use of logical '&&' with constant operand
> [-Wconstant-logical-operand]
>                                           
> option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC),
> NULL, NULL);
>                                                                               
>               
> ^  ~~~~~~~~~~~~~~
> forward.c:1480:59: note: use '&' for a bitwise operation
>                                           
> option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC),
> NULL, NULL);
>                                                                               
>               
> ^~
>                                                                               
>               
> &
> forward.c:1480:59: note: remove constant to silence this warning
>                                           
> option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC),
> NULL, NULL);
>                                                                               
>              
> ~^~~~~~~~~~~~~~~~~
>
> rfc2131.c:839:25: warning: data argument not used by format string
> [-Wformat-extra-args]
>                    service->basename, layer);
>                                       ^

I think you may want to resolve these before 2.77 release time.

And when trying to strip down the build disabling all options I expose
in FreeBSD, I get these, which are cosmetic and, in the option.c case,
are bloat.

The attached patch series (against Git master) fixes these. Use git am
to apply them in given order, and carefully review 0003* whether the
option_len() macro needs to be changed instead.

> option.c:910:23: warning: unused function 'add_rev6' [-Wunused-function]
> static struct server *add_rev6(struct in6_addr *addr, int msize)
>                       ^
>
> network.c:936:24: warning: unused variable 'l6' [-Wunused-variable]
>   struct listener *l, *l6;
>                        ^

You may consider resolving these before 2.77 with proper #ifdefs. I
don't care much.
From 3f0bf25228b5518d42a67a46ebdc4e3751df1d4a Mon Sep 17 00:00:00 2001
From: Matthias Andree <matthias.and...@gmx.de>
Date: Sun, 21 May 2017 12:30:09 +0200
Subject: [PATCH 1/3] Use bit-wise &, not boolean &&...

when checking if server->flags contains SERV_DO_DNSSEC.
---
 src/forward.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/forward.c b/src/forward.c
index 93a2c86..83f392d 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -899,7 +899,7 @@ void reply_query(int fd, int family, time_t now)
 		    status = dnssec_validate_ds(now, header, n, daemon->namebuff, daemon->keyname, forward->class);
 		  else
 		    status = dnssec_validate_reply(now, header, n, daemon->namebuff, daemon->keyname, &forward->class, 
-						   option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC), NULL, NULL);
+						   option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags & SERV_DO_DNSSEC), NULL, NULL);
 		}
 	      
 	      /* Can't validate, as we're missing key data. Put this
@@ -1477,7 +1477,7 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
 	new_status = dnssec_validate_ds(now, header, n, name, keyname, class);
       else 
 	new_status = dnssec_validate_reply(now, header, n, name, keyname, &class,
-					   option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags && SERV_DO_DNSSEC), NULL, NULL);
+					   option_bool(OPT_DNSSEC_NO_SIGN) && (server->flags & SERV_DO_DNSSEC), NULL, NULL);
       
       if (new_status != STAT_NEED_DS && new_status != STAT_NEED_KEY)
 	break;
-- 
2.13.0

From ad3a75d492f78dcab0a040b343df6343a2cc0f3b Mon Sep 17 00:00:00 2001
From: Matthias Andree <matthias.and...@gmx.de>
Date: Sun, 21 May 2017 12:36:25 +0200
Subject: [PATCH 2/3] Fix format string/argument list mismatch warning.

---
 src/rfc2131.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/rfc2131.c b/src/rfc2131.c
index 484eeaa..da69fef 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -834,9 +834,12 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
 	  else
 	    mess->siaddr = context->local; 
 	  
-	  snprintf((char *)mess->file, sizeof(mess->file), 
-		   strchr(service->basename, '.') ? "%s" :"%s.%d", 
-		   service->basename, layer);
+	  if (strchr(service->basename, '.'))
+	    snprintf((char *)mess->file, sizeof(mess->file),
+		"%s.%d", service->basename, layer);
+	  else
+	    snprintf((char *)mess->file, sizeof(mess->file),
+		"%s", service->basename);
 	  
 	  option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPACK);
 	  option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, htonl(context->local.s_addr));
-- 
2.13.0

From 7767a6112e08bd36afff7d1a559286f4e8c0038f Mon Sep 17 00:00:00 2001
From: Matthias Andree <matthias.and...@gmx.de>
Date: Sun, 21 May 2017 12:36:11 +0200
Subject: [PATCH 3/3] Fix sign mismatch in comparison.

Note that perhaps the option_len macro might need to be changed.
---
 src/rfc2131.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rfc2131.c b/src/rfc2131.c
index da69fef..dcde5b4 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -383,12 +383,12 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
 	    {
 	      len = option_uint(opt, offset + 4 , 1);
 	      /* Need to take care that bad data can't run us off the end of the packet */
-	      if ((offset + len + 5 <= (option_len(opt))) &&
+	      if ((offset + len + 5 <= (unsigned)(option_len(opt))) &&
 		  (option_uint(opt, offset, 4) == (unsigned int)o->u.encap))
 		for (o2 = offset + 5; o2 < offset + len + 5; o2 += elen + 1)
 		  { 
 		    elen = option_uint(opt, o2, 1);
-		    if ((o2 + elen + 1 <= option_len(opt)) &&
+		    if ((o2 + elen + 1 <= (unsigned)option_len(opt)) &&
 			(match = match_bytes(o, option_ptr(opt, o2 + 1), elen)))
 		      break;
 		  }
-- 
2.13.0

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to