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
df3d54f7
Commit
df3d54f7
authored
Feb 24, 2016
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add TTL parameter to --host-record and --cname.
parent
22c0f4fe
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
11 deletions
+62
-11
man/dnsmasq.8
man/dnsmasq.8
+10
-2
src/cache.c
src/cache.c
+7
-0
src/dnsmasq.h
src/dnsmasq.h
+2
-0
src/option.c
src/option.c
+38
-8
src/rfc1035.c
src/rfc1035.c
+5
-1
No files found.
man/dnsmasq.8
View file @
df3d54f7
...
@@ -529,7 +529,7 @@ zone files: the port, weight and priority numbers are in a different
...
@@ -529,7 +529,7 @@ zone files: the port, weight and priority numbers are in a different
order. More than one SRV record for a given service/domain is allowed,
order. More than one SRV record for a given service/domain is allowed,
all that match are returned.
all that match are returned.
.TP
.TP
.B --host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>]
.B --host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>]
[,<TTL>]
Add A, AAAA and PTR records to the DNS. This adds one or more names to
Add A, AAAA and PTR records to the DNS. This adds one or more names to
the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may
the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may
appear in more than one
appear in more than one
...
@@ -546,6 +546,10 @@ is in effect. Short and long names may appear in the same
...
@@ -546,6 +546,10 @@ is in effect. Short and long names may appear in the same
.B host-record,
.B host-record,
eg.
eg.
.B --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100
.B --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100
If the time-to-live is given, it overrides the default, which is zero
or the value of --local-ttl. The value is a positive integer and gives
the time-to-live in seconds.
.TP
.TP
.B \-Y, --txt-record=<name>[[,<text>],<text>]
.B \-Y, --txt-record=<name>[[,<text>],<text>]
Return a TXT DNS record. The value of TXT record is a set of strings,
Return a TXT DNS record. The value of TXT record is a set of strings,
...
@@ -559,7 +563,7 @@ Return a PTR DNS record.
...
@@ -559,7 +563,7 @@ Return a PTR DNS record.
.B --naptr-record=<name>,<order>,<preference>,<flags>,<service>,<regexp>[,<replacement>]
.B --naptr-record=<name>,<order>,<preference>,<flags>,<service>,<regexp>[,<replacement>]
Return an NAPTR DNS record, as specified in RFC3403.
Return an NAPTR DNS record, as specified in RFC3403.
.TP
.TP
.B --cname=<cname>,<target>
.B --cname=<cname>,<target>
[,<TTL>]
Return a CNAME record which indicates that <cname> is really
Return a CNAME record which indicates that <cname> is really
<target>. There are significant limitations on the target; it must be a
<target>. There are significant limitations on the target; it must be a
DNS name which is known to dnsmasq from /etc/hosts (or additional
DNS name which is known to dnsmasq from /etc/hosts (or additional
...
@@ -568,6 +572,10 @@ hosts files), from DHCP, from --interface-name or from another
...
@@ -568,6 +572,10 @@ hosts files), from DHCP, from --interface-name or from another
If the target does not satisfy this
If the target does not satisfy this
criteria, the whole cname is ignored. The cname must be unique, but it
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.
is permissable to have more than one cname pointing to the same target.
If the time-to-live is given, it overrides the default, which is zero
or the value of -local-ttl. The value is a positive integer and gives
the time-to-live in seconds.
.TP
.TP
.B --dns-rr=<name>,<RR-number>,[<hex data>]
.B --dns-rr=<name>,<RR-number>,[<hex data>]
Return an arbitrary DNS Resource Record. The number is the type of the
Return an arbitrary DNS Resource Record. The number is the type of the
...
...
src/cache.c
View file @
df3d54f7
...
@@ -778,6 +778,7 @@ static void add_hosts_cname(struct crec *target)
...
@@ -778,6 +778,7 @@ static void add_hosts_cname(struct crec *target)
(
crec
=
whine_malloc
(
sizeof
(
struct
crec
))))
(
crec
=
whine_malloc
(
sizeof
(
struct
crec
))))
{
{
crec
->
flags
=
F_FORWARD
|
F_IMMORTAL
|
F_NAMEP
|
F_CONFIG
|
F_CNAME
;
crec
->
flags
=
F_FORWARD
|
F_IMMORTAL
|
F_NAMEP
|
F_CONFIG
|
F_CNAME
;
crec
->
ttd
=
a
->
ttl
;
crec
->
name
.
namep
=
a
->
alias
;
crec
->
name
.
namep
=
a
->
alias
;
crec
->
addr
.
cname
.
target
.
cache
=
target
;
crec
->
addr
.
cname
.
target
.
cache
=
target
;
crec
->
addr
.
cname
.
uid
=
target
->
uid
;
crec
->
addr
.
cname
.
uid
=
target
->
uid
;
...
@@ -981,6 +982,7 @@ int read_hostsfile(char *filename, unsigned int index, int cache_size, struct cr
...
@@ -981,6 +982,7 @@ int read_hostsfile(char *filename, unsigned int index, int cache_size, struct cr
strcat
(
cache
->
name
.
sname
,
"."
);
strcat
(
cache
->
name
.
sname
,
"."
);
strcat
(
cache
->
name
.
sname
,
domain_suffix
);
strcat
(
cache
->
name
.
sname
,
domain_suffix
);
cache
->
flags
=
flags
;
cache
->
flags
=
flags
;
cache
->
ttd
=
daemon
->
local_ttl
;
add_hosts_entry
(
cache
,
&
addr
,
addrlen
,
index
,
rhash
,
hashsz
);
add_hosts_entry
(
cache
,
&
addr
,
addrlen
,
index
,
rhash
,
hashsz
);
name_count
++
;
name_count
++
;
}
}
...
@@ -988,6 +990,7 @@ int read_hostsfile(char *filename, unsigned int index, int cache_size, struct cr
...
@@ -988,6 +990,7 @@ int read_hostsfile(char *filename, unsigned int index, int cache_size, struct cr
{
{
strcpy
(
cache
->
name
.
sname
,
canon
);
strcpy
(
cache
->
name
.
sname
,
canon
);
cache
->
flags
=
flags
;
cache
->
flags
=
flags
;
cache
->
ttd
=
daemon
->
local_ttl
;
add_hosts_entry
(
cache
,
&
addr
,
addrlen
,
index
,
rhash
,
hashsz
);
add_hosts_entry
(
cache
,
&
addr
,
addrlen
,
index
,
rhash
,
hashsz
);
name_count
++
;
name_count
++
;
}
}
...
@@ -1057,6 +1060,7 @@ void cache_reload(void)
...
@@ -1057,6 +1060,7 @@ void cache_reload(void)
((
cache
=
whine_malloc
(
sizeof
(
struct
crec
)))))
((
cache
=
whine_malloc
(
sizeof
(
struct
crec
)))))
{
{
cache
->
flags
=
F_FORWARD
|
F_NAMEP
|
F_CNAME
|
F_IMMORTAL
|
F_CONFIG
;
cache
->
flags
=
F_FORWARD
|
F_NAMEP
|
F_CNAME
|
F_IMMORTAL
|
F_CONFIG
;
cache
->
ttd
=
a
->
ttl
;
cache
->
name
.
namep
=
a
->
alias
;
cache
->
name
.
namep
=
a
->
alias
;
cache
->
addr
.
cname
.
target
.
int_name
=
intr
;
cache
->
addr
.
cname
.
target
.
int_name
=
intr
;
cache
->
addr
.
cname
.
uid
=
SRC_INTERFACE
;
cache
->
addr
.
cname
.
uid
=
SRC_INTERFACE
;
...
@@ -1071,6 +1075,7 @@ void cache_reload(void)
...
@@ -1071,6 +1075,7 @@ void cache_reload(void)
(
cache
->
addr
.
ds
.
keydata
=
blockdata_alloc
(
ds
->
digest
,
ds
->
digestlen
)))
(
cache
->
addr
.
ds
.
keydata
=
blockdata_alloc
(
ds
->
digest
,
ds
->
digestlen
)))
{
{
cache
->
flags
=
F_FORWARD
|
F_IMMORTAL
|
F_DS
|
F_CONFIG
|
F_NAMEP
;
cache
->
flags
=
F_FORWARD
|
F_IMMORTAL
|
F_DS
|
F_CONFIG
|
F_NAMEP
;
cache
->
ttd
=
daemon
->
local_ttl
;
cache
->
name
.
namep
=
ds
->
name
;
cache
->
name
.
namep
=
ds
->
name
;
cache
->
addr
.
ds
.
keylen
=
ds
->
digestlen
;
cache
->
addr
.
ds
.
keylen
=
ds
->
digestlen
;
cache
->
addr
.
ds
.
algo
=
ds
->
algo
;
cache
->
addr
.
ds
.
algo
=
ds
->
algo
;
...
@@ -1095,6 +1100,7 @@ void cache_reload(void)
...
@@ -1095,6 +1100,7 @@ void cache_reload(void)
(
cache
=
whine_malloc
(
sizeof
(
struct
crec
))))
(
cache
=
whine_malloc
(
sizeof
(
struct
crec
))))
{
{
cache
->
name
.
namep
=
nl
->
name
;
cache
->
name
.
namep
=
nl
->
name
;
cache
->
ttd
=
hr
->
ttl
;
cache
->
flags
=
F_HOSTS
|
F_IMMORTAL
|
F_FORWARD
|
F_REVERSE
|
F_IPV4
|
F_NAMEP
|
F_CONFIG
;
cache
->
flags
=
F_HOSTS
|
F_IMMORTAL
|
F_FORWARD
|
F_REVERSE
|
F_IPV4
|
F_NAMEP
|
F_CONFIG
;
add_hosts_entry
(
cache
,
(
struct
all_addr
*
)
&
hr
->
addr
,
INADDRSZ
,
SRC_CONFIG
,
(
struct
crec
**
)
daemon
->
packet
,
revhashsz
);
add_hosts_entry
(
cache
,
(
struct
all_addr
*
)
&
hr
->
addr
,
INADDRSZ
,
SRC_CONFIG
,
(
struct
crec
**
)
daemon
->
packet
,
revhashsz
);
}
}
...
@@ -1103,6 +1109,7 @@ void cache_reload(void)
...
@@ -1103,6 +1109,7 @@ void cache_reload(void)
(
cache
=
whine_malloc
(
sizeof
(
struct
crec
))))
(
cache
=
whine_malloc
(
sizeof
(
struct
crec
))))
{
{
cache
->
name
.
namep
=
nl
->
name
;
cache
->
name
.
namep
=
nl
->
name
;
cache
->
ttd
=
hr
->
ttl
;
cache
->
flags
=
F_HOSTS
|
F_IMMORTAL
|
F_FORWARD
|
F_REVERSE
|
F_IPV6
|
F_NAMEP
|
F_CONFIG
;
cache
->
flags
=
F_HOSTS
|
F_IMMORTAL
|
F_FORWARD
|
F_REVERSE
|
F_IPV6
|
F_NAMEP
|
F_CONFIG
;
add_hosts_entry
(
cache
,
(
struct
all_addr
*
)
&
hr
->
addr6
,
IN6ADDRSZ
,
SRC_CONFIG
,
(
struct
crec
**
)
daemon
->
packet
,
revhashsz
);
add_hosts_entry
(
cache
,
(
struct
all_addr
*
)
&
hr
->
addr6
,
IN6ADDRSZ
,
SRC_CONFIG
,
(
struct
crec
**
)
daemon
->
packet
,
revhashsz
);
}
}
...
...
src/dnsmasq.h
View file @
df3d54f7
...
@@ -308,6 +308,7 @@ struct ptr_record {
...
@@ -308,6 +308,7 @@ struct ptr_record {
};
};
struct
cname
{
struct
cname
{
int
ttl
;
char
*
alias
,
*
target
;
char
*
alias
,
*
target
;
struct
cname
*
next
;
struct
cname
*
next
;
};
};
...
@@ -344,6 +345,7 @@ struct auth_zone {
...
@@ -344,6 +345,7 @@ struct auth_zone {
struct
host_record
{
struct
host_record
{
int
ttl
;
struct
name_list
{
struct
name_list
{
char
*
name
;
char
*
name
;
struct
name_list
*
next
;
struct
name_list
*
next
;
...
...
src/option.c
View file @
df3d54f7
...
@@ -448,20 +448,20 @@ static struct {
...
@@ -448,20 +448,20 @@ static struct {
{
LOPT_GEN_NAMES
,
ARG_DUP
,
"[=tag:<tag>]"
,
gettext_noop
(
"Generate hostnames based on MAC address for nameless clients."
),
NULL
},
{
LOPT_GEN_NAMES
,
ARG_DUP
,
"[=tag:<tag>]"
,
gettext_noop
(
"Generate hostnames based on MAC address for nameless clients."
),
NULL
},
{
LOPT_PROXY
,
ARG_DUP
,
"[=<ipaddr>]..."
,
gettext_noop
(
"Use these DHCP relays as full proxies."
),
NULL
},
{
LOPT_PROXY
,
ARG_DUP
,
"[=<ipaddr>]..."
,
gettext_noop
(
"Use these DHCP relays as full proxies."
),
NULL
},
{
LOPT_RELAY
,
ARG_DUP
,
"<local-addr>,<server>[,<interface>]"
,
gettext_noop
(
"Relay DHCP requests to a remote server"
),
NULL
},
{
LOPT_RELAY
,
ARG_DUP
,
"<local-addr>,<server>[,<interface>]"
,
gettext_noop
(
"Relay DHCP requests to a remote server"
),
NULL
},
{
LOPT_CNAME
,
ARG_DUP
,
"<alias>,<target>"
,
gettext_noop
(
"Specify alias name for LOCAL DNS name."
),
NULL
},
{
LOPT_CNAME
,
ARG_DUP
,
"<alias>,<target>
[,<ttl>]
"
,
gettext_noop
(
"Specify alias name for LOCAL DNS name."
),
NULL
},
{
LOPT_PXE_PROMT
,
ARG_DUP
,
"<prompt>,[<timeout>]"
,
gettext_noop
(
"Prompt to send to PXE clients."
),
NULL
},
{
LOPT_PXE_PROMT
,
ARG_DUP
,
"<prompt>,[<timeout>]"
,
gettext_noop
(
"Prompt to send to PXE clients."
),
NULL
},
{
LOPT_PXE_SERV
,
ARG_DUP
,
"<service>"
,
gettext_noop
(
"Boot service for PXE menu."
),
NULL
},
{
LOPT_PXE_SERV
,
ARG_DUP
,
"<service>"
,
gettext_noop
(
"Boot service for PXE menu."
),
NULL
},
{
LOPT_TEST
,
0
,
NULL
,
gettext_noop
(
"Check configuration syntax."
),
NULL
},
{
LOPT_TEST
,
0
,
NULL
,
gettext_noop
(
"Check configuration syntax."
),
NULL
},
{
LOPT_ADD_MAC
,
ARG_DUP
,
"[=base64|text]"
,
gettext_noop
(
"Add requestor's MAC address to forwarded DNS queries."
),
NULL
},
{
LOPT_ADD_MAC
,
ARG_DUP
,
"[=base64|text]"
,
gettext_noop
(
"Add requestor's MAC address to forwarded DNS queries."
),
NULL
},
{
LOPT_ADD_SBNET
,
ARG_ONE
,
"<v4 pref>[,<v6 pref>]"
,
gettext_noop
(
"Add specified IP subnet to forwarded DNS queries."
),
NULL
},
{
LOPT_ADD_SBNET
,
ARG_ONE
,
"<v4 pref>[,<v6 pref>]"
,
gettext_noop
(
"Add specified IP subnet to forwarded DNS queries."
),
NULL
},
{
LOPT_CPE_ID
,
ARG_ONE
,
"<text>"
,
gettext_noop
(
"Add client identification to forwarded DNS queries."
),
NULL
},
{
LOPT_CPE_ID
,
ARG_ONE
,
"<text>"
,
gettext_noop
(
"Add client identification to forwarded DNS queries."
),
NULL
},
{
LOPT_DNSSEC
,
OPT_DNSSEC_PROXY
,
NULL
,
gettext_noop
(
"Proxy DNSSEC validation results from upstream nameservers."
),
NULL
},
{
LOPT_DNSSEC
,
OPT_DNSSEC_PROXY
,
NULL
,
gettext_noop
(
"Proxy DNSSEC validation results from upstream nameservers."
),
NULL
},
{
LOPT_INCR_ADDR
,
OPT_CONSEC_ADDR
,
NULL
,
gettext_noop
(
"Attempt to allocate sequential IP addresses to DHCP clients."
),
NULL
},
{
LOPT_INCR_ADDR
,
OPT_CONSEC_ADDR
,
NULL
,
gettext_noop
(
"Attempt to allocate sequential IP addresses to DHCP clients."
),
NULL
},
{
LOPT_CONNTRACK
,
OPT_CONNTRACK
,
NULL
,
gettext_noop
(
"Copy connection-track mark from queries to upstream connections."
),
NULL
},
{
LOPT_CONNTRACK
,
OPT_CONNTRACK
,
NULL
,
gettext_noop
(
"Copy connection-track mark from queries to upstream connections."
),
NULL
},
{
LOPT_FQDN
,
OPT_FQDN_UPDATE
,
NULL
,
gettext_noop
(
"Allow DHCP clients to do their own DDNS updates."
),
NULL
},
{
LOPT_FQDN
,
OPT_FQDN_UPDATE
,
NULL
,
gettext_noop
(
"Allow DHCP clients to do their own DDNS updates."
),
NULL
},
{
LOPT_RA
,
OPT_RA
,
NULL
,
gettext_noop
(
"Send router-advertisements for interfaces doing DHCPv6"
),
NULL
},
{
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_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_HOST_REC
,
ARG_DUP
,
"<name>,<address>
[,<ttl>]
"
,
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
},
{
LOPT_RR
,
ARG_DUP
,
"<name>,<RR-number>,[<data>]"
,
gettext_noop
(
"Specify arbitrary DNS resource record"
),
NULL
},
{
LOPT_CLVERBIND
,
OPT_CLEVERBIND
,
NULL
,
gettext_noop
(
"Bind to interfaces in use - check for new interfaces"
),
NULL
},
{
LOPT_CLVERBIND
,
OPT_CLEVERBIND
,
NULL
,
gettext_noop
(
"Bind to interfaces in use - check for new interfaces"
),
NULL
},
{
LOPT_AUTHSERV
,
ARG_ONE
,
"<NS>,<interface>"
,
gettext_noop
(
"Export local names to global DNS"
),
NULL
},
{
LOPT_AUTHSERV
,
ARG_ONE
,
"<NS>,<interface>"
,
gettext_noop
(
"Export local names to global DNS"
),
NULL
},
...
@@ -3692,12 +3692,15 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
...
@@ -3692,12 +3692,15 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
case
LOPT_CNAME
:
/* --cname */
case
LOPT_CNAME
:
/* --cname */
{
{
struct
cname
*
new
;
struct
cname
*
new
;
char
*
alias
;
char
*
alias
,
*
target
,
*
ttls
;
char
*
target
;
int
ttl
=
-
1
;
if
(
!
(
comma
=
split
(
arg
)))
if
(
!
(
comma
=
split
(
arg
)))
ret_err
(
gen_err
);
ret_err
(
gen_err
);
if
((
ttls
=
split
(
comma
))
&&
!
atoi_check
(
ttls
,
&
ttl
))
ret_err
(
_
(
"bad TTL"
));
alias
=
canonicalise_opt
(
arg
);
alias
=
canonicalise_opt
(
arg
);
target
=
canonicalise_opt
(
comma
);
target
=
canonicalise_opt
(
comma
);
...
@@ -3713,6 +3716,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
...
@@ -3713,6 +3716,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
daemon
->
cnames
=
new
;
daemon
->
cnames
=
new
;
new
->
alias
=
alias
;
new
->
alias
=
alias
;
new
->
target
=
target
;
new
->
target
=
target
;
new
->
ttl
=
ttl
;
}
}
break
;
break
;
...
@@ -3913,14 +3917,22 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
...
@@ -3913,14 +3917,22 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
{
{
struct
host_record
*
new
=
opt_malloc
(
sizeof
(
struct
host_record
));
struct
host_record
*
new
=
opt_malloc
(
sizeof
(
struct
host_record
));
memset
(
new
,
0
,
sizeof
(
struct
host_record
));
memset
(
new
,
0
,
sizeof
(
struct
host_record
));
new
->
ttl
=
-
1
;
if
(
!
arg
||
!
(
comma
=
split
(
arg
)))
if
(
!
arg
||
!
(
comma
=
split
(
arg
)))
ret_err
(
_
(
"Bad host-record"
));
ret_err
(
_
(
"Bad host-record"
));
while
(
arg
)
while
(
arg
)
{
{
struct
all_addr
addr
;
struct
all_addr
addr
;
if
(
inet_pton
(
AF_INET
,
arg
,
&
addr
))
char
*
dig
;
for
(
dig
=
arg
;
*
dig
!=
0
;
dig
++
)
if
(
*
dig
<
'0'
||
*
dig
>
'9'
)
break
;
if
(
*
dig
==
0
)
new
->
ttl
=
atoi
(
arg
);
else
if
(
inet_pton
(
AF_INET
,
arg
,
&
addr
))
new
->
addr
=
addr
.
addr
.
addr4
;
new
->
addr
=
addr
.
addr
.
addr4
;
#ifdef HAVE_IPV6
#ifdef HAVE_IPV6
else
if
(
inet_pton
(
AF_INET6
,
arg
,
&
addr
))
else
if
(
inet_pton
(
AF_INET6
,
arg
,
&
addr
))
...
@@ -4601,7 +4613,25 @@ void read_opts(int argc, char **argv, char *compile_opts)
...
@@ -4601,7 +4613,25 @@ void read_opts(int argc, char **argv, char *compile_opts)
}
}
}
}
}
}
if
(
daemon
->
host_records
)
{
struct
host_record
*
hr
;
for
(
hr
=
daemon
->
host_records
;
hr
;
hr
=
hr
->
next
)
if
(
hr
->
ttl
==
-
1
)
hr
->
ttl
=
daemon
->
local_ttl
;
}
if
(
daemon
->
cnames
)
{
struct
cname
*
cn
;
for
(
cn
=
daemon
->
cnames
;
cn
;
cn
=
cn
->
next
)
if
(
cn
->
ttl
==
-
1
)
cn
->
ttl
=
daemon
->
local_ttl
;
}
if
(
daemon
->
if_addrs
)
if
(
daemon
->
if_addrs
)
{
{
struct
iname
*
tmp
;
struct
iname
*
tmp
;
...
...
src/rfc1035.c
View file @
df3d54f7
...
@@ -1169,9 +1169,13 @@ static unsigned long crec_ttl(struct crec *crecp, time_t now)
...
@@ -1169,9 +1169,13 @@ static unsigned long crec_ttl(struct crec *crecp, time_t now)
/* Return 0 ttl for DHCP entries, which might change
/* Return 0 ttl for DHCP entries, which might change
before the lease expires. */
before the lease expires. */
if
(
crecp
->
flags
&
(
F_IMMORTAL
|
F_DHCP
)
)
if
(
crecp
->
flags
&
F_DHCP
)
return
daemon
->
local_ttl
;
return
daemon
->
local_ttl
;
/* Immortal entries other than DHCP are local, and hold TTL in TTD field. */
if
(
crecp
->
flags
&
F_IMMORTAL
)
return
crecp
->
ttd
;
/* Return the Max TTL value if it is lower then the actual TTL */
/* Return the Max TTL value if it is lower then the actual TTL */
if
(
daemon
->
max_ttl
==
0
||
((
unsigned
)(
crecp
->
ttd
-
now
)
<
daemon
->
max_ttl
))
if
(
daemon
->
max_ttl
==
0
||
((
unsigned
)(
crecp
->
ttd
-
now
)
<
daemon
->
max_ttl
))
return
crecp
->
ttd
-
now
;
return
crecp
->
ttd
-
now
;
...
...
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