Simon Kelley [Fri, 16 Sep 2022 11:58:41 +0000 (12:58 +0100)]
Add ClearMetrics Dbus method.
Simon Kelley [Fri, 16 Sep 2022 11:07:01 +0000 (12:07 +0100)]
Optimise cache code when stale caching in use.
Exclude DNSSEC entries from stale caching.
Simon Kelley [Fri, 16 Sep 2022 08:35:44 +0000 (09:35 +0100)]
Don't exclude stale-cache answers from "local answered" metric.
Simon Kelley [Thu, 15 Sep 2022 23:16:18 +0000 (00:16 +0100)]
Initialise modified-moving-average latency calc better.
Use the first value, rather than initialising at zero,
which takes many queries to converge.
Simon Kelley [Thu, 15 Sep 2022 23:07:36 +0000 (00:07 +0100)]
Split failed queries in retries in stat counting.
Simon Kelley [Thu, 15 Sep 2022 22:54:53 +0000 (23:54 +0100)]
Tweak server-selection logic in the fast-retry case.
Simon Kelley [Thu, 15 Sep 2022 22:22:02 +0000 (23:22 +0100)]
Keep a per-DNS-server moving average of query latency.
Simon Kelley [Thu, 15 Sep 2022 21:43:08 +0000 (22:43 +0100)]
Combine server stats from all records for the same server in DBUS method.
The DBUS per-server stats method should combine the stats from
different records (for different domains) in the same way at the
logging code.
Simon Kelley [Thu, 15 Sep 2022 21:29:44 +0000 (22:29 +0100)]
Count NXDOMAIN replies from each server.
Simon Kelley [Thu, 15 Sep 2022 21:06:39 +0000 (22:06 +0100)]
Add metric for queries which never see an answer.
Simon Kelley [Wed, 14 Sep 2022 15:16:08 +0000 (16:16 +0100)]
Make fast-retry more configurable and do exponential backoff.
Simon Kelley [Tue, 13 Sep 2022 08:36:08 +0000 (09:36 +0100)]
Remove unused vars.
Simon Kelley [Mon, 12 Sep 2022 14:28:46 +0000 (15:28 +0100)]
Return EDE_STALE extended error when returning stale data from cache.
Simon Kelley [Mon, 12 Sep 2022 13:50:17 +0000 (14:50 +0100)]
Add stale cache replies to metrics.
Simon Kelley [Mon, 12 Sep 2022 13:35:40 +0000 (14:35 +0100)]
Add GetServerMetrics method to DBus interface.
Simon Kelley [Fri, 9 Sep 2022 17:18:46 +0000 (18:18 +0100)]
Further optimisation of --port-limit.
No longer try and fail to open every port when the port range
is in complete use; go straight to re-using an existing socket.
Die at startup if port range is smaller than --port-limit, since
the code behaves badly in this case.
Simon Kelley [Fri, 9 Sep 2022 16:09:32 +0000 (17:09 +0100)]
Second try at port-limit option.
1) It's expected to fail to bind a new source port when they
are scarce, suppress warning in log in this case.
2) Optimse bind_local when max_port - min_port is small. There's no
randomness in this case, so we try all possible source ports
rather than poking at random ones for an arbitrary number of tries.
3) In allocate_rfd() handle the case that all available source ports
are already open. In this case we need to pick an existing
socket/port to use, such that it has a different port from any we
already hold. This gives the required property that the set of ports
utilised by any given query is set by --port-limit and we don't
re-use any until we have port-limit different ones.
Simon Kelley [Fri, 9 Sep 2022 14:56:54 +0000 (15:56 +0100)]
Fix namebuff overwrite leading to wrong log after socket bind warning.
Simon Kelley [Tue, 6 Sep 2022 21:09:21 +0000 (22:09 +0100)]
Remove fast-retry development logging.
Simon Kelley [Mon, 29 Aug 2022 20:44:05 +0000 (21:44 +0100)]
Add --use-stale-cache option.
Simon Kelley [Sun, 21 Aug 2022 17:07:17 +0000 (18:07 +0100)]
Add --fast-dns-retry option.
This gives dnsmasq the ability to originate retries for upstream DNS
queries itself, rather than relying on the downstream client. This is
most useful when doing DNSSEC over unreliable upstream network. It
comes with some cost in memory usage and network bandwidth.
Simon Kelley [Wed, 17 Aug 2022 14:33:15 +0000 (15:33 +0100)]
Add --port-limit option.
By default, when sending a query via random ports to multiple upstream servers or
retrying a query dnsmasq will use a single random port for all the tries/retries.
This option allows a larger number of ports to be used, which can increase robustness
in certain network configurations. Note that increasing this to more than
two or three can have security and resource implications and should only
be done with understanding of those.
Simon Kelley [Tue, 6 Sep 2022 21:40:06 +0000 (22:40 +0100)]
Add DHCPv4 option 108 "ipv6-only" to the options table.
Simon Kelley [Fri, 19 Aug 2022 12:28:00 +0000 (13:28 +0100)]
Fix logic when a SERVFAIL reply is received after good replt for DNSSEC.
If we get a SERVFAIL or REFUSED answer to a DNSSEC query for which
we already have a good answer, just ignore it.
Simon Kelley [Tue, 6 Sep 2022 17:08:39 +0000 (18:08 +0100)]
Add source address to RA packet dumps.
Simon Kelley [Tue, 6 Sep 2022 14:40:42 +0000 (15:40 +0100)]
Fix DHCPv6 relay to use a more sensble source address.
Tweak things so that packets relayed towards a server
have source address on the server-facing network, not the
client-facing network. Thanks to Luis Thomas for spotting this
and initial patch.
Simon Kelley [Tue, 6 Sep 2022 14:35:54 +0000 (15:35 +0100)]
Free sockets awaiting upstream DNS replies ASAP.
Once we have a good answer, close the socket so that the fd can
be reused during DNSSEC validation and we don't have to read and
discard more replies from other servers.
Simon Kelley [Mon, 5 Sep 2022 17:04:35 +0000 (18:04 +0100)]
Tweak packet dump code to make port numbers more accurate.
Also add query-ids with log-queries=extra.
Simon Kelley [Thu, 11 Aug 2022 16:04:54 +0000 (17:04 +0100)]
Simplify realloc use in poll.c
Petr Menšík [Mon, 18 Jul 2022 11:30:07 +0000 (13:30 +0200)]
Introduce whine_realloc
Move few patters with whine_malloc, if (successful) copy+free, to a new
whine_realloc. It should do the same thing, but with a help from OS it
can avoid unnecessary copy and free if allocation of more data after
current data is possible.
Added few setting remanining space to 0, because realloc does not use
calloc like whine_malloc does. There is no advantage of zeroing what we
will immediately overwrite. Zero only remaining space.
Simon Kelley [Mon, 8 Aug 2022 14:36:47 +0000 (15:36 +0100)]
CHANGELOG typo.
Simon Kelley [Mon, 8 Aug 2022 14:27:32 +0000 (15:27 +0100)]
Fix bad interaction between --address=/#/<ip> and --server=/some.domain/#
This would return <ip> for queries in some.domain, rather than
forwarding the query via the default server(s) read from /etc/resolv.conf.
Bertie, Taylor [Sun, 31 Jul 2022 16:20:21 +0000 (17:20 +0100)]
Bound the value of UDP packet size in the EDNS0 header of
forwarded queries to the configured or default value of
edns-packet-max. There's no point letting a client set a larger
value if we're unable to return the answer.
Simon Kelley [Sun, 31 Jul 2022 11:15:38 +0000 (12:15 +0100)]
Update man page on DHCP data provided to scripts. Provide requested options for DHCPv6 also.
Simon Kelley [Sun, 31 Jul 2022 10:33:05 +0000 (11:33 +0100)]
Fix bit-rotted data handling code for LUA scripts.
Simon Kelley [Sun, 31 Jul 2022 10:04:12 +0000 (11:04 +0100)]
Tidy last two commits.
Kevin Yeich [Sat, 9 Jul 2022 19:46:36 +0000 (19:46 +0000)]
Pass MUD URLs (RFC 8520) supplied via DHCPv4 to DHCP scripts
Extract Manufacturer Usage Description (MUD) URL from DHCP Option 161
and make it available to DHCP scripts as DNSMASQ_MUD_URL.
See https://datatracker.ietf.org/doc/html/rfc8520#section-17.3
and https://datatracker.ietf.org/doc/html/rfc8520#section-10
Co-authored-by: Jasper Wiegratz <wiegratz@uni-bremen.de>
Hugo Hakim Damer [Sat, 9 Jul 2022 19:45:51 +0000 (19:45 +0000)]
Pass MUD URLs (RFC 8520) supplied via DHCPv6 to DHCP scripts
Extract Manufacturer Usage Description (MUD) URL from DHCP Option 112
and make it available to DHCP scripts as DNSMASQ_MUD_URL.
This expands on the initial support for Manufacturer Usage Description
URLs that has been added in the previous commit for DHCPv4 by also
supporting MUD URLs supplied using DHCPv6.
See https://datatracker.ietf.org/doc/html/rfc8520#section-17.3
and https://datatracker.ietf.org/doc/html/rfc8520#section-10
Co-authored-by: Jasper Wiegratz <wiegratz@uni-bremen.de>
Simon Kelley [Tue, 19 Jul 2022 22:40:50 +0000 (23:40 +0100)]
Merge branch 'master' of ssh://thekelleys.org.uk/var/local/git/dnsmasq
Simon Kelley [Tue, 19 Jul 2022 22:40:11 +0000 (23:40 +0100)]
Fix comment typo.
Simon Kelley [Thu, 7 Jul 2022 19:56:07 +0000 (20:56 +0100)]
Fix comment typo.
Beniamino Galvani [Fri, 27 May 2022 20:16:18 +0000 (21:16 +0100)]
Fix parsing of IPv6 addresses with peer from netlink.
In the most common case, an IPv6 address doesn't have a peer and the
IFA_ADDRESS netlink attribute contains the address itself.
But if the address has a peer (typically for point to point links),
then IFA_ADDRESS contains the peer address and IFA_LOCAL contains the
address [1].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv6/addrconf.c?h=v5.17#n5030
Fix the parsing of IPv6 addresses with peers, as currently dnsmasq
unsuccessfully tries to bind on the peer address.
A simple reproducer is:
dnsmasq --conf-file=/dev/null -i dummy1 -d --bind-dynamic &
sleep 2
ip link add dummy1 type dummy
ip link set dummy1 up
ip addr add dev dummy1 fd01::1/64 peer fd01::2/64
ip addr add dev dummy1 fd01::42/64
sleep 2
ss -lnp | grep dnsmasq | grep fd01
Before the patch:
dnsmasq: failed to create listening socket for fd01::2: Cannot assign requested address
dnsmasq: failed to create listening socket for fd01::2: Cannot assign requested address
udp UNCONN 0 [fd01::42]:53 [::]:* users:(("dnsmasq",pid=23947,fd=14))
tcp LISTEN 0 [fd01::42]:53 [::]:* users:(("dnsmasq",pid=23947,fd=15
After:
udp UNCONN 0 [fd01::42]:53 [::]:* users:(("dnsmasq",pid=23973,fd=16))
udp UNCONN 0 [fd01::1]:53 [::]:* users:(("dnsmasq",pid=23973,fd=14))
tcp LISTEN 0 [fd01::42]:53 [::]:* users:(("dnsmasq",pid=23973,fd=17))
tcp LISTEN 0 [fd01::1]:53 [::]:* users:(("dnsmasq",pid=23973,fd=15))
Simon Kelley [Thu, 26 May 2022 15:40:44 +0000 (16:40 +0100)]
Add the ability to specify destination port in DHCP-relay mode.
This change also removes a previous bug
where --dhcp-alternate-port would affect the port used
to relay _to_ as well as the port being listened on.
The new feature allows configuration to provide bug-for-bug
compatibility, if required. Thanks to Damian Kaczkowski
for the feature suggestion.
Simon Kelley [Thu, 26 May 2022 13:49:10 +0000 (14:49 +0100)]
Fix outdated comment.
Petr Menšík [Fri, 13 May 2022 20:22:11 +0000 (21:22 +0100)]
Update GNU GPL file.
Dominik Derigs [Sat, 2 Apr 2022 19:45:47 +0000 (21:45 +0200)]
Also log upstream port for dnssec-retry
Signed-off-by: DL6ER <dl6er@dl6er.de>
袁建鹏 [Mon, 18 Apr 2022 14:25:54 +0000 (15:25 +0100)]
Add inode compare while checking resolv file change
Fix a bug found on OpenWrt when IPv4/6 dual stack enabled:
The resolv file is located on tmpfs whose mtime resolution
is 1 second. If the resolv file is updated twice within one
second dnsmasq may can't notice the second update.
netifd updates the resolv file with method: write temp then move,
so adding an inode check fixes this bug.
Simon Kelley [Thu, 31 Mar 2022 20:35:20 +0000 (21:35 +0100)]
Fix write-after-free error in DHCPv6 code. CVE-2022-0934 refers.
Simon Kelley [Tue, 22 Mar 2022 13:47:05 +0000 (13:47 +0000)]
Add DNSMASQ_DATA_MISSING envvar to lease-change script.
Simon Kelley [Sat, 5 Mar 2022 18:13:15 +0000 (18:13 +0000)]
Manpage update for --localise-queries.
Thanks to Leonardo Romor for the suggestion.
Simon Kelley [Sat, 5 Mar 2022 18:07:07 +0000 (18:07 +0000)]
Enhance --domain to accept, interface names for the address range.
This allows hosts get a domain which relects the interface they
are attached to in a way which doesn't require hard-coding addresses.
Thanks to Sten Spans for the idea.
Simon Kelley [Sat, 5 Mar 2022 16:31:17 +0000 (16:31 +0000)]
Merge branch 'master' of ssh://thekelleys.org.uk/var/local/git/dnsmasq
Conrad Kostecki [Wed, 2 Mar 2022 19:28:26 +0000 (19:28 +0000)]
Update German translation.
Simon Kelley [Thu, 24 Feb 2022 23:21:55 +0000 (23:21 +0000)]
Merge branch 'master' of ssh://thekelleys.org.uk/var/local/git/dnsmasq
Simon Kelley [Thu, 24 Feb 2022 23:18:54 +0000 (23:18 +0000)]
Fix memory leak when DBUS connection fails.
Simon Kelley [Tue, 22 Feb 2022 21:56:48 +0000 (21:56 +0000)]
Fix longjump() compiler warnings.
Simon Kelley [Fri, 18 Feb 2022 20:53:56 +0000 (20:53 +0000)]
Fix missing reverse-records from --dynamic-host.
Thanks to Sten Spans for spotting the bug.
Simon Kelley [Tue, 8 Feb 2022 11:37:06 +0000 (11:37 +0000)]
Add --conf-script
Simon Kelley [Fri, 4 Feb 2022 22:28:53 +0000 (22:28 +0000)]
Merge branch 'master' of ssh://thekelleys.org.uk/var/local/git/dnsmasq
Simon Kelley [Fri, 4 Feb 2022 22:24:00 +0000 (22:24 +0000)]
Ask netlink for new address events unconditionally.
The circumstances under which actions occur depending on
configuration is now controlled only by newaddress() in network.c
Simon Kelley [Fri, 4 Feb 2022 21:00:16 +0000 (21:00 +0000)]
Merge branch 'master' of ssh://thekelleys.org.uk/var/local/git/dnsmasq
Johnny S. Lee via Dnsmasq-discuss [Thu, 3 Feb 2022 23:42:00 +0000 (23:42 +0000)]
Fix FTBFS on BSD platforms.
Bug introduced in
fc664d114d6e11ced4912b746f18d543f662066b
Simon Kelley [Thu, 3 Feb 2022 17:12:38 +0000 (17:12 +0000)]
Handle changing interface indexes when binding DHCP sockets.
Simon Kelley [Wed, 2 Feb 2022 18:31:22 +0000 (18:31 +0000)]
Merge branch 'master' of ssh://thekelleys.org.uk/var/local/git/dnsmasq
Simon Kelley [Tue, 1 Feb 2022 00:18:44 +0000 (00:18 +0000)]
Improve the performance of DHCP relay.
On machines with many interfaces, enumerating them
via netlink on each packet reciept is slow,
and unneccesary. All we need is the local address->interface
mapping, which can be cached in the relay structures.
Simon Kelley [Sun, 30 Jan 2022 00:42:46 +0000 (00:42 +0000)]
Dump.c Fix IPv6 checksum on big-endian.
Simon Kelley [Sat, 29 Jan 2022 23:22:52 +0000 (23:22 +0000)]
Handle options other than source link-layer address in router solicitations.
RFC 4861 para 4.1 is a MUST.
Simon Kelley [Sat, 29 Jan 2022 22:52:21 +0000 (22:52 +0000)]
Extend packet dump system to RA.
Simon Kelley [Sat, 29 Jan 2022 15:55:04 +0000 (15:55 +0000)]
Extend packet-dump system to DHCP and TFTP.
Simon Kelley [Mon, 24 Jan 2022 15:19:00 +0000 (15:19 +0000)]
Bump copyright to 2022.
Simon Kelley [Fri, 21 Jan 2022 15:41:53 +0000 (15:41 +0000)]
Tidy iface_check().
Olaf Hering [Wed, 19 Jan 2022 13:58:50 +0000 (14:58 +0100)]
fix dnsmasq typo in man page
Fixes commit
27ce754b3d7f2f0c297b0cede6b7ae57b0a0a0a5
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Simon Kelley [Fri, 21 Jan 2022 12:07:42 +0000 (12:07 +0000)]
Fix indentation in Umbrella option code.
Simon Kelley [Tue, 18 Jan 2022 00:55:13 +0000 (00:55 +0000)]
Fix crash in PXE code with bad config.
Simon Kelley [Tue, 18 Jan 2022 00:32:15 +0000 (00:32 +0000)]
Debian bug management.
Simon Kelley [Tue, 18 Jan 2022 00:02:32 +0000 (00:02 +0000)]
Debian: fold in 2.86-1.1 changelog and close bug introducded by same.
Simon Kelley [Mon, 17 Jan 2022 23:54:58 +0000 (23:54 +0000)]
Remove temporary debugging message and close related Debian bug.
Simon Kelley [Mon, 17 Jan 2022 16:01:02 +0000 (16:01 +0000)]
Document change of behaviour of --address in 2.86 onwards.
Simon Kelley [Sat, 15 Jan 2022 17:57:57 +0000 (17:57 +0000)]
Tidy previous commit and add manpage entries for new options.
Dominik Derigs [Fri, 7 Jan 2022 05:11:53 +0000 (06:11 +0100)]
Strip EDNS(0) Client Subnet / MAC information if --strip-subnet or --strip-mac is set. If both the add and strip options are set, incoming EDNS0 options are replaced. This ensures we do not unintentionally forward client information somewhere upstream when ECS is used in lower DNS layers in our local network.
Signed-off-by: DL6ER <dl6er@dl6er.de>
Dominik Derigs [Tue, 28 Dec 2021 10:03:40 +0000 (11:03 +0100)]
Minimum safe size is recommended to be 1232. See https://dnsflagday.net/2020/
Signed-off-by: DL6ER <dl6er@dl6er.de>
Simon Kelley [Thu, 13 Jan 2022 00:12:07 +0000 (00:12 +0000)]
Fix DNSSEC failure to validate unsigned NoDATA replies.
A reply with an empty answer section would not always be checked
for either suitable NSEC records or proof of non-existence of
the relevant DS record.
Simon Kelley [Wed, 12 Jan 2022 23:05:25 +0000 (23:05 +0000)]
Simon Kelley [Wed, 12 Jan 2022 23:00:16 +0000 (23:00 +0000)]
Petr Menšík [Mon, 10 Jan 2022 11:34:42 +0000 (12:34 +0100)]
Add root group writeable flag to log file
Some systems strips even root process capability of writing to different
users file. That include systemd under Fedora. When
log-facility=/var/log/dnsmasq.log is used, log file with mode 0640
is created. But restart then fails, because such log file can be used
only when created new. Existing file cannot be opened by root when
starting, causing fatal error. Avoid that by adding root group writeable flag.
Ensure group is always root when granting write access. If it is
anything else, administrator has to configure correct rights.
Simon Kelley [Tue, 11 Jan 2022 22:48:14 +0000 (22:48 +0000)]
Fix FTBFS when HAVE_DNSSEC not defined.
Simon Kelley [Tue, 11 Jan 2022 22:36:01 +0000 (22:36 +0000)]
Log source of ignored query when local-service is used.
Thanks to Dominik Derigs for the initial patch.
Dominik Derigs [Thu, 30 Dec 2021 09:53:24 +0000 (10:53 +0100)]
Extend cache dump: "!" as type for non-terminals, new flag "C" for config-provided and log source when applicable.
Signed-off-by: DL6ER <dl6er@dl6er.de>
Dominik Derigs [Sat, 18 Dec 2021 09:08:01 +0000 (10:08 +0100)]
Fix header of cache dump. The width of the host and address fields are 30 and 40 characters, respectively.
Signed-off-by: DL6ER <dl6er@dl6er.de>
Simon Kelley [Tue, 11 Jan 2022 21:56:40 +0000 (21:56 +0000)]
Log port numbers in server addresses when non-standard ports in use.
Simon Kelley [Tue, 11 Jan 2022 00:09:15 +0000 (00:09 +0000)]
Overhaul code which sends DNSSEC queries.
There are two functional changes in this commit.
1) When searching for an in-flight DNSSEC query to use
(rather than starting a new one), compare the already
sent query (stored in the frec "stash" field, rather than
using the hash of the query. This is probably faster (no hash
calculation) and eliminates having to worry about the
consequences of a hash collision.
2) Check for dependency loops in DNSSEC validation,
say validating A requires DS B and validating DS B
requires DNSKEY C and validating DNSKEY C requires DS B.
This should never happen in correctly signed records, but it's
likely the case that sufficiently broken ones can cause
our validation code requests to exhibit cycles.
The result is that the ->blocking_query list
can form a cycle, and under certain circumstances that can lock us in
an infinite loop.
Instead we transform the situation into an ABANDONED state.
Simon Kelley [Sun, 9 Jan 2022 23:21:55 +0000 (23:21 +0000)]
Handle malformed query packets sensibly.
Previously, hash_questions() would return a random hash
if the packet was malformed, and probably the hash of a previous
query. Now handle this as an error.
Andreas Metzler [Thu, 6 Jan 2022 23:12:53 +0000 (23:12 +0000)]
Clarify man page for --filterwin2k
Daniel Collins [Thu, 6 Jan 2022 00:20:05 +0000 (00:20 +0000)]
Implements a SetLocaliseQueriesOption D-Bus method.
For setting the state of the -y/--localise-queries option.
Simon Kelley [Mon, 3 Jan 2022 23:32:30 +0000 (23:32 +0000)]
Fix massive confusion on server reload.
The 2.86 upstream server rewrite severely broke re-reading
of server configuration. It would get everyting right the first
time, but on re-reading /etc/resolv.conf or --servers-file
or setting things with DBUS, the results were just wrong.
This should put things right again.
Simon Kelley [Mon, 3 Jan 2022 23:31:15 +0000 (23:31 +0000)]
Fix fail to build when NO_SCRIPT set.
Fabrice Fontaine [Sun, 2 Jan 2022 21:01:31 +0000 (22:01 +0100)]
src/option.c: fix build with gcc 4.8
Thanks for applying and fixing my patch. Here is another one on src/pattern.c
Best Regards,
Fabrice
Le dim. 2 janv. 2022 à 00:36, Simon Kelley <simon@thekelleys.org.uk> a écrit :
>
>
>
> Thanks,
>
>
> patch applied. Followed by a small fix, and then a larger fix when I was
> forced to look at the code in question ;)
>
>
>
> Cheers,
>
> Simon.
>
> On 31/12/2021 16:29, Fabrice Fontaine wrote:
> > Fix the following build failure with gcc 4.8 raised since version 2.86:
> >
> > option.c: In function 'one_opt':
> > option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
> > for (char *p = arg; *p; p++) {
> > ^
> > option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
> > option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
> > for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
> > ^
> >
> > Fixes:
> > - http://autobuild.buildroot.org/results/
39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> > src/option.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/option.c b/src/option.c
> > index
ff54def..
c57f6d8 100644
> > --- a/src/option.c
> > +++ b/src/option.c
> > @@ -2525,7 +2525,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
> > arg += 9;
> > if (strlen(arg) != 16)
> > ret_err(gen_err);
> > - for (char *p = arg; *p; p++) {
> > + char *p;
> > + for (*p = arg; *p; p++) {
> > if (!isxdigit((int)*p))
> > ret_err(gen_err);
> > }
> > @@ -2533,7 +2534,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
> >
> > u8 *u = daemon->umbrella_device;
> > char word[3];
> > - for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
> > + u8 i;
> > + for (i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
> > memcpy(word, &(arg[0]), 2);
> > *u++ = strtoul(word, NULL, 16);
> > }
> >
>
From
0c89dd2fa0fe50b00bca638dbbacfbd361526e0a Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sun, 2 Jan 2022 21:57:52 +0100
Subject: [PATCH] src/pattern.c: fix build with gcc 4.8
Fix the following build failure:
pattern.c: In function 'is_valid_dns_name':
pattern.c:134:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (const char *c = value;; c++)
^
pattern.c:134:3: note: use option -std=c99 or -std=gnu99 to compile your code
pattern.c: In function 'is_valid_dns_name_pattern':
pattern.c:249:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (const char *c = value;; c++)
^
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Simon Kelley [Sat, 1 Jan 2022 23:33:39 +0000 (23:33 +0000)]
Tidy code for --umbrella option.
Simon Kelley [Sat, 1 Jan 2022 23:03:26 +0000 (23:03 +0000)]
Fabrice Fontaine [Fri, 31 Dec 2021 16:29:44 +0000 (17:29 +0100)]
src/option.c: fix build with gcc 4.8
Fix the following build failure with gcc 4.8 raised since version 2.86:
option.c: In function 'one_opt':
option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
for (char *p = arg; *p; p++) {
^
option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
^
Fixes:
- http://autobuild.buildroot.org/results/
39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>