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
9f7f3b12
Commit
9f7f3b12
authored
May 28, 2012
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --dns-rr option.
parent
97c83bb0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
8 deletions
+89
-8
CHANGELOG
CHANGELOG
+2
-0
man/dnsmasq.8
man/dnsmasq.8
+6
-0
src/dnsmasq.h
src/dnsmasq.h
+1
-1
src/option.c
src/option.c
+40
-1
src/rfc1035.c
src/rfc1035.c
+18
-1
src/util.c
src/util.c
+22
-5
No files found.
CHANGELOG
View file @
9f7f3b12
...
...
@@ -16,6 +16,8 @@ version 2.62
router-advertisement configured, but DHCPv6 not
configured. Thanks to Marien Zwart for the patch.
Add --dns-rr, to allow arbitrary DNS resource records.
version 2.61
Re-write interface discovery code on *BSD to use
...
...
man/dnsmasq.8
View file @
9f7f3b12
...
...
@@ -454,6 +454,12 @@ hosts files) or from DHCP. If the target does not satisfy this
criteria, the whole cname is ignored. The cname must be unique, but it
is permissable to have more than one cname pointing to the same target.
.TP
.B --dns-rr=<name>,<RR-number>,[<hex data>]
Return an arbitrary DNS Resource Record. The number is the type of the
record (which is always in the C_IN class). The value of the record is
given by the hex data, which may be of the for 01:23:45 or 01 23 45 or
012345 or any mixture of these.
.TP
.B --interface-name=<name>,<interface>
Return a DNS record associating the name with the primary address on
the given interface. This flag specifies an A record for the given
...
...
src/dnsmasq.h
View file @
9f7f3b12
...
...
@@ -732,7 +732,7 @@ extern struct daemon {
time_t
last_resolv
;
struct
mx_srv_record
*
mxnames
;
struct
naptr
*
naptr
;
struct
txt_record
*
txt
;
struct
txt_record
*
txt
,
*
rr
;
struct
ptr_record
*
ptr
;
struct
host_record
*
host_records
,
*
host_records_tail
;
struct
cname
*
cnames
;
...
...
src/option.c
View file @
9f7f3b12
...
...
@@ -118,6 +118,7 @@ struct myoption {
#define LOPT_DUID 307
#define LOPT_HOST_REC 308
#define LOPT_TFTP_LC 309
#define LOPT_RR 310
#ifdef HAVE_GETOPT_LONG
static
const
struct
option
opts
[]
=
...
...
@@ -181,6 +182,7 @@ static const struct myoption opts[] =
{
"srv-host"
,
1
,
0
,
'W'
},
{
"localise-queries"
,
0
,
0
,
'y'
},
{
"txt-record"
,
1
,
0
,
'Y'
},
{
"dns-rr"
,
1
,
0
,
LOPT_RR
},
{
"enable-dbus"
,
0
,
0
,
'1'
},
{
"bootp-dynamic"
,
2
,
0
,
'3'
},
{
"dhcp-mac"
,
1
,
0
,
'4'
},
...
...
@@ -371,6 +373,7 @@ static struct {
{
LOPT_RA
,
OPT_RA
,
NULL
,
gettext_noop
(
"Send router-advertisements for interfaces doing DHCPv6"
),
NULL
},
{
LOPT_DUID
,
ARG_ONE
,
"<enterprise>,<duid>"
,
gettext_noop
(
"Specify DUID_EN-type DHCPv6 server DUID"
),
NULL
},
{
LOPT_HOST_REC
,
ARG_DUP
,
"<name>,<address>"
,
gettext_noop
(
"Specify host (A/AAAA and PTR) records"
),
NULL
},
{
LOPT_RR
,
ARG_DUP
,
"<name>,<RR-number>,[<data>]"
,
gettext_noop
(
"Specify arbitrary DNS resource record"
),
NULL
},
{
0
,
0
,
NULL
,
NULL
,
NULL
}
};
...
...
@@ -2214,6 +2217,7 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
}
if
(
len
==
-
1
)
problem
=
_
(
"bad hex constant"
);
else
if
((
new
->
clid
=
opt_malloc
(
len
)))
{
...
...
@@ -2931,7 +2935,42 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
}
break
;
}
case
LOPT_RR
:
/* dns-rr */
{
struct
txt_record
*
new
;
size_t
len
;
char
*
data
;
int
val
;
comma
=
split
(
arg
);
data
=
split
(
comma
);
new
=
opt_malloc
(
sizeof
(
struct
txt_record
));
new
->
next
=
daemon
->
rr
;
daemon
->
rr
=
new
;
if
(
!
atoi_check
(
comma
,
&
val
)
||
!
(
new
->
name
=
canonicalise_opt
(
arg
))
||
(
data
&&
(
len
=
parse_hex
(
data
,
(
unsigned
char
*
)
data
,
-
1
,
NULL
,
NULL
))
==
-
1
))
{
problem
=
_
(
"bad RR record"
);
break
;
}
new
->
class
=
val
;
new
->
len
=
0
;
if
(
data
)
{
new
->
txt
=
opt_malloc
(
len
);
new
->
len
=
len
;
memcpy
(
new
->
txt
,
data
,
len
);
}
break
;
}
case
'Y'
:
/* --txt-record */
{
struct
txt_record
*
new
;
...
...
src/rfc1035.c
View file @
9f7f3b12
...
...
@@ -1250,7 +1250,8 @@ static int add_resource_record(struct dns_header *header, char *limit, int *trun
case
't'
:
usval
=
va_arg
(
ap
,
int
);
sval
=
va_arg
(
ap
,
char
*
);
memcpy
(
p
,
sval
,
usval
);
if
(
usval
!=
0
)
memcpy
(
p
,
sval
,
usval
);
p
+=
usval
;
break
;
...
...
@@ -1393,6 +1394,22 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
if
(
qclass
==
C_IN
)
{
struct
txt_record
*
t
;
for
(
t
=
daemon
->
rr
;
t
;
t
=
t
->
next
)
if
((
t
->
class
==
qtype
||
qtype
==
T_ANY
)
&&
hostname_isequal
(
name
,
t
->
name
))
{
ans
=
1
;
if
(
!
dryrun
)
{
log_query
(
F_CONFIG
|
F_RRNAME
,
name
,
NULL
,
"<RR>"
);
if
(
add_resource_record
(
header
,
limit
,
&
trunc
,
nameoffset
,
&
ansp
,
daemon
->
local_ttl
,
NULL
,
t
->
class
,
C_IN
,
"t"
,
t
->
len
,
t
->
txt
))
anscount
++
;
}
}
if
(
qtype
==
T_PTR
||
qtype
==
T_ANY
)
{
/* see if it's w.z.y.z.in-addr.arpa format */
...
...
src/util.c
View file @
9f7f3b12
...
...
@@ -426,7 +426,7 @@ int parse_hex(char *in, unsigned char *out, int maxlen,
while
(
maxlen
==
-
1
||
i
<
maxlen
)
{
for
(
r
=
in
;
*
r
!=
0
&&
*
r
!=
':'
&&
*
r
!=
'-'
;
r
++
)
for
(
r
=
in
;
*
r
!=
0
&&
*
r
!=
':'
&&
*
r
!=
'-'
&&
*
r
!=
' '
;
r
++
)
if
(
*
r
!=
'*'
&&
!
isxdigit
((
unsigned
char
)
*
r
))
return
-
1
;
...
...
@@ -444,12 +444,29 @@ int parse_hex(char *in, unsigned char *out, int maxlen,
else
{
*
r
=
0
;
mask
=
mask
<<
1
;
if
(
strcmp
(
in
,
"*"
)
==
0
)
mask
|=
1
;
{
mask
=
(
mask
<<
1
)
|
1
;
i
++
;
}
else
out
[
i
]
=
strtol
(
in
,
NULL
,
16
);
i
++
;
{
int
j
,
bytes
=
(
1
+
(
r
-
in
))
/
2
;
for
(
j
=
0
;
j
<
bytes
;
j
++
)
{
char
sav
;
if
(
j
<
bytes
-
1
)
{
sav
=
in
[(
j
+
1
)
*
2
];
in
[(
j
+
1
)
*
2
]
=
0
;
}
out
[
i
]
=
strtol
(
&
in
[
j
*
2
],
NULL
,
16
);
mask
=
mask
<<
1
;
i
++
;
if
(
j
<
bytes
-
1
)
in
[(
j
+
1
)
*
2
]
=
sav
;
}
}
}
}
in
=
r
+
1
;
...
...
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