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
9e4cf47e
Commit
9e4cf47e
authored
Feb 17, 2016
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --add-mac=text option.
parent
fdc97e13
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
11 deletions
+18
-11
man/dnsmasq.8
man/dnsmasq.8
+2
-2
src/dnsmasq.h
src/dnsmasq.h
+2
-1
src/edns0.c
src/edns0.c
+11
-6
src/option.c
src/option.c
+3
-2
No files found.
man/dnsmasq.8
View file @
9e4cf47e
...
@@ -604,7 +604,7 @@ configured a zero is added in front of the label. ::1 becomes 0--1.
...
@@ -604,7 +604,7 @@ configured a zero is added in front of the label. ::1 becomes 0--1.
The address range can be of the form
The address range can be of the form
<ip address>,<ip address> or <ip address>/<netmask>
<ip address>,<ip address> or <ip address>/<netmask>
.TP
.TP
.B --add-mac[=base64]
.B --add-mac[=base64
|text
]
Add the MAC address of the requestor to DNS queries which are
Add the MAC address of the requestor to DNS queries which are
forwarded upstream. This may be used to DNS filtering by the upstream
forwarded upstream. This may be used to DNS filtering by the upstream
server. The MAC address can only be added if the requestor is on the same
server. The MAC address can only be added if the requestor is on the same
...
@@ -613,7 +613,7 @@ is not yet standardised, so this should be considered
...
@@ -613,7 +613,7 @@ is not yet standardised, so this should be considered
experimental. Also note that exposing MAC addresses in this way may
experimental. Also note that exposing MAC addresses in this way may
have security and privacy implications. The warning about caching
have security and privacy implications. The warning about caching
given for --add-subnet applies to --add-mac too. An alternative encoding of the
given for --add-subnet applies to --add-mac too. An alternative encoding of the
MAC, as base64, is enabled by adding the "base64" parameter.
MAC, as base64, is enabled by adding the "base64" parameter
and a human-readable encoding of hex-and-colons is enabled by added the "text" parameter
.
.TP
.TP
.B --add-cpe-id=<string>
.B --add-cpe-id=<string>
Add a arbitrary identifying string to o DNS queries which are
Add a arbitrary identifying string to o DNS queries which are
...
...
src/dnsmasq.h
View file @
9e4cf47e
...
@@ -237,7 +237,8 @@ struct event_desc {
...
@@ -237,7 +237,8 @@ struct event_desc {
#define OPT_TFTP_NO_FAIL 52
#define OPT_TFTP_NO_FAIL 52
#define OPT_SCRIPT_ARP 53
#define OPT_SCRIPT_ARP 53
#define OPT_MAC_B64 54
#define OPT_MAC_B64 54
#define OPT_LAST 55
#define OPT_MAC_HEX 55
#define OPT_LAST 56
/* extra flags for my_syslog, we use a couple of facilities since they are known
/* extra flags for my_syslog, we use a couple of facilities since they are known
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
...
...
src/edns0.c
View file @
9e4cf47e
...
@@ -223,14 +223,19 @@ static size_t add_dns_client(struct dns_header *header, size_t plen, unsigned ch
...
@@ -223,14 +223,19 @@ static size_t add_dns_client(struct dns_header *header, size_t plen, unsigned ch
{
{
int
maclen
;
int
maclen
;
unsigned
char
mac
[
DHCP_CHADDR_MAX
];
unsigned
char
mac
[
DHCP_CHADDR_MAX
];
char
encode
[
8
];
/* handle 6 byte MACs */
char
encode
[
1
8
];
/* handle 6 byte MACs */
if
((
maclen
=
find_mac
(
l3
,
mac
,
1
,
now
))
==
6
)
if
((
maclen
=
find_mac
(
l3
,
mac
,
1
,
now
))
==
6
)
{
{
encoder
(
mac
,
encode
);
if
(
option_bool
(
OPT_MAC_HEX
))
encoder
(
mac
+
3
,
encode
+
4
);
print_mac
(
encode
,
mac
,
maclen
);
else
plen
=
add_pseudoheader
(
header
,
plen
,
limit
,
PACKETSZ
,
EDNS0_OPTION_NOMDEVICEID
,
(
unsigned
char
*
)
encode
,
8
,
0
);
{
encoder
(
mac
,
encode
);
encoder
(
mac
+
3
,
encode
+
4
);
encode
[
8
]
=
0
;
}
plen
=
add_pseudoheader
(
header
,
plen
,
limit
,
PACKETSZ
,
EDNS0_OPTION_NOMDEVICEID
,
(
unsigned
char
*
)
encode
,
strlen
(
encode
),
0
);
}
}
return
plen
;
return
plen
;
...
@@ -377,7 +382,7 @@ size_t add_edns0_config(struct dns_header *header, size_t plen, unsigned char *l
...
@@ -377,7 +382,7 @@ size_t add_edns0_config(struct dns_header *header, size_t plen, unsigned char *l
if
(
option_bool
(
OPT_ADD_MAC
))
if
(
option_bool
(
OPT_ADD_MAC
))
plen
=
add_mac
(
header
,
plen
,
limit
,
source
,
now
);
plen
=
add_mac
(
header
,
plen
,
limit
,
source
,
now
);
if
(
option_bool
(
OPT_MAC_B64
))
if
(
option_bool
(
OPT_MAC_B64
)
||
option_bool
(
OPT_MAC_HEX
)
)
plen
=
add_dns_client
(
header
,
plen
,
limit
,
source
,
now
);
plen
=
add_dns_client
(
header
,
plen
,
limit
,
source
,
now
);
if
(
daemon
->
dns_client_id
)
if
(
daemon
->
dns_client_id
)
...
...
src/option.c
View file @
9e4cf47e
...
@@ -2172,8 +2172,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
...
@@ -2172,8 +2172,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
unhide_metas
(
arg
);
unhide_metas
(
arg
);
if
(
strcmp
(
arg
,
"base64"
)
==
0
)
if
(
strcmp
(
arg
,
"base64"
)
==
0
)
set_option_bool
(
OPT_MAC_B64
);
set_option_bool
(
OPT_MAC_B64
);
else
else
if
(
strcmp
(
arg
,
"text"
)
==
0
)
ret_err
(
gen_err
);
set_option_bool
(
OPT_MAC_HEX
);
ret_err
(
gen_err
);
}
}
break
;
break
;
...
...
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