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
49333cbd
Commit
49333cbd
authored
Mar 15, 2013
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow trailing '*' wildcard in interface names.
parent
de92b479
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
42 additions
and
24 deletions
+42
-24
CHANGELOG
CHANGELOG
+4
-1
man/dnsmasq.8
man/dnsmasq.8
+6
-1
src/dhcp-common.c
src/dhcp-common.c
+1
-2
src/dhcp.c
src/dhcp.c
+1
-1
src/dhcp6.c
src/dhcp6.c
+4
-6
src/dnsmasq.h
src/dnsmasq.h
+3
-2
src/network.c
src/network.c
+3
-3
src/option.c
src/option.c
+0
-5
src/radv.c
src/radv.c
+2
-2
src/tftp.c
src/tftp.c
+1
-1
src/util.c
src/util.c
+17
-0
No files found.
CHANGELOG
View file @
49333cbd
...
...
@@ -48,8 +48,11 @@ version 2.66
Don't erroneously reject some option names in --dhcp-match
options. Thnaks to Benedikt Hochstrasser for the bug report.
Allow a trailing '*' wildcard in all interface-name
configurations. Thanks to Christian Parpart for the patch.
version 2.65
Fix regression which broke forwarding of queries sent via
TCP which are not for A and AAAA and which were directed to
...
...
man/dnsmasq.8
View file @
49333cbd
...
...
@@ -171,7 +171,12 @@ options. IP alias interfaces (eg "eth1:0") cannot be used with
.B --interface
or
.B --except-interface
options, use --listen-address instead.
options, use --listen-address instead. A simple wildcard, consisting
of a trailing '*', can be used in
.B \--interface
and
.B \--except-interface
options.
.TP
.B \-I, --except-interface=<interface name>
Do not listen on the specified interface. Note that the order of
...
...
src/dhcp-common.c
View file @
49333cbd
...
...
@@ -714,8 +714,7 @@ void log_context(int family, struct dhcp_context *context)
template
=
p
;
p
+=
sprintf
(
p
,
", "
);
sprintf
(
p
,
"template for %s%s"
,
context
->
template_interface
,
(
context
->
flags
&
CONTEXT_WILDCARD
)
?
"*"
:
""
);
sprintf
(
p
,
"template for %s"
,
context
->
template_interface
);
}
#endif
...
...
src/dhcp.c
View file @
49333cbd
...
...
@@ -252,7 +252,7 @@ void dhcp_packet(time_t now, int pxe_fd)
}
for
(
tmp
=
daemon
->
dhcp_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
ifr
.
ifr_name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
ifr
.
ifr_name
))
return
;
/* unlinked contexts are marked by context->current == context */
...
...
src/dhcp6.c
View file @
49333cbd
...
...
@@ -120,11 +120,11 @@ void dhcp6_packet(time_t now)
return
;
for
(
tmp
=
daemon
->
if_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
ifr
.
ifr_name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
ifr
.
ifr_name
))
return
;
for
(
tmp
=
daemon
->
dhcp_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
ifr
.
ifr_name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
ifr
.
ifr_name
))
return
;
parm
.
current
=
NULL
;
...
...
@@ -153,7 +153,7 @@ void dhcp6_packet(time_t now)
{
for
(
tmp
=
daemon
->
if_names
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
ifr
.
ifr_name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
ifr
.
ifr_name
))
break
;
if
(
!
tmp
&&
!
parm
.
addr_match
)
...
...
@@ -530,9 +530,7 @@ static int construct_worker(struct in6_addr *local, int prefix,
}
}
else
if
(
addr6part
(
local
)
==
addr6part
(
&
template
->
start6
)
&&
strncmp
(
template
->
template_interface
,
ifrn_name
,
strlen
(
template
->
template_interface
))
==
0
&&
(
strlen
(
template
->
template_interface
)
==
strlen
(
ifrn_name
)
||
(
template
->
flags
&
CONTEXT_WILDCARD
)))
else
if
(
addr6part
(
local
)
==
addr6part
(
&
template
->
start6
)
&&
wildcard_match
(
template
->
template_interface
,
ifrn_name
))
{
start6
=
*
local
;
setaddr6part
(
&
start6
,
addr6part
(
&
template
->
start6
));
...
...
src/dnsmasq.h
View file @
49333cbd
...
...
@@ -721,9 +721,8 @@ struct dhcp_context {
#define CONTEXT_CONSTRUCTED 2048
#define CONTEXT_GC 4096
#define CONTEXT_RA 8192
#define CONTEXT_
WILDCARD
16384
#define CONTEXT_
CONF_USED
16384
#define CONTEXT_USED 32768
#define CONTEXT_CONF_USED 65536
struct
ping_result
{
struct
in_addr
addr
;
...
...
@@ -980,6 +979,8 @@ char *print_mac(char *buff, unsigned char *mac, int len);
void
bump_maxfd
(
int
fd
,
int
*
max
);
int
read_write
(
int
fd
,
unsigned
char
*
packet
,
int
size
,
int
rw
);
int
wildcard_match
(
const
char
*
wildcard
,
const
char
*
match
);
/* log.c */
void
die
(
char
*
message
,
char
*
arg1
,
int
exit_code
);
int
log_start
(
struct
passwd
*
ent_pw
,
int
errfd
);
...
...
src/network.c
View file @
49333cbd
...
...
@@ -123,7 +123,7 @@ int iface_check(int family, struct all_addr *addr, char *name, int *auth)
ret
=
0
;
for
(
tmp
=
daemon
->
if_names
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
name
))
ret
=
tmp
->
used
=
1
;
if
(
addr
)
...
...
@@ -143,7 +143,7 @@ int iface_check(int family, struct all_addr *addr, char *name, int *auth)
}
for
(
tmp
=
daemon
->
if_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
name
))
ret
=
0
;
...
...
@@ -291,7 +291,7 @@ static int iface_allowed(struct irec **irecp, int if_index,
}
else
for
(
tmp
=
daemon
->
dhcp_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
ifr
.
ifr_name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
ifr
.
ifr_name
))
{
tftp_ok
=
0
;
dhcp_ok
=
0
;
...
...
src/option.c
View file @
49333cbd
...
...
@@ -2375,11 +2375,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
new
->
flags
|=
CONTEXT_DHCP
;
else
if
(
strstr
(
a
[
leasepos
],
"constructor:"
)
==
a
[
leasepos
])
{
if
(
a
[
leasepos
][
strlen
(
a
[
leasepos
])
-
1
]
==
'*'
)
{
a
[
leasepos
][
strlen
(
a
[
leasepos
])
-
1
]
=
0
;
new
->
flags
|=
CONTEXT_WILDCARD
;
}
new
->
template_interface
=
opt_string_alloc
(
a
[
leasepos
]
+
12
);
new
->
flags
|=
CONTEXT_TEMPLATE
;
}
...
...
src/radv.c
View file @
49333cbd
...
...
@@ -158,7 +158,7 @@ void icmp6_packet(time_t now)
return
;
for
(
tmp
=
daemon
->
dhcp_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
interface
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
interface
))
return
;
if
(
packet
[
1
]
!=
0
)
...
...
@@ -533,7 +533,7 @@ time_t periodic_ra(time_t now)
{
struct
iname
*
tmp
;
for
(
tmp
=
daemon
->
dhcp_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
interface
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
interface
))
break
;
if
(
!
tmp
)
send_ra
(
now
,
param
.
iface
,
interface
,
NULL
);
...
...
src/tftp.c
View file @
49333cbd
...
...
@@ -209,7 +209,7 @@ void tftp_request(struct listener *listen, time_t now)
#ifdef HAVE_DHCP
/* allowed interfaces are the same as for DHCP */
for
(
tmp
=
daemon
->
dhcp_except
;
tmp
;
tmp
=
tmp
->
next
)
if
(
tmp
->
name
&&
(
strcmp
(
tmp
->
name
,
name
)
==
0
))
if
(
tmp
->
name
&&
wildcard_match
(
tmp
->
name
,
name
))
return
;
#endif
...
...
src/util.c
View file @
49333cbd
...
...
@@ -581,3 +581,20 @@ int read_write(int fd, unsigned char *packet, int size, int rw)
return
1
;
}
/* Basically match a string value against a wildcard pattern. */
int
wildcard_match
(
const
char
*
wildcard
,
const
char
*
match
)
{
while
(
*
wildcard
&&
*
match
)
{
if
(
*
wildcard
==
'*'
)
return
1
;
if
(
*
wildcard
!=
*
match
)
return
0
;
++
wildcard
;
++
match
;
}
return
*
wildcard
==
*
match
;
}
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