suppress RS/RA log messages (can be re-enabled by net.inet6.icmp6.nd6_debug),

as they may fill up /var.  sync with kame.
This commit is contained in:
itojun 2001-04-04 06:28:41 +00:00
parent 2abaa8eae5
commit 5ed8fd262b

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6_rtr.c,v 1.21 2001/02/11 07:12:01 itojun Exp $ */ /* $NetBSD: nd6_rtr.c,v 1.22 2001/04/04 06:28:41 itojun Exp $ */
/* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */ /* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */
/* /*
@ -285,34 +285,38 @@ nd6_ra_input(m, off, icmp6len)
pi = (struct nd_opt_prefix_info *)pt; pi = (struct nd_opt_prefix_info *)pt;
if (pi->nd_opt_pi_len != 4) { if (pi->nd_opt_pi_len != 4) {
log(LOG_INFO, "nd6_ra_input: invalid option " nd6log((LOG_INFO,
"len %d for prefix information option, " "nd6_ra_input: invalid option "
"ignored\n", pi->nd_opt_pi_len); "len %d for prefix information option, "
"ignored\n", pi->nd_opt_pi_len));
continue; continue;
} }
if (128 < pi->nd_opt_pi_prefix_len) { if (128 < pi->nd_opt_pi_prefix_len) {
log(LOG_INFO, "nd6_ra_input: invalid prefix " nd6log((LOG_INFO,
"len %d for prefix information option, " "nd6_ra_input: invalid prefix "
"ignored\n", pi->nd_opt_pi_prefix_len); "len %d for prefix information option, "
"ignored\n", pi->nd_opt_pi_prefix_len));
continue; continue;
} }
if (IN6_IS_ADDR_MULTICAST(&pi->nd_opt_pi_prefix) if (IN6_IS_ADDR_MULTICAST(&pi->nd_opt_pi_prefix)
|| IN6_IS_ADDR_LINKLOCAL(&pi->nd_opt_pi_prefix)) { || IN6_IS_ADDR_LINKLOCAL(&pi->nd_opt_pi_prefix)) {
log(LOG_INFO, "nd6_ra_input: invalid prefix " nd6log((LOG_INFO,
"%s, ignored\n", "nd6_ra_input: invalid prefix "
ip6_sprintf(&pi->nd_opt_pi_prefix)); "%s, ignored\n",
ip6_sprintf(&pi->nd_opt_pi_prefix)));
continue; continue;
} }
/* aggregatable unicast address, rfc2374 */ /* aggregatable unicast address, rfc2374 */
if ((pi->nd_opt_pi_prefix.s6_addr8[0] & 0xe0) == 0x20 if ((pi->nd_opt_pi_prefix.s6_addr8[0] & 0xe0) == 0x20
&& pi->nd_opt_pi_prefix_len != 64) { && pi->nd_opt_pi_prefix_len != 64) {
log(LOG_INFO, "nd6_ra_input: invalid prefixlen " nd6log((LOG_INFO,
"%d for rfc2374 prefix %s, ignored\n", "nd6_ra_input: invalid prefixlen "
pi->nd_opt_pi_prefix_len, "%d for rfc2374 prefix %s, ignored\n",
ip6_sprintf(&pi->nd_opt_pi_prefix)); pi->nd_opt_pi_prefix_len,
ip6_sprintf(&pi->nd_opt_pi_prefix)));
continue; continue;
} }
@ -346,9 +350,9 @@ nd6_ra_input(m, off, icmp6len)
/* lower bound */ /* lower bound */
if (mtu < IPV6_MMTU) { if (mtu < IPV6_MMTU) {
log(LOG_INFO, "nd6_ra_input: bogus mtu option " nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option "
"mtu=%d sent from %s, ignoring\n", "mtu=%d sent from %s, ignoring\n",
mtu, ip6_sprintf(&ip6->ip6_src)); mtu, ip6_sprintf(&ip6->ip6_src)));
goto skip; goto skip;
} }
@ -361,17 +365,17 @@ nd6_ra_input(m, off, icmp6len)
if (change) /* in6_maxmtu may change */ if (change) /* in6_maxmtu may change */
in6_setmaxmtu(); in6_setmaxmtu();
} else { } else {
log(LOG_INFO, "nd6_ra_input: bogus mtu " nd6log((LOG_INFO, "nd6_ra_input: bogus mtu "
"mtu=%d sent from %s; " "mtu=%d sent from %s; "
"exceeds maxmtu %d, ignoring\n", "exceeds maxmtu %d, ignoring\n",
mtu, ip6_sprintf(&ip6->ip6_src), mtu, ip6_sprintf(&ip6->ip6_src),
ndi->maxmtu); ndi->maxmtu));
} }
} else { } else {
log(LOG_INFO, "nd6_ra_input: mtu option " nd6log((LOG_INFO, "nd6_ra_input: mtu option "
"mtu=%d sent from %s; maxmtu unknown, " "mtu=%d sent from %s; maxmtu unknown, "
"ignoring\n", "ignoring\n",
mtu, ip6_sprintf(&ip6->ip6_src)); mtu, ip6_sprintf(&ip6->ip6_src)));
} }
} }
@ -463,10 +467,10 @@ defrouter_addifreq(ifp)
* XXX: An IPv6 address are required to be assigned on the interface. * XXX: An IPv6 address are required to be assigned on the interface.
*/ */
if ((ifa = ifaof_ifpforaddr((struct sockaddr *)&def, ifp)) == NULL) { if ((ifa = ifaof_ifpforaddr((struct sockaddr *)&def, ifp)) == NULL) {
log(LOG_ERR, /* better error? */ nd6log((LOG_ERR, /* better error? */
"defrouter_addifreq: failed to find an ifaddr " "defrouter_addifreq: failed to find an ifaddr "
"to install a route to interface %s\n", "to install a route to interface %s\n",
if_name(ifp)); if_name(ifp)));
return; return;
} }
@ -476,10 +480,10 @@ defrouter_addifreq(ifp)
if ((error = rtrequest(RTM_ADD, (struct sockaddr *)&def, if ((error = rtrequest(RTM_ADD, (struct sockaddr *)&def,
ifa->ifa_addr, (struct sockaddr *)&mask, ifa->ifa_addr, (struct sockaddr *)&mask,
flags, NULL)) != 0) { flags, NULL)) != 0) {
log(LOG_ERR, nd6log((LOG_ERR,
"defrouter_addifreq: failed to install a route to " "defrouter_addifreq: failed to install a route to "
"interface %s (errno = %d)\n", "interface %s (errno = %d)\n",
if_name(ifp), error); if_name(ifp), error));
} }
} }
@ -895,8 +899,9 @@ prelist_update(new, dr, m)
new->ndpr_plen); new->ndpr_plen);
if (!ia6) { if (!ia6) {
error = EADDRNOTAVAIL; error = EADDRNOTAVAIL;
log(LOG_ERR, "prelist_update: failed to add a " nd6log((LOG_ERR,
"new address\n"); "prelist_update: failed to add a "
"new address\n"));
goto noautoconf1; goto noautoconf1;
} }
@ -990,8 +995,8 @@ prelist_update(new, dr, m)
&new->ndpr_addr, new->ndpr_plen); &new->ndpr_addr, new->ndpr_plen);
if (!ia6) { if (!ia6) {
error = EADDRNOTAVAIL; error = EADDRNOTAVAIL;
log(LOG_ERR, "prelist_update: " nd6log((LOG_ERR, "prelist_update: "
"failed to add a new address\n"); "failed to add a new address\n"));
goto noautoconf2; goto noautoconf2;
} }
/* set onlink bit if an interface route is configured */ /* set onlink bit if an interface route is configured */
@ -1121,12 +1126,12 @@ nd6_detach_prefix(pr)
e = rtrequest(RTM_DELETE, (struct sockaddr *)&sa6, NULL, e = rtrequest(RTM_DELETE, (struct sockaddr *)&sa6, NULL,
(struct sockaddr *)&mask6, 0, NULL); (struct sockaddr *)&mask6, 0, NULL);
if (e) { if (e) {
log(LOG_ERR, nd6log((LOG_ERR,
"nd6_detach_prefix: failed to delete route: " "nd6_detach_prefix: failed to delete route: "
"%s/%d (errno = %d)\n", "%s/%d (errno = %d)\n",
ip6_sprintf(&sa6.sin6_addr), ip6_sprintf(&sa6.sin6_addr),
pr->ndpr_plen, pr->ndpr_plen,
e); e));
} }
} }
@ -1156,10 +1161,10 @@ nd6_attach_prefix(pr)
ifa = ifaof_ifpforaddr((struct sockaddr *)&pr->ndpr_prefix, ifa = ifaof_ifpforaddr((struct sockaddr *)&pr->ndpr_prefix,
pr->ndpr_ifp); pr->ndpr_ifp);
if (ifa == NULL) { if (ifa == NULL) {
log(LOG_ERR, nd6log((LOG_ERR,
"nd6_attach_prefix: failed to find any ifaddr" "nd6_attach_prefix: failed to find any ifaddr"
" to add route for a prefix(%s/%d)\n", " to add route for a prefix(%s/%d)\n",
ip6_sprintf(&pr->ndpr_addr), pr->ndpr_plen); ip6_sprintf(&pr->ndpr_addr), pr->ndpr_plen));
} }
else { else {
int e; int e;
@ -1175,10 +1180,10 @@ nd6_attach_prefix(pr)
if (e == 0) if (e == 0)
pr->ndpr_statef_onlink = 1; pr->ndpr_statef_onlink = 1;
else { else {
log(LOG_DEBUG, nd6log((LOG_DEBUG,
"nd6_attach_prefix: failed to add route for" "nd6_attach_prefix: failed to add route for"
" a prefix(%s/%d), errno = %d\n", " a prefix(%s/%d), errno = %d\n",
ip6_sprintf(&pr->ndpr_addr), pr->ndpr_plen, e); ip6_sprintf(&pr->ndpr_addr), pr->ndpr_plen, e));
} }
} }
@ -1228,10 +1233,10 @@ in6_ifadd(ifp, in6, addr, prefixlen)
/* prefixlen + ifidlen must be equal to 128 */ /* prefixlen + ifidlen must be equal to 128 */
if (prefixlen != in6_mask2len(&ib->ia_prefixmask.sin6_addr)) { if (prefixlen != in6_mask2len(&ib->ia_prefixmask.sin6_addr)) {
log(LOG_ERR, "in6_ifadd: wrong prefixlen for %s" nd6log((LOG_ERR, "in6_ifadd: wrong prefixlen for %s"
"(prefix=%d ifid=%d)\n", if_name(ifp), "(prefix=%d ifid=%d)\n", if_name(ifp),
prefixlen, prefixlen,
128 - in6_mask2len(&ib->ia_prefixmask.sin6_addr)); 128 - in6_mask2len(&ib->ia_prefixmask.sin6_addr)));
return NULL; return NULL;
} }
@ -1306,10 +1311,11 @@ in6_ifadd(ifp, in6, addr, prefixlen)
/* add interface route */ /* add interface route */
if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_UP|RTF_CLONING))) { if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_UP|RTF_CLONING))) {
log(LOG_NOTICE, "in6_ifadd: failed to add an interface route " nd6log((LOG_NOTICE,
"in6_ifadd: failed to add an interface route "
"for %s/%d on %s, errno = %d\n", "for %s/%d on %s, errno = %d\n",
ip6_sprintf(&ia->ia_addr.sin6_addr), prefixlen, ip6_sprintf(&ia->ia_addr.sin6_addr), prefixlen,
if_name(ifp), error); if_name(ifp), error));
} }
else else
ia->ia_flags |= IFA_ROUTE; ia->ia_flags |= IFA_ROUTE;
@ -1428,9 +1434,9 @@ in6_init_prefix_ltimes(struct nd_prefix *ndpr)
/* check if preferred lifetime > valid lifetime */ /* check if preferred lifetime > valid lifetime */
if (ndpr->ndpr_pltime > ndpr->ndpr_vltime) { if (ndpr->ndpr_pltime > ndpr->ndpr_vltime) {
log(LOG_INFO, "in6_init_prefix_ltimes: preferred lifetime" nd6log((LOG_INFO, "in6_init_prefix_ltimes: preferred lifetime"
"(%d) is greater than valid lifetime(%d)\n", "(%d) is greater than valid lifetime(%d)\n",
(u_int)ndpr->ndpr_pltime, (u_int)ndpr->ndpr_vltime); (u_int)ndpr->ndpr_pltime, (u_int)ndpr->ndpr_vltime));
return (EINVAL); return (EINVAL);
} }
if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME) if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME)