Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Dnsmasq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Dnsmasq
Commits
0491805d
Commit
0491805d
authored
Jan 26, 2015
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow inotify to be disabled at compile time on Linux.
parent
61b838dd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
16 deletions
+37
-16
CHANGELOG
CHANGELOG
+3
-1
src/config.h
src/config.h
+12
-1
src/dnsmasq.c
src/dnsmasq.c
+13
-8
src/dnsmasq.h
src/dnsmasq.h
+7
-4
src/inotify.c
src/inotify.c
+2
-2
No files found.
CHANGELOG
View file @
0491805d
...
...
@@ -9,7 +9,9 @@ version 2.73
Use inotify for checking on updates to /etc/resolv.conf and
friends under Linux. This fixes race conditions when the files are
updated rapidly and saves CPU by noy polling.
updated rapidly and saves CPU by noy polling. To build
a binary that runs on old Linux kernels without inotify,
use make COPTS=-DNO_INOTIFY
Fix breakage of --domain=<domain>,<subnet>,local - only reverse
queries were intercepted. THis appears to have been broken
...
...
src/config.h
View file @
0491805d
...
...
@@ -115,6 +115,8 @@ HAVE_DNSSEC
HAVE_LOOP
include functionality to probe for and remove DNS forwarding loops.
HAVE_INOTIFY
use the Linux inotify facility to efficiently re-read configuration files.
NO_IPV6
NO_TFTP
...
...
@@ -123,6 +125,7 @@ NO_DHCP6
NO_SCRIPT
NO_LARGEFILE
NO_AUTH
NO_INOTIFY
these are avilable to explictly disable compile time options which would
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
which are enabled by default in the distributed source tree. Building dnsmasq
...
...
@@ -355,6 +358,10 @@ HAVE_SOCKADDR_SA_LEN
#undef HAVE_LOOP
#endif
#if defined (HAVE_LINUX_NETWORK) && !defined(NO_INOTIFY)
#define HAVE_INOTIFY
#endif
/* Define a string indicating which options are in use.
DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */
...
...
@@ -428,7 +435,11 @@ static char *compile_opts =
#ifndef HAVE_LOOP
"no-"
#endif
"loop-detect"
;
"loop-detect "
#ifndef HAVE_INOTIFY
"no-"
#endif
"inotify"
;
#endif
...
...
src/dnsmasq.c
View file @
0491805d
...
...
@@ -142,7 +142,9 @@ int main (int argc, char **argv)
set_option_bool
(
OPT_NOWILD
);
reset_option_bool
(
OPT_CLEVERBIND
);
}
#endif
#ifndef HAVE_INOTIFY
if
(
daemon
->
inotify_hosts
)
die
(
_
(
"dhcp-hostsdir not supported on this platform"
),
NULL
,
EC_BADCONF
);
#endif
...
...
@@ -321,7 +323,7 @@ int main (int argc, char **argv)
#endif
}
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
if
((
!
option_bool
(
OPT_NO_POLL
)
&&
daemon
->
port
!=
0
)
||
daemon
->
dhcp
||
daemon
->
doing_dhcp6
)
inotify_dnsmasq_init
();
...
...
@@ -802,7 +804,7 @@ int main (int argc, char **argv)
pid
=
getpid
();
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
/* Using inotify, have to select a resolv file at startup */
poll_resolv
(
1
,
0
,
now
);
#endif
...
...
@@ -872,15 +874,18 @@ int main (int argc, char **argv)
bump_maxfd
(
daemon
->
icmp6fd
,
&
maxfd
);
}
#endif
#if defined(HAVE_LINUX_NETWORK)
FD_SET
(
daemon
->
netlinkfd
,
&
rset
);
bump_maxfd
(
daemon
->
netlinkfd
,
&
maxfd
);
#ifdef HAVE_INOTIFY
if
(
daemon
->
inotifyfd
!=
-
1
)
{
FD_SET
(
daemon
->
inotifyfd
,
&
rset
);
bump_maxfd
(
daemon
->
inotifyfd
,
&
maxfd
);
}
#endif
#if defined(HAVE_LINUX_NETWORK)
FD_SET
(
daemon
->
netlinkfd
,
&
rset
);
bump_maxfd
(
daemon
->
netlinkfd
,
&
maxfd
);
#elif defined(HAVE_BSD_NETWORK)
FD_SET
(
daemon
->
routefd
,
&
rset
);
bump_maxfd
(
daemon
->
routefd
,
&
maxfd
);
...
...
@@ -948,7 +953,7 @@ int main (int argc, char **argv)
route_sock
();
#endif
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
if
(
daemon
->
inotifyfd
!=
-
1
&&
FD_ISSET
(
daemon
->
inotifyfd
,
&
rset
)
&&
inotify_check
(
now
))
{
if
(
daemon
->
port
!=
0
&&
!
option_bool
(
OPT_NO_POLL
))
...
...
@@ -1394,7 +1399,7 @@ void clear_cache_and_reload(time_t now)
if
(
option_bool
(
OPT_ETHERS
))
dhcp_read_ethers
();
reread_dhcp
();
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
set_dhcp_inotify
();
#endif
dhcp_update_configs
(
daemon
->
dhcp_conf
);
...
...
src/dnsmasq.h
View file @
0491805d
...
...
@@ -544,7 +544,7 @@ struct resolvc {
int
is_default
,
logged
;
time_t
mtime
;
char
*
name
;
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
int
wd
;
/* inotify watch descriptor */
char
*
file
;
/* pointer to file part if path */
#endif
...
...
@@ -558,7 +558,7 @@ struct hostsfile {
struct
hostsfile
*
next
;
int
flags
;
char
*
fname
;
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
int
wd
;
/* inotify watch descriptor */
#endif
unsigned
int
index
;
/* matches to cache entries for logging */
...
...
@@ -1013,8 +1013,11 @@ extern struct daemon {
/* DHCP state */
int
dhcpfd
,
helperfd
,
pxefd
;
#ifdef HAVE_INOTIFY
int
inotifyfd
;
#endif
#if defined(HAVE_LINUX_NETWORK)
int
netlinkfd
,
inotifyfd
;
int
netlinkfd
;
#elif defined(HAVE_BSD_NETWORK)
int
dhcp_raw_fd
,
dhcp_icmp_fd
,
routefd
;
#endif
...
...
@@ -1488,7 +1491,7 @@ int detect_loop(char *query, int type);
#endif
/* inotify.c */
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
void
inotify_dnsmasq_init
();
int
inotify_check
(
time_t
now
);
# ifdef HAVE_DHCP
...
...
src/inotify.c
View file @
0491805d
...
...
@@ -15,7 +15,7 @@
*/
#include "dnsmasq.h"
#ifdef HAVE_
LINUX_NETWORK
#ifdef HAVE_
INOTIFY
#include <sys/inotify.h>
...
...
@@ -216,5 +216,5 @@ static void check_for_dhcp_inotify(struct inotify_event *in, time_t now)
#endif
/* DHCP */
#endif
/*
LINUX_NETWORK
*/
#endif
/*
INOTIFY
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment