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
3e1551a1
Commit
3e1551a1
authored
Sep 09, 2014
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend --conf-dir to allow filtering on file suffixes.
parent
af292dae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
8 deletions
+46
-8
CHANGELOG
CHANGELOG
+4
-0
dnsmasq.conf.example
dnsmasq.conf.example
+6
-0
man/dnsmasq.8
man/dnsmasq.8
+7
-3
src/option.c
src/option.c
+29
-5
No files found.
CHANGELOG
View file @
3e1551a1
...
...
@@ -30,6 +30,10 @@ version 2.72
Include an RFC4191 route information option in router
advertisements for the prefix we're advertising. Thanks to
Ilya Ponetaev for the patch.
Extend --conf-dir to allow filtering of files. So
--conf-dir=/etc/dnsmasq.d,\*.conf
will load all the files in /etc/dnsmasq.d which end in .conf
version 2.71
...
...
dnsmasq.conf.example
View file @
3e1551a1
...
...
@@ -640,3 +640,9 @@
# Include another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
#conf-dir=/etc/dnsmasq.d
# Include all the files in a directory except those ending in .bak
#conf-dir=/etc/dnsmasq.d,.bak
# Include all files in a directory which end in .conf
#conf-dir=/etc/dnsmasq.d/*.conf
\ No newline at end of file
man/dnsmasq.8
View file @
3e1551a1
...
...
@@ -1725,12 +1725,16 @@ Specify a different configuration file. The conf-file option is also allowed in
configuration files, to include multiple configuration files. A
filename of "-" causes dnsmasq to read configuration from stdin.
.TP
.B \-7, --conf-dir=<directory>[,<file-extension>......]
.B \-7, --conf-dir=<directory>[,<file-extension>......]
,
Read all the files in the given directory as configuration
files. If extension(s) are given, any files which end in those
extensions are skipped. Any files whose names end in ~ or start with . or start and end
with # are always skipped. This flag may be given on the command
line or in a configuration file.
with # are always skipped. If the extension starts with * then only files
which have that extension are loaded. So
.B --conf-dir=/path/to/dir,*.conf
loads all files with the suffix .conf in /path/to/dir. This flag may be given on the command
line or in a configuration file. If giving it on the command line, be sure to
escape * characters.
.TP
.B --servers-file=<file>
A special case of
...
...
src/option.c
View file @
3e1551a1
...
...
@@ -1465,7 +1465,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
struct
list
{
char
*
suffix
;
struct
list
*
next
;
}
*
ignore_suffix
=
NULL
,
*
li
;
}
*
ignore_suffix
=
NULL
,
*
match_suffix
=
NULL
,
*
li
;
comma
=
split
(
arg
);
if
(
!
(
directory
=
opt_string_alloc
(
arg
)))
...
...
@@ -1475,10 +1475,20 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
{
comma
=
split
(
arg
);
li
=
opt_malloc
(
sizeof
(
struct
list
));
li
->
next
=
ignore_suffix
;
ignore_suffix
=
li
;
/* Have to copy: buffer is overwritten */
li
->
suffix
=
opt_string_alloc
(
arg
);
if
(
*
arg
==
'*'
)
{
li
->
next
=
match_suffix
;
match_suffix
=
li
;
/* Have to copy: buffer is overwritten */
li
->
suffix
=
opt_string_alloc
(
arg
+
1
);
}
else
{
li
->
next
=
ignore_suffix
;
ignore_suffix
=
li
;
/* Have to copy: buffer is overwritten */
li
->
suffix
=
opt_string_alloc
(
arg
);
}
};
if
(
!
(
dir_stream
=
opendir
(
directory
)))
...
...
@@ -1496,6 +1506,20 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
ent
->
d_name
[
0
]
==
'.'
)
continue
;
if
(
match_suffix
)
{
for
(
li
=
match_suffix
;
li
;
li
=
li
->
next
)
{
/* check for required suffices */
size_t
ls
=
strlen
(
li
->
suffix
);
if
(
len
>
ls
&&
strcmp
(
li
->
suffix
,
&
ent
->
d_name
[
len
-
ls
])
==
0
)
break
;
}
if
(
!
li
)
continue
;
}
for
(
li
=
ignore_suffix
;
li
;
li
=
li
->
next
)
{
/* check for proscribed suffices */
...
...
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