- Use IANA reserved example.com domain for rtadvd.conf(5).
- Fix 8-octet boundary calculation. Extra 8 octets were added when it was already on an 8-octet boundary. - Typos and style(9) fixes. Submitted by: bz
This commit is contained in:
parent
414167aef9
commit
d3d16bccfc
@ -102,7 +102,7 @@ dname_labelenc(char *dst, const char *src)
|
|||||||
*dst++ = len = MIN(63, len);
|
*dst++ = len = MIN(63, len);
|
||||||
else
|
else
|
||||||
*dst++ = len = MIN(63, p - src);
|
*dst++ = len = MIN(63, p - src);
|
||||||
/* Copy only 63 octets at most. */
|
/* Copy 63 octets at most. */
|
||||||
memcpy(dst, src, len);
|
memcpy(dst, src, len);
|
||||||
dst += len;
|
dst += len;
|
||||||
if (p == NULL) /* the last label */
|
if (p == NULL) /* the last label */
|
||||||
@ -1111,7 +1111,7 @@ make_packet(struct rainfo *rainfo)
|
|||||||
|
|
||||||
/* A zero octet and 8 octet boundary */
|
/* A zero octet and 8 octet boundary */
|
||||||
len++;
|
len++;
|
||||||
len += 8 - (len % 8);
|
len += (len % 8) ? 8 - len % 8 : 0;
|
||||||
|
|
||||||
packlen += len;
|
packlen += len;
|
||||||
}
|
}
|
||||||
@ -1275,7 +1275,7 @@ make_packet(struct rainfo *rainfo)
|
|||||||
|
|
||||||
/* Padding to next 8 octets boundary */
|
/* Padding to next 8 octets boundary */
|
||||||
len = buf - (char *)ndopt_dnssl;
|
len = buf - (char *)ndopt_dnssl;
|
||||||
len += 8 - (len % 8);
|
len += (len % 8) ? 8 - len % 8 : 0;
|
||||||
|
|
||||||
/* Length field must be in 8 octets */
|
/* Length field must be in 8 octets */
|
||||||
ndopt_dnssl->nd_opt_dnssl_len = len / 8;
|
ndopt_dnssl->nd_opt_dnssl_len = len / 8;
|
||||||
|
@ -240,7 +240,7 @@ if_dump(void)
|
|||||||
fprintf(fp, " Recursive DNS servers:\n"
|
fprintf(fp, " Recursive DNS servers:\n"
|
||||||
" Lifetime\tServers\n");
|
" Lifetime\tServers\n");
|
||||||
|
|
||||||
fprintf(fp, " % 8u\t", rdn->rd_ltime);
|
fprintf(fp, " %8u\t", rdn->rd_ltime);
|
||||||
TAILQ_FOREACH(rdna, &rdn->rd_list, ra_next) {
|
TAILQ_FOREACH(rdna, &rdn->rd_list, ra_next) {
|
||||||
inet_ntop(AF_INET6, &rdna->ra_dns,
|
inet_ntop(AF_INET6, &rdna->ra_dns,
|
||||||
prefixbuf, sizeof(prefixbuf));
|
prefixbuf, sizeof(prefixbuf));
|
||||||
@ -260,7 +260,7 @@ if_dump(void)
|
|||||||
fprintf(fp, " DNS search list:\n"
|
fprintf(fp, " DNS search list:\n"
|
||||||
" Lifetime\tDomains\n");
|
" Lifetime\tDomains\n");
|
||||||
|
|
||||||
fprintf(fp, " % 8u\t", dns->dn_ltime);
|
fprintf(fp, " %8u\t", dns->dn_ltime);
|
||||||
TAILQ_FOREACH(dnsa, &dns->dn_list, da_next) {
|
TAILQ_FOREACH(dnsa, &dns->dn_list, da_next) {
|
||||||
dname_labeldec(buf, sizeof(buf), dnsa->da_dom);
|
dname_labeldec(buf, sizeof(buf), dnsa->da_dom);
|
||||||
if (dnsa != TAILQ_FIRST(&dns->dn_list))
|
if (dnsa != TAILQ_FIRST(&dns->dn_list))
|
||||||
|
@ -450,9 +450,8 @@ rr_input(int len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi,
|
|||||||
* We rely on the kernel input routine for unicast addresses, and thus
|
* We rely on the kernel input routine for unicast addresses, and thus
|
||||||
* check multicast destinations only.
|
* check multicast destinations only.
|
||||||
*/
|
*/
|
||||||
if (IN6_IS_ADDR_MULTICAST(&pi->ipi6_addr) &&
|
if (IN6_IS_ADDR_MULTICAST(&pi->ipi6_addr) && !IN6_ARE_ADDR_EQUAL(
|
||||||
!IN6_ARE_ADDR_EQUAL(&sin6_sitelocal_allrouters.sin6_addr,
|
&sin6_sitelocal_allrouters.sin6_addr, &pi->ipi6_addr)) {
|
||||||
&pi->ipi6_addr)) {
|
|
||||||
syslog(LOG_NOTICE,
|
syslog(LOG_NOTICE,
|
||||||
"<%s>: RR message with invalid destination (%s) "
|
"<%s>: RR message with invalid destination (%s) "
|
||||||
"from %s on %s",
|
"from %s on %s",
|
||||||
|
@ -132,16 +132,19 @@ u_int32_t ndopt_flags[] = {
|
|||||||
[ND_OPT_RDNSS] = NDOPT_FLAG_RDNSS,
|
[ND_OPT_RDNSS] = NDOPT_FLAG_RDNSS,
|
||||||
[ND_OPT_DNSSL] = NDOPT_FLAG_DNSSL,
|
[ND_OPT_DNSSL] = NDOPT_FLAG_DNSSL,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sockaddr_in6 sin6_linklocal_allnodes = {
|
const struct sockaddr_in6 sin6_linklocal_allnodes = {
|
||||||
.sin6_len = sizeof(sin6_linklocal_allnodes),
|
.sin6_len = sizeof(sin6_linklocal_allnodes),
|
||||||
.sin6_family = AF_INET6,
|
.sin6_family = AF_INET6,
|
||||||
.sin6_addr = IN6ADDR_LINKLOCAL_ALLNODES_INIT,
|
.sin6_addr = IN6ADDR_LINKLOCAL_ALLNODES_INIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sockaddr_in6 sin6_linklocal_allrouters = {
|
const struct sockaddr_in6 sin6_linklocal_allrouters = {
|
||||||
.sin6_len = sizeof(sin6_linklocal_allrouters),
|
.sin6_len = sizeof(sin6_linklocal_allrouters),
|
||||||
.sin6_family = AF_INET6,
|
.sin6_family = AF_INET6,
|
||||||
.sin6_addr = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT,
|
.sin6_addr = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sockaddr_in6 sin6_sitelocal_allrouters = {
|
const struct sockaddr_in6 sin6_sitelocal_allrouters = {
|
||||||
.sin6_len = sizeof(sin6_sitelocal_allrouters),
|
.sin6_len = sizeof(sin6_sitelocal_allrouters),
|
||||||
.sin6_family = AF_INET6,
|
.sin6_family = AF_INET6,
|
||||||
@ -762,7 +765,7 @@ rtadvd_input(void)
|
|||||||
case ND_ROUTER_ADVERT:
|
case ND_ROUTER_ADVERT:
|
||||||
/*
|
/*
|
||||||
* Message verification - RFC-2461 6.1.2
|
* Message verification - RFC-2461 6.1.2
|
||||||
* XXX: there's a same dilemma as above...
|
* XXX: there's the same dilemma as above...
|
||||||
*/
|
*/
|
||||||
if (*hlimp != 255) {
|
if (*hlimp != 255) {
|
||||||
syslog(LOG_NOTICE,
|
syslog(LOG_NOTICE,
|
||||||
@ -1337,17 +1340,25 @@ nd6_options(struct nd_opt_hdr *hdr, int limit,
|
|||||||
* Option length check. Do it here for all fixed-length
|
* Option length check. Do it here for all fixed-length
|
||||||
* options.
|
* options.
|
||||||
*/
|
*/
|
||||||
if ((hdr->nd_opt_type == ND_OPT_MTU &&
|
switch (hdr->nd_opt_type) {
|
||||||
optlen != sizeof(struct nd_opt_mtu)) ||
|
case ND_OPT_MTU:
|
||||||
(hdr->nd_opt_type == ND_OPT_RDNSS &&
|
if (optlen == sizeof(struct nd_opt_mtu))
|
||||||
(optlen < 24 ||
|
break;
|
||||||
(optlen - sizeof(struct nd_opt_rdnss)) % 16 != 0)) ||
|
goto skip;
|
||||||
(hdr->nd_opt_type == ND_OPT_DNSSL &&
|
case ND_OPT_RDNSS:
|
||||||
(optlen < 16 ||
|
if (optlen >= 24 &&
|
||||||
(optlen - sizeof(struct nd_opt_dnssl)) % 8 != 0)) ||
|
(optlen - sizeof(struct nd_opt_rdnss)) % 16 == 0)
|
||||||
(hdr->nd_opt_type == ND_OPT_PREFIX_INFORMATION &&
|
break;
|
||||||
optlen != sizeof(struct nd_opt_prefix_info))
|
goto skip;
|
||||||
) {
|
case ND_OPT_DNSSL:
|
||||||
|
if (optlen >= 16 &&
|
||||||
|
(optlen - sizeof(struct nd_opt_dnssl)) % 8 == 0)
|
||||||
|
break;
|
||||||
|
goto skip;
|
||||||
|
case ND_OPT_PREFIX_INFORMATION:
|
||||||
|
if (optlen == sizeof(struct nd_opt_prefix_info))
|
||||||
|
break;
|
||||||
|
skip:
|
||||||
syslog(LOG_INFO, "<%s> invalid option length",
|
syslog(LOG_INFO, "<%s> invalid option length",
|
||||||
__func__);
|
__func__);
|
||||||
continue;
|
continue;
|
||||||
|
@ -19,4 +19,4 @@
|
|||||||
|
|
||||||
#ef0:\
|
#ef0:\
|
||||||
# :addr="2001:db8:ffff:1000::":prefixlen#64:\
|
# :addr="2001:db8:ffff:1000::":prefixlen#64:\
|
||||||
# :rddns="2001:db8:ffff:1000::1":dnssl="foo.com":
|
# :rdnss="2001:db8:ffff:1000::1":dnssl="example.com":
|
||||||
|
@ -385,13 +385,14 @@ manual page for resolver implementation in
|
|||||||
.It Cm \&rdnssltime
|
.It Cm \&rdnssltime
|
||||||
The lifetime of the
|
The lifetime of the
|
||||||
.Cm rdnss
|
.Cm rdnss
|
||||||
DNS server entries. The default value is 3/2 of the interval
|
DNS server entries.
|
||||||
time.
|
The default value is 3/2 of the interval time.
|
||||||
.It Cm \&dnssl
|
.It Cm \&dnssl
|
||||||
(str) One or more domain names in a comma-separated string.
|
(str) One or more domain names in a comma-separated string.
|
||||||
These domain names will be used when making DNS queries on a
|
These domain names will be used when making DNS queries on a
|
||||||
non-fully-qualified domain name. If different lifetimes are needed for
|
non-fully-qualified domain name.
|
||||||
different domains, separate entries can be given by using
|
If different lifetimes are needed for different domains, separate entries
|
||||||
|
can be given by using
|
||||||
.Cm dnssl ,
|
.Cm dnssl ,
|
||||||
.Cm dnssl0 ,
|
.Cm dnssl0 ,
|
||||||
.Cm dnssl1 ,
|
.Cm dnssl1 ,
|
||||||
@ -410,8 +411,8 @@ manual page for resolver implementation in
|
|||||||
.It Cm \&dnsslltime
|
.It Cm \&dnsslltime
|
||||||
The lifetime of the
|
The lifetime of the
|
||||||
.Cm dnssl
|
.Cm dnssl
|
||||||
DNS search list entries. The default value is 3/2 of the interval
|
DNS search list entries.
|
||||||
time.
|
The default value is 3/2 of the interval time.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
You can also refer one line from another by using
|
You can also refer one line from another by using
|
||||||
@ -457,8 +458,8 @@ using the default option lifetime values.
|
|||||||
.Bd -literal -offset
|
.Bd -literal -offset
|
||||||
wlan0:\\
|
wlan0:\\
|
||||||
:addr="2001:db8:ffff:1000::":prefixlen#64:\\
|
:addr="2001:db8:ffff:1000::":prefixlen#64:\\
|
||||||
:rdnss="2001:db8:ffff::10,2001:db8:ffff::2:43:\\
|
:rdnss="2001:db8:ffff::10,2001:db8:ffff::2:43":\\
|
||||||
:dnssl="foo.com":
|
:dnssl="example.com":
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The following example presents the default values in an explicit manner.
|
The following example presents the default values in an explicit manner.
|
||||||
|
@ -29,18 +29,23 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
|
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
|
||||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||||
|
|
||||||
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
|
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
|
||||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
||||||
|
|
||||||
#define IN6ADDR_SITELOCAL_ALLROUTERS_INIT \
|
#define IN6ADDR_SITELOCAL_ALLROUTERS_INIT \
|
||||||
{{{ 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
{{{ 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
||||||
|
|
||||||
extern const struct sockaddr_in6 sin6_linklocal_allnodes;
|
extern const struct sockaddr_in6 sin6_linklocal_allnodes;
|
||||||
extern const struct sockaddr_in6 sin6_linklocal_allrouters;
|
extern const struct sockaddr_in6 sin6_linklocal_allrouters;
|
||||||
extern const struct sockaddr_in6 sin6_sitelocal_allrouters;
|
extern const struct sockaddr_in6 sin6_sitelocal_allrouters;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RFC 3542 API deprecates IPV6_PKTINFO in favor of
|
* RFC 3542 API deprecates IPV6_PKTINFO in favor of
|
||||||
* IPV6_RECVPKTINFO
|
* IPV6_RECVPKTINFO
|
||||||
@ -50,6 +55,7 @@ extern const struct sockaddr_in6 sin6_sitelocal_allrouters;
|
|||||||
#define IPV6_RECVPKTINFO IPV6_PKTINFO
|
#define IPV6_RECVPKTINFO IPV6_PKTINFO
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RFC 3542 API deprecates IPV6_HOPLIMIT in favor of
|
* RFC 3542 API deprecates IPV6_HOPLIMIT in favor of
|
||||||
* IPV6_RECVHOPLIMIT
|
* IPV6_RECVHOPLIMIT
|
||||||
@ -123,6 +129,7 @@ struct rdnss_addr {
|
|||||||
|
|
||||||
struct in6_addr ra_dns; /* DNS server entry */
|
struct in6_addr ra_dns; /* DNS server entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rdnss {
|
struct rdnss {
|
||||||
TAILQ_ENTRY(rdnss) rd_next;
|
TAILQ_ENTRY(rdnss) rd_next;
|
||||||
|
|
||||||
@ -138,6 +145,7 @@ struct rdnss {
|
|||||||
*/
|
*/
|
||||||
#define _DNAME_LABELENC_MAXLEN \
|
#define _DNAME_LABELENC_MAXLEN \
|
||||||
(NI_MAXHOST + (NI_MAXHOST / 64 + 1) + 1)
|
(NI_MAXHOST + (NI_MAXHOST / 64 + 1) + 1)
|
||||||
|
|
||||||
#define DNAME_LABELENC_MAXLEN \
|
#define DNAME_LABELENC_MAXLEN \
|
||||||
(_DNAME_LABELENC_MAXLEN + 8 - _DNAME_LABELENC_MAXLEN % 8)
|
(_DNAME_LABELENC_MAXLEN + 8 - _DNAME_LABELENC_MAXLEN % 8)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user