Commit Graph

35 Commits

Author SHA1 Message Date
Heikki Linnakangas
762a3f2430 Don't create a useless inotify file desrcriptor when --port=0
If there are no dynamic configuration directories configured with
dhcp-hostsdir, dhcp-optsdir and hostsdir then we need to use inotify
only to track changes to resolv-files, but we don't need to do
that when DNS is disabled (port=0) or no resolv-files are configured.

It turns out that inotify slots can be a scarce resource, so not
using one when it's not needed is a Goood Thing.

Patch by HL, description above from SRK.
2024-02-07 14:44:49 +00:00
Simon Kelley
b5820d1fd8 Bump copyright to 2024. 2024-01-13 22:20:04 +00:00
Simon Kelley
df242de5c6 Bump copyrights to 2023. 2023-04-05 12:34:34 +01:00
Simon Kelley
d3c21c596e Reconcile "names" and "address" counts when reading hostfiles. 2022-10-30 15:40:20 +00:00
Simon Kelley
34fac952b6 Inotify: make "flushed" log message more understandable.
Saying we've "flushed x outdated entries" is confusing, since
the count is the total number of entries in the modified file,
most of which are going	to get added straight back when	the file
is re-read.

The log now looks like

dnsmasq: inotify: /tmp/dir/1 (new or modified)
dnsmasq: inotify: flushed 1 addresses read from /tmp/dir/1
dnsmasq: read /tmp/dir/1 - 2 addresses

which hopefully make it more obvious that /tmp/dir/1 contained one
address before, and now contains two.
2022-10-27 13:24:37 +01:00
Dominik Derigs
92c32e0bac Do not (try to) re-read deleted files inside a --hostsdir. 2022-10-27 12:36:38 +01:00
Dominik Derigs
0017dd74d5 Enhance --hostdir so that records are automatically removed when re-reading.
Initial patch from Dominik Derigs, re-written by Simon Kelley.
2022-10-16 22:10:48 +01:00
Dominik Derigs
0ba25a0512 Improve logging of DNS record source from --hostsdir files.
Patch author Dominik Derigs <dl6er@dl6er.de> with subsequent bugfixes
and tweaks from Simon Kelley.
2022-10-16 21:14:16 +01:00
Simon Kelley
c6d4c33d61 Bump copyright to 2022. 2022-01-24 15:19:00 +00:00
Dominik Derigs
d9995a1add Improve last patch by splitting the previously combined if
Signed-off-by: DL6ER <dl6er@dl6er.de>

(also cosmetic change to logging for improved translation from
Matthias Andree <matthias.andree@gmx.de>)
2021-09-23 22:54:17 +01:00
Dominik Derigs
ea7a05ad43 Correcly warn if dynamic directory is actually no directory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-09-23 11:02:11 +01:00
Geert Stappers
3573ca0eec Chomp file ends
Removed empty lines from end of src/*.[ch] files.
If the new last line became '#endif'
was the condition of the '#if' added.
2021-04-09 17:27:36 +01:00
Simon Kelley
c8e8f5c204 Bump copyright notices for 2021. Happy New Year! 2021-01-24 21:59:37 +00:00
Simon Kelley
2a8710ac2f Update copyrights to 2020. 2020-01-05 16:40:06 +00:00
Andy Hawkins
55ecde7f1b Inotify: Ignore backup files created by editors
Use strlen to determine the length of the filename returned by
inotify, as in->len refers to the length of the buffer containing
the name, not the length of the name itself.

http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2018q1/011950.html

Signed-off-by: Andy Hawkins <andy@gently.org.uk>

Patch further modified by simon@thekelleys.org to avoid
out-of-bounds array access with an empty string, call strlen once,
and reverse order of filename verifcation and resolv-file test.
2018-02-14 18:36:47 +00:00
Ville Skyttä
faaf306a63 Spelling fixes. 2018-01-14 17:32:52 +00:00
Simon Kelley
d1ced3ae38 Update copyrights to 2018. 2018-01-01 22:18:03 +00:00
Simon Kelley
50ca85504c Bump year in copyrights. 2017-06-24 22:43:18 +01:00
klemens
43517fcaf5 Spelling fixes. 2017-02-19 15:53:37 +00:00
Josh Soref
730c6745f0 Comprehensive spelling/typo fixes.
Thanks to Josh Soref for generating these fixes.
2017-02-06 16:14:04 +00:00
Simon Kelley
e1abeeeec2 Fix memory leak in inotify code. 2016-03-16 18:12:35 +00:00
Simon Kelley
c49778df4a Update copyright notices. Happy new year! 2016-01-06 18:52:33 +00:00
Simon Kelley
77607cbea0 Respect the --no-resolv flag in inotify code. 2015-09-10 23:08:43 +01:00
Simon Kelley
45c5cb1f8f Fix compilation warning. 2015-07-08 22:40:57 +01:00
Simon Kelley
362c9303da Fix inotify code to handle dangling symlinks better. 2015-07-06 21:48:49 +01:00
Simon Kelley
8ff70de618 Typos. 2015-02-14 20:02:37 +00:00
Simon Kelley
f9c863708c Extra logging for inotify code. 2015-02-03 21:52:48 +00:00
Simon Kelley
2941d3ac89 Fixup dhcp-configs after reading extra hostfiles with inotify. 2015-02-02 22:36:42 +00:00
Simon Kelley
aff3396280 Update copyrights for dawn of 2015. 2015-01-31 20:13:40 +00:00
Simon Kelley
70d1873dd9 Expand inotify code to dhcp-hostsdir, dhcp-optsdir and hostsdir. 2015-01-31 19:59:29 +00:00
Simon Kelley
0491805d2f Allow inotify to be disabled at compile time on Linux. 2015-01-26 11:23:43 +00:00
Simon Kelley
5f4dc5c6ca Add --dhcp-hostsdir config option. 2015-01-20 20:51:02 +00:00
Matthias Andree
d310ab7ecb Fix build failure in new inotify code on BSD. 2014-12-27 15:36:38 +00:00
Simon Kelley
857973e6f7 Teach the new inotify code about symlinks. 2014-12-15 15:58:13 +00:00
Simon Kelley
193de4abf5 Use inotify instead of polling on Linux.
This should solve problems people are seeing when a file changes
twice within a second and thus is missed for polling.
2014-12-10 17:32:16 +00:00