summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorozaki-r <ozaki-r@NetBSD.org>2016-04-01 08:12:00 +0000
committerozaki-r <ozaki-r@NetBSD.org>2016-04-01 08:12:00 +0000
commit19aa63f2ea8da201b263ee4394f2d6e7bbe2b8d3 (patch)
treecc97e7effbbf2c4fa19dfd24fe426b5e635caf56 /sys
parent3b69851f368359fd327a7597aed1d5e6307f3558 (diff)
Refine nd6log
Add __func__ to nd6log itself instead of adding it to callers.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet6/icmp6.c90
-rw-r--r--sys/netinet6/in6.c74
-rw-r--r--sys/netinet6/in6_ifattach.c58
-rw-r--r--sys/netinet6/ip6_input.c9
-rw-r--r--sys/netinet6/nd6.c22
-rw-r--r--sys/netinet6/nd6.h5
-rw-r--r--sys/netinet6/nd6_nbr.c88
-rw-r--r--sys/netinet6/nd6_rtr.c174
8 files changed, 236 insertions, 284 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 8ff81f021d9..0a8ee6dbe17 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.179 2016/01/21 15:41:30 riastradh Exp $ */
+/* $NetBSD: icmp6.c,v 1.180 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.179 2016/01/21 15:41:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.180 2016/04/01 08:12:00 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -404,7 +404,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param)
if (m && M_UNWRITABLE(m, preplen))
m = m_pullup(m, preplen);
if (m == NULL) {
- nd6log((LOG_DEBUG, "ENOBUFS in icmp6_error %d\n", __LINE__));
+ nd6log(LOG_DEBUG, "ENOBUFS in icmp6_error %d\n", __LINE__);
return;
}
@@ -492,9 +492,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
code = icmp6->icmp6_code;
if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) {
- nd6log((LOG_ERR,
- "ICMP6 checksum error(%d|%x) %s\n",
- icmp6->icmp6_type, sum, ip6_sprintf(&ip6->ip6_src)));
+ nd6log(LOG_ERR, "ICMP6 checksum error(%d|%x) %s\n",
+ icmp6->icmp6_type, sum, ip6_sprintf(&ip6->ip6_src));
ICMP6_STATINC(ICMP6_STAT_CHECKSUM);
icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
goto freeit;
@@ -850,11 +849,10 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
break;
default:
- nd6log((LOG_DEBUG,
- "icmp6_input: unknown type %d(src=%s, dst=%s, ifid=%d)\n",
+ nd6log(LOG_DEBUG, "unknown type %d(src=%s, dst=%s, ifid=%d)\n",
icmp6->icmp6_type, ip6_sprintf(&ip6->ip6_src),
ip6_sprintf(&ip6->ip6_dst),
- m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0));
+ m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0);
if (icmp6->icmp6_type < ICMP6_ECHO_REQUEST) {
/* ICMPv6 error: MUST deliver it by spec... */
code = PRC_NCMDS;
@@ -1965,10 +1963,10 @@ icmp6_reflect(struct mbuf *m, size_t off)
/* too short to reflect */
if (off < sizeof(struct ip6_hdr)) {
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"sanity fail: off=%lx, sizeof(ip6)=%lx in %s:%d\n",
(u_long)off, (u_long)sizeof(struct ip6_hdr),
- __FILE__, __LINE__));
+ __FILE__, __LINE__);
goto bad;
}
@@ -2065,10 +2063,10 @@ icmp6_reflect(struct mbuf *m, size_t off)
src = in6_selectsrc(&sin6, NULL, NULL, &ro, NULL, &outif, &e);
rtcache_free(&ro);
if (src == NULL) {
- nd6log((LOG_DEBUG,
- "icmp6_reflect: source can't be determined: "
+ nd6log(LOG_DEBUG,
+ "source can't be determined: "
"dst=%s, error=%d\n",
- ip6_sprintf(&sin6.sin6_addr), e));
+ ip6_sprintf(&sin6.sin6_addr), e);
goto bad;
}
}
@@ -2166,16 +2164,16 @@ icmp6_redirect_input(struct mbuf *m, int off)
/* validation */
if (!IN6_IS_ADDR_LINKLOCAL(&src6)) {
- nd6log((LOG_ERR,
- "ICMP6 redirect sent from %s rejected; "
- "must be from linklocal\n", ip6_sprintf(&src6)));
+ nd6log(LOG_ERR,
+ "ICMP6 redirect sent from %s rejected; "
+ "must be from linklocal\n", ip6_sprintf(&src6));
goto bad;
}
if (ip6->ip6_hlim != 255) {
- nd6log((LOG_ERR,
- "ICMP6 redirect sent from %s rejected; "
- "hlim=%d (must be 255)\n",
- ip6_sprintf(&src6), ip6->ip6_hlim));
+ nd6log(LOG_ERR,
+ "ICMP6 redirect sent from %s rejected; "
+ "hlim=%d (must be 255)\n",
+ ip6_sprintf(&src6), ip6->ip6_hlim);
goto bad;
}
{
@@ -2188,40 +2186,37 @@ icmp6_redirect_input(struct mbuf *m, int off)
if (rt) {
if (rt->rt_gateway == NULL ||
rt->rt_gateway->sa_family != AF_INET6) {
- nd6log((LOG_ERR,
+ nd6log(LOG_ERR,
"ICMP6 redirect rejected; no route "
"with inet6 gateway found for redirect dst: %s\n",
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
rtfree(rt);
goto bad;
}
gw6 = &(((struct sockaddr_in6 *)rt->rt_gateway)->sin6_addr);
if (memcmp(&src6, gw6, sizeof(struct in6_addr)) != 0) {
- nd6log((LOG_ERR,
- "ICMP6 redirect rejected; "
- "not equal to gw-for-src=%s (must be same): "
- "%s\n",
- ip6_sprintf(gw6),
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ nd6log(LOG_ERR,
+ "ICMP6 redirect rejected; "
+ "not equal to gw-for-src=%s (must be same): %s\n",
+ ip6_sprintf(gw6),
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
rtfree(rt);
goto bad;
}
} else {
- nd6log((LOG_ERR,
- "ICMP6 redirect rejected; "
- "no route found for redirect dst: %s\n",
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ nd6log(LOG_ERR, "ICMP6 redirect rejected; "
+ "no route found for redirect dst: %s\n",
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
goto bad;
}
rtfree(rt);
rt = NULL;
}
if (IN6_IS_ADDR_MULTICAST(&reddst6)) {
- nd6log((LOG_ERR,
- "ICMP6 redirect rejected; "
- "redirect dst must be unicast: %s\n",
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ nd6log(LOG_ERR, "ICMP6 redirect rejected; "
+ "redirect dst must be unicast: %s\n",
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
goto bad;
}
@@ -2231,10 +2226,9 @@ icmp6_redirect_input(struct mbuf *m, int off)
if (memcmp(&redtgt6, &reddst6, sizeof(redtgt6)) == 0)
is_onlink = 1; /* on-link destination case */
if (!is_router && !is_onlink) {
- nd6log((LOG_ERR,
- "ICMP6 redirect rejected; "
- "neither router case nor onlink case: %s\n",
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ nd6log(LOG_ERR, "ICMP6 redirect rejected; "
+ "neither router case nor onlink case: %s\n",
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
goto bad;
}
/* validation passed */
@@ -2242,9 +2236,8 @@ icmp6_redirect_input(struct mbuf *m, int off)
icmp6len -= sizeof(*nd_rd);
nd6_option_init(nd_rd + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
- nd6log((LOG_INFO, "icmp6_redirect_input: "
- "invalid ND option, rejected: %s\n",
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ nd6log(LOG_INFO, "invalid ND option, rejected: %s\n",
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
/* nd6_options have incremented stats */
goto freeit;
}
@@ -2255,11 +2248,10 @@ icmp6_redirect_input(struct mbuf *m, int off)
}
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
- nd6log((LOG_INFO,
- "icmp6_redirect_input: lladdrlen mismatch for %s "
- "(if %d, icmp6 packet %d): %s\n",
- ip6_sprintf(&redtgt6), ifp->if_addrlen, lladdrlen - 2,
- icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+ nd6log(LOG_INFO, "lladdrlen mismatch for %s "
+ "(if %d, icmp6 packet %d): %s\n",
+ ip6_sprintf(&redtgt6), ifp->if_addrlen, lladdrlen - 2,
+ icmp6_redirect_diag(&src6, &reddst6, &redtgt6));
goto bad;
}
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 9a858c12a02..fd2dbbf9586 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.196 2016/04/01 06:25:51 ozaki-r Exp $ */
+/* $NetBSD: in6.c,v 1.197 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.196 2016/04/01 06:25:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.197 2016/04/01 08:12:00 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -844,15 +844,13 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) == 0) {
/* XXX: noisy message */
- nd6log((LOG_INFO, "%s: a destination can "
- "be specified for a p2p or a loopback IF only\n",
- __func__));
+ nd6log(LOG_INFO, "a destination can "
+ "be specified for a p2p or a loopback IF only\n");
return EINVAL;
}
if (plen != 128) {
- nd6log((LOG_INFO, "%s: prefixlen should "
- "be 128 when dstaddr is specified\n",
- __func__));
+ nd6log(LOG_INFO, "prefixlen should "
+ "be 128 when dstaddr is specified\n");
#ifdef FORCE_P2PPLEN
/*
* To be compatible with old configurations,
@@ -880,9 +878,8 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
* the following log might be noisy, but this is a typical
* configuration mistake or a tool's bug.
*/
- nd6log((LOG_INFO,
- "%s: valid lifetime is 0 for %s\n", __func__,
- ip6_sprintf(&ifra->ifra_addr.sin6_addr)));
+ nd6log(LOG_INFO, "valid lifetime is 0 for %s\n",
+ ip6_sprintf(&ifra->ifra_addr.sin6_addr));
if (ia == NULL)
return 0; /* there's nothing to do */
@@ -949,9 +946,9 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
*/
if (ia->ia_prefixmask.sin6_len &&
in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) {
- nd6log((LOG_INFO, "%s: the prefix length of an"
+ nd6log(LOG_INFO, "the prefix length of an"
" existing (%s) address should not be changed\n",
- __func__, ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ ip6_sprintf(&ia->ia_addr.sin6_addr));
error = EINVAL;
goto unlink;
}
@@ -967,9 +964,9 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
!IN6_ARE_ADDR_EQUAL(&dst6.sin6_addr, &ia->ia_dstaddr.sin6_addr)) {
if ((ia->ia_flags & IFA_ROUTE) != 0 &&
rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST) != 0) {
- nd6log((LOG_ERR, "%s: failed to remove "
- "a route to the old destination: %s\n", __func__,
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ nd6log(LOG_ERR, "failed to remove "
+ "a route to the old destination: %s\n",
+ ip6_sprintf(&ia->ia_addr.sin6_addr));
/* proceed anyway... */
} else
ia->ia_flags &= ~IFA_ROUTE;
@@ -1070,10 +1067,9 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
/* join solicited multicast addr for new host id */
imm = in6_joingroup(ifp, &llsol, &error, dad_delay);
if (!imm) {
- nd6log((LOG_ERR,
- "%s: addmulti failed for %s on %s (errno=%d)\n",
- __func__, ip6_sprintf(&llsol), if_name(ifp),
- error));
+ nd6log(LOG_ERR,
+ "addmulti failed for %s on %s (errno=%d)\n",
+ ip6_sprintf(&llsol), if_name(ifp), error);
goto cleanup;
}
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
@@ -1135,10 +1131,10 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
}
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0);
if (!imm) {
- nd6log((LOG_WARNING,
- "%s: addmulti failed for %s on %s (errno=%d)\n",
- __func__, ip6_sprintf(&mltaddr.sin6_addr),
- if_name(ifp), error));
+ nd6log(LOG_WARNING,
+ "addmulti failed for %s on %s (errno=%d)\n",
+ ip6_sprintf(&mltaddr.sin6_addr),
+ if_name(ifp), error);
goto cleanup;
}
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
@@ -1159,10 +1155,10 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
;
else if ((imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error,
dad_delay)) == NULL) { /* XXX jinmei */
- nd6log((LOG_WARNING,
- "%s: addmulti failed for %s on %s (errno=%d)\n",
- __func__, ip6_sprintf(&mltaddr.sin6_addr),
- if_name(ifp), error));
+ nd6log(LOG_WARNING,
+ "addmulti failed for %s on %s (errno=%d)\n",
+ ip6_sprintf(&mltaddr.sin6_addr),
+ if_name(ifp), error);
/* XXX not very fatal, go on... */
} else {
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
@@ -1219,10 +1215,10 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
}
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0);
if (!imm) {
- nd6log((LOG_WARNING,
- "%s: addmulti failed for %s on %s (errno=%d)\n",
- __func__, ip6_sprintf(&mltaddr.sin6_addr),
- if_name(ifp), error));
+ nd6log(LOG_WARNING,
+ "addmulti failed for %s on %s (errno=%d)\n",
+ ip6_sprintf(&mltaddr.sin6_addr),
+ if_name(ifp), error);
goto cleanup;
} else {
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
@@ -1383,8 +1379,8 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp)
* positive reference.
*/
if (oia->ia6_ndpr == NULL) {
- nd6log((LOG_NOTICE, "in6_unlink_ifa: autoconf'ed address "
- "%p has no prefix\n", oia));
+ nd6log(LOG_NOTICE, "autoconf'ed address %p has no prefix\n",
+ oia);
} else {
oia->ia6_ndpr->ndpr_refcnt--;
oia->ia6_ndpr = NULL;
@@ -2066,9 +2062,8 @@ in6_if_link_up(struct ifnet *ifp)
ia->ia6_flags &= ~IN6_IFF_DETACHED;
if (if_do_dad(ifp)) {
ia->ia6_flags |= IN6_IFF_TENTATIVE;
- nd6log((LOG_ERR, "in6_if_up: "
- "%s marked tentative\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ nd6log(LOG_ERR, "%s marked tentative\n",
+ ip6_sprintf(&ia->ia_addr.sin6_addr));
} else if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0)
rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
}
@@ -2138,9 +2133,8 @@ in6_if_link_down(struct ifnet *ifp)
* are marked tentative and DAD commences.
*/
if (!(ia->ia6_flags & IN6_IFF_DETACHED)) {
- nd6log((LOG_DEBUG, "in6_if_down: "
- "%s marked detached\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ nd6log(LOG_DEBUG, "%s marked detached\n",
+ ip6_sprintf(&ia->ia_addr.sin6_addr));
ia->ia6_flags |= IN6_IFF_DETACHED;
ia->ia6_flags &=
~(IN6_IFF_TENTATIVE | IN6_IFF_DUPLICATED);
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index cca24817ecd..d6a62b0f789 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_ifattach.c,v 1.95 2015/02/23 19:15:59 martin Exp $ */
+/* $NetBSD: in6_ifattach.c,v 1.96 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.95 2015/02/23 19:15:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.96 2016/04/01 08:12:00 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -282,8 +282,7 @@ generate_tmp_ifid(u_int8_t *seed0, const u_int8_t *seed1, u_int8_t *ret)
* all 0 IDs to tell the caller not to make a
* temporary address.
*/
- nd6log((LOG_NOTICE,
- "generate_tmp_ifid: never found a good ID\n"));
+ nd6log(LOG_NOTICE, "never found a good ID\n");
memset(ret, 0, 8);
}
}
@@ -459,15 +458,15 @@ get_ifid(struct ifnet *ifp0, struct ifnet *altifp,
/* first, try to get it from the interface itself */
if (in6_get_hw_ifid(ifp0, in6) == 0) {
- nd6log((LOG_DEBUG, "%s: got interface identifier from itself\n",
- if_name(ifp0)));
+ nd6log(LOG_DEBUG, "%s: got interface identifier from itself\n",
+ if_name(ifp0));
goto success;
}
/* try secondary EUI64 source. this basically is for ATM PVC */
if (altifp && in6_get_hw_ifid(altifp, in6) == 0) {
- nd6log((LOG_DEBUG, "%s: got interface identifier from %s\n",
- if_name(ifp0), if_name(altifp)));
+ nd6log(LOG_DEBUG, "%s: got interface identifier from %s\n",
+ if_name(ifp0), if_name(altifp));
goto success;
}
@@ -483,9 +482,9 @@ get_ifid(struct ifnet *ifp0, struct ifnet *altifp,
* globally unique
*/
if (IFID_UNIVERSAL(in6)) {
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"%s: borrow interface identifier from %s\n",
- if_name(ifp0), if_name(ifp)));
+ if_name(ifp0), if_name(ifp));
goto success;
}
}
@@ -493,18 +492,18 @@ get_ifid(struct ifnet *ifp0, struct ifnet *altifp,
#if 0
/* get from hostid - only for certain architectures */
if (get_hostid_ifid(ifp, in6) == 0) {
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"%s: interface identifier generated by hostid\n",
- if_name(ifp0)));
+ if_name(ifp0));
goto success;
}
#endif
/* last resort: get from random number source */
if (get_rand_ifid(ifp, in6) == 0) {
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"%s: interface identifier generated by random number\n",
- if_name(ifp0)));
+ if_name(ifp0));
goto success;
}
@@ -512,10 +511,10 @@ get_ifid(struct ifnet *ifp0, struct ifnet *altifp,
return -1;
success:
- nd6log((LOG_INFO, "%s: ifid: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
+ nd6log(LOG_INFO, "%s: ifid: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
if_name(ifp0), in6->s6_addr[8], in6->s6_addr[9], in6->s6_addr[10],
in6->s6_addr[11], in6->s6_addr[12], in6->s6_addr[13],
- in6->s6_addr[14], in6->s6_addr[15]));
+ in6->s6_addr[14], in6->s6_addr[15]);
return 0;
}
@@ -551,8 +550,8 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
ifra.ifra_addr.sin6_addr.s6_addr32[3] = htonl(1);
} else {
if (get_ifid(ifp, altifp, &ifra.ifra_addr.sin6_addr) != 0) {
- nd6log((LOG_ERR,
- "%s: no ifid available\n", if_name(ifp)));
+ nd6log(LOG_ERR,
+ "%s: no ifid available\n", if_name(ifp));
return -1;
}
}
@@ -579,10 +578,10 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
* suppress it. (jinmei@kame.net 20010130)
*/
if (error != EAFNOSUPPORT)
- nd6log((LOG_NOTICE, "in6_ifattach_linklocal: failed to "
- "configure a link-local address on %s "
+ nd6log(LOG_NOTICE,
+ "failed to configure a link-local address on %s "
"(errno=%d)\n",
- if_name(ifp), error));
+ if_name(ifp), error);
return -1;
}
@@ -669,9 +668,9 @@ in6_ifattach_loopback(struct ifnet *ifp)
* NULL to the 3rd arg.
*/
if ((error = in6_update_ifa(ifp, &ifra, NULL, 0)) != 0) {
- nd6log((LOG_ERR, "in6_ifattach_loopback: failed to configure "
+ nd6log(LOG_ERR, "failed to configure "
"the loopback address on %s (errno=%d)\n",
- if_name(ifp), error));
+ if_name(ifp), error);
return -1;
}
@@ -764,9 +763,8 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
* fragmentation logic.
*/
if (ifp->if_mtu < IPV6_MMTU) {
- nd6log((LOG_INFO, "in6_ifattach: "
- "%s has too small MTU, IPv6 not enabled\n",
- if_name(ifp)));
+ nd6log(LOG_INFO, "%s has too small MTU, IPv6 not enabled\n",
+ if_name(ifp));
return;
}
@@ -798,9 +796,9 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
* usually, we require multicast capability to the interface
*/
if ((ifp->if_flags & IFF_MULTICAST) == 0) {
- nd6log((LOG_INFO, "in6_ifattach: "
+ nd6log(LOG_INFO,
"%s is not multicast capable, IPv6 not enabled\n",
- if_name(ifp)));
+ if_name(ifp));
return;
}
@@ -899,9 +897,9 @@ in6_ifdetach(struct ifnet *ifp)
if (ia->ia_next)
ia->ia_next = oia->ia_next;
else {
- nd6log((LOG_ERR,
+ nd6log(LOG_ERR,
"%s: didn't unlink in6ifaddr from list\n",
- if_name(ifp)));
+ if_name(ifp));
}
}
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 941618ffe7a..b354ed838f4 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $ */
+/* $NetBSD: ip6_input.c,v 1.157 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.157 2016/04/01 08:12:00 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@@ -500,10 +500,9 @@ ip6_input(struct mbuf *m)
goto hbhcheck;
} else {
/* address is not ready, so discard the packet. */
- nd6log((LOG_INFO,
- "ip6_input: packet to an unready address %s->%s\n",
+ nd6log(LOG_INFO, "packet to an unready address %s->%s\n",
ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst)));
+ ip6_sprintf(&ip6->ip6_dst));
goto bad;
}
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 6885a1379f8..b68fdfc0e1b 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $ */
+/* $NetBSD: nd6.c,v 1.187 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.187 2016/04/01 08:12:00 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -338,9 +338,9 @@ nd6_options(union nd_opts *ndopts)
case ND_OPT_MTU:
case ND_OPT_REDIRECTED_HEADER:
if (ndopts->nd_opt_array[nd_opt->nd_opt_type]) {
- nd6log((LOG_INFO,
+ nd6log(LOG_INFO,
"duplicated ND6 option found (type=%d)\n",
- nd_opt->nd_opt_type));
+ nd_opt->nd_opt_type);
/* XXX bark? */
} else {
ndopts->nd_opt_array[nd_opt->nd_opt_type]
@@ -360,16 +360,16 @@ nd6_options(union nd_opts *ndopts)
* Unknown options must be silently ignored,
* to accommodate future extension to the protocol.
*/
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"nd6_options: unsupported option %d - "
- "option ignored\n", nd_opt->nd_opt_type));
+ "option ignored\n", nd_opt->nd_opt_type);
}
skip1:
i++;
if (i > nd6_maxndopt) {
ICMP6_STATINC(ICMP6_STAT_ND_TOOMANYOPT);
- nd6log((LOG_INFO, "too many loop in nd opt\n"));
+ nd6log(LOG_INFO, "too many loop in nd opt\n");
break;
}
@@ -988,10 +988,10 @@ nd6_lookup1(const struct in6_addr *addr6, int create, struct ifnet *ifp,
rt->rt_gateway->sa_family != AF_LINK || rt->rt_llinfo == NULL ||
(ifp && rt->rt_ifa->ifa_ifp != ifp)) {
if (create) {
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"nd6_lookup: failed to lookup %s (if = %s)\n",
ip6_sprintf(addr6),
- ifp ? if_name(ifp) : "unspec"));
+ ifp ? if_name(ifp) : "unspec");
}
rtfree(rt);
return NULL;
@@ -1563,9 +1563,9 @@ nd6_rtrequest(int req, struct rtentry *rt, const struct rt_addrinfo *info)
if (in6_setscope(&llsol, ifp, NULL))
break;
if (!in6_addmulti(&llsol, ifp, &error, 0)) {
- nd6log((LOG_ERR, "%s: failed to join "
+ nd6log(LOG_ERR, "%s: failed to join "
"%s (errno=%d)\n", if_name(ifp),
- ip6_sprintf(&llsol), error));
+ ip6_sprintf(&llsol), error);
}
}
}
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index efd17804cc2..e40997ca3b2 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.h,v 1.70 2016/04/01 05:11:38 ozaki-r Exp $ */
+/* $NetBSD: nd6.h,v 1.71 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -350,7 +350,8 @@ extern struct nd_drhead nd_defrouter;
extern struct nd_prhead nd_prefix;
extern int nd6_debug;
-#define nd6log(x) do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0)
+#define nd6log(level, fmt, args...) \
+ do { if (nd6_debug) log(level, "%s: " fmt, __func__, ##args);} while (0)
/* nd6_rtr.c */
extern int nd6_defifindex;
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 1eba8de784e..9a0a83dc36f 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_nbr.c,v 1.113 2015/12/07 06:19:13 ozaki-r Exp $ */
+/* $NetBSD: nd6_nbr.c,v 1.114 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.113 2015/12/07 06:19:13 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.114 2016/04/01 08:12:00 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -123,10 +123,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
goto bad;
if (ip6->ip6_hlim != 255) {
- nd6log((LOG_ERR,
- "nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n",
+ nd6log(LOG_ERR, "invalid hlim (%d) from %s to %s on %s\n",
ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6_sprintf(&ip6->ip6_dst), if_name(ifp));
goto bad;
}
@@ -139,8 +138,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
daddr6.s6_addr8[12] == 0xff) {
; /* good */
} else {
- nd6log((LOG_INFO, "nd6_ns_input: bad DAD packet "
- "(wrong ip6 dst)\n"));
+ nd6log(LOG_INFO, "bad DAD packet (wrong ip6 dst)\n");
goto bad;
}
} else {
@@ -151,23 +149,21 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
*/
sockaddr_in6_init(&ssin6, &saddr6, 0, 0, 0);
if (nd6_is_addr_neighbor(&ssin6, ifp) == 0) {
- nd6log((LOG_INFO, "nd6_ns_input: "
- "NS packet from non-neighbor\n"));
+ nd6log(LOG_INFO, "NS packet from non-neighbor\n");
goto bad;
}
}
if (IN6_IS_ADDR_MULTICAST(&taddr6)) {
- nd6log((LOG_INFO, "nd6_ns_input: bad NS target (multicast)\n"));
+ nd6log(LOG_INFO, "bad NS target (multicast)\n");
goto bad;
}
icmp6len -= sizeof(*nd_ns);
nd6_option_init(nd_ns + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
- nd6log((LOG_INFO,
- "nd6_ns_input: invalid ND option, ignored\n"));
+ nd6log(LOG_INFO, "invalid ND option, ignored\n");
/* nd6_options have incremented stats */
goto freeit;
}
@@ -178,8 +174,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
}
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) && lladdr) {
- nd6log((LOG_INFO, "nd6_ns_input: bad DAD packet "
- "(link-layer address option)\n"));
+ nd6log(LOG_INFO,
+ "bad DAD packet (link-layer address option)\n");
goto bad;
}
@@ -261,15 +257,15 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
goto freeit;
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
- nd6log((LOG_INFO, "nd6_ns_input: lladdrlen mismatch for %s "
+ nd6log(LOG_INFO, "lladdrlen mismatch for %s "
"(if %d, NS packet %d)\n",
- ip6_sprintf(&taddr6), ifp->if_addrlen, lladdrlen - 2));
+ ip6_sprintf(&taddr6), ifp->if_addrlen, lladdrlen - 2);
goto bad;
}
if (IN6_ARE_ADDR_EQUAL(&myaddr6, &saddr6)) {
- nd6log((LOG_INFO, "nd6_ns_input: duplicate IP6 address %s\n",
- ip6_sprintf(&saddr6)));
+ nd6log(LOG_INFO, "duplicate IP6 address %s\n",
+ ip6_sprintf(&saddr6));
goto freeit;
}
@@ -331,9 +327,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
return;
bad:
- nd6log((LOG_ERR, "nd6_ns_input: src=%s\n", ip6_sprintf(&saddr6)));
- nd6log((LOG_ERR, "nd6_ns_input: dst=%s\n", ip6_sprintf(&daddr6)));
- nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n", ip6_sprintf(&taddr6)));
+ nd6log(LOG_ERR, "src=%s\n", ip6_sprintf(&saddr6));
+ nd6log(LOG_ERR, "dst=%s\n", ip6_sprintf(&daddr6));
+ nd6log(LOG_ERR, "tgt=%s\n", ip6_sprintf(&taddr6));
ICMP6_STATINC(ICMP6_STAT_BADNS);
m_freem(m);
}
@@ -450,10 +446,9 @@ nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6,
src = in6_selectsrc(&dst_sa, NULL,
NULL, &ro, NULL, NULL, &error);
if (src == NULL) {
- nd6log((LOG_DEBUG,
- "nd6_ns_output: source can't be "
+ nd6log(LOG_DEBUG, "source can't be "
"determined: dst=%s, error=%d\n",
- ip6_sprintf(&dst_sa.sin6_addr), error));
+ ip6_sprintf(&dst_sa.sin6_addr), error);
goto bad;
}
}
@@ -556,10 +551,10 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
int rt_announce;
if (ip6->ip6_hlim != 255) {
- nd6log((LOG_ERR,
- "nd6_na_input: invalid hlim (%d) from %s to %s on %s\n",
+ nd6log(LOG_ERR,
+ "invalid hlim (%d) from %s to %s on %s\n",
ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6_sprintf(&ip6->ip6_dst), if_name(ifp));
goto bad;
}
@@ -579,22 +574,19 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
return; /* XXX: impossible */
if (IN6_IS_ADDR_MULTICAST(&taddr6)) {
- nd6log((LOG_ERR,
- "nd6_na_input: invalid target address %s\n",
- ip6_sprintf(&taddr6)));
+ nd6log(LOG_ERR, "invalid target address %s\n",
+ ip6_sprintf(&taddr6));
goto bad;
}
if (is_solicited && IN6_IS_ADDR_MULTICAST(&daddr6)) {
- nd6log((LOG_ERR,
- "nd6_na_input: a solicited adv is multicasted\n"));
+ nd6log(LOG_ERR, "a solicited adv is multicasted\n");
goto bad;
}
icmp6len -= sizeof(*nd_na);
nd6_option_init(nd_na + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
- nd6log((LOG_INFO,
- "nd6_na_input: invalid ND option, ignored\n"));
+ nd6log(LOG_INFO, "invalid ND option, ignored\n");
/* nd6_options have incremented stats */
goto freeit;
}
@@ -634,15 +626,14 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
*/
sockaddr_in6_init(&ssin6, &saddr6, 0, 0, 0);
if (nd6_is_addr_neighbor(&ssin6, ifp) == 0) {
- nd6log((LOG_INFO, "nd6_na_input: "
- "ND packet from non-neighbor\n"));
+ nd6log(LOG_INFO, "ND packet from non-neighbor\n");
goto bad;
}
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
- nd6log((LOG_INFO, "nd6_na_input: lladdrlen mismatch for %s "
+ nd6log(LOG_INFO, "lladdrlen mismatch for %s "
"(if %d, NA packet %d)\n", ip6_sprintf(&taddr6),
- ifp->if_addrlen, lladdrlen - 2));
+ ifp->if_addrlen, lladdrlen - 2);
goto bad;
}
@@ -924,9 +915,9 @@ nd6_na_output(
*/
src = in6_selectsrc(satosin6(dst), NULL, NULL, &ro, NULL, NULL, &error);
if (src == NULL) {
- nd6log((LOG_DEBUG, "nd6_na_output: source can't be "
+ nd6log(LOG_DEBUG, "source can't be "
"determined: dst=%s, error=%d\n",
- ip6_sprintf(&satocsin6(dst)->sin6_addr), error));
+ ip6_sprintf(&satocsin6(dst)->sin6_addr), error);
goto bad;
}
ip6->ip6_src = *src;
@@ -1113,8 +1104,8 @@ nd6_dad_start(struct ifaddr *ifa, int xtick)
callout_init(&dp->dad_timer_ch, CALLOUT_MPSAFE);
TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list);
- nd6log((LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp),
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ nd6log(LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp),
+ ip6_sprintf(&ia->ia_addr.sin6_addr));
/*
* Send NS packet for DAD, ip6_dad_count times.
@@ -1195,8 +1186,8 @@ nd6_dad_timer(struct ifaddr *ifa)
/* timeouted with IFF_{RUNNING,UP} check */
if (dp->dad_ns_tcount > dad_maxtry) {
- nd6log((LOG_INFO, "%s: could not run DAD, driver problem?\n",
- if_name(ifa->ifa_ifp)));
+ nd6log(LOG_INFO, "%s: could not run DAD, driver problem?\n",
+ if_name(ifa->ifa_ifp));
TAILQ_REMOVE(&dadq, dp, dad_list);
free(dp, M_IP6NDP);
@@ -1247,10 +1238,10 @@ nd6_dad_timer(struct ifaddr *ifa)
ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
- nd6log((LOG_DEBUG,
+ nd6log(LOG_DEBUG,
"%s: DAD complete for %s - no duplicates found\n",
if_name(ifa->ifa_ifp),
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ ip6_sprintf(&ia->ia_addr.sin6_addr));
TAILQ_REMOVE(&dadq, dp, dad_list);
free(dp, M_IP6NDP);
@@ -1380,10 +1371,9 @@ nd6_dad_ns_input(struct ifaddr *ifa)
/* Quickhack - completely ignore DAD NS packets */
if (dad_ignore_ns) {
- nd6log((LOG_INFO,
- "nd6_dad_ns_input: ignoring DAD NS packet for "
+ nd6log(LOG_INFO, "ignoring DAD NS packet for "
"address %s(%s)\n", ip6_sprintf(taddr6),
- if_name(ifa->ifa_ifp)));
+ if_name(ifa->ifa_ifp));
return;
}
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 96377fdfc3d..d6788cb6d7b 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_rtr.c,v 1.106 2016/04/01 06:33:19 ozaki-r Exp $ */
+/* $NetBSD: nd6_rtr.c,v 1.107 2016/04/01 08:12:00 ozaki-r Exp $ */
/* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.106 2016/04/01 06:33:19 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.107 2016/04/01 08:12:00 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -147,10 +147,9 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
/* Sanity checks */
if (ip6->ip6_hlim != 255) {
- nd6log((LOG_ERR,
- "nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n",
+ nd6log(LOG_ERR, "invalid hlim (%d) from %s to %s on %s\n",
ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6_sprintf(&ip6->ip6_dst), if_name(ifp));
goto bad;
}
@@ -170,8 +169,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
icmp6len -= sizeof(*nd_rs);
nd6_option_init(nd_rs + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
- nd6log((LOG_INFO,
- "nd6_rs_input: invalid ND option, ignored\n"));
+ nd6log(LOG_INFO, "invalid ND option, ignored\n");
/* nd6_options have incremented stats */
goto freeit;
}
@@ -182,10 +180,9 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
}
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
- nd6log((LOG_INFO,
- "nd6_rs_input: lladdrlen mismatch for %s "
+ nd6log(LOG_INFO, "lladdrlen mismatch for %s "
"(if %d, RS packet %d)\n",
- ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2));
+ ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2);
goto bad;
}
@@ -234,17 +231,15 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
goto freeit;
if (ip6->ip6_hlim != 255) {
- nd6log((LOG_ERR,
- "nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n",
+ nd6log(LOG_ERR, "invalid hlim (%d) from %s to %s on %s\n",
ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6_sprintf(&ip6->ip6_dst), if_name(ifp));
goto bad;
}
if (!IN6_IS_ADDR_LINKLOCAL(&saddr6)) {
- nd6log((LOG_ERR,
- "nd6_ra_input: src %s is not link-local\n",
- ip6_sprintf(&saddr6)));
+ nd6log(LOG_ERR, "src %s is not link-local\n",
+ ip6_sprintf(&saddr6));
goto bad;
}
@@ -257,8 +252,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
icmp6len -= sizeof(*nd_ra);
nd6_option_init(nd_ra + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
- nd6log((LOG_INFO,
- "nd6_ra_input: invalid ND option, ignored\n"));
+ nd6log(LOG_INFO, "invalid ND option, ignored\n");
/* nd6_options have incremented stats */
goto freeit;
}
@@ -318,27 +312,24 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
pi = (struct nd_opt_prefix_info *)pt;
if (pi->nd_opt_pi_len != 4) {
- nd6log((LOG_INFO,
- "nd6_ra_input: invalid option "
+ nd6log(LOG_INFO, "invalid option "
"len %d for prefix information option, "
- "ignored\n", pi->nd_opt_pi_len));
+ "ignored\n", pi->nd_opt_pi_len);
continue;
}
if (128 < pi->nd_opt_pi_prefix_len) {
- nd6log((LOG_INFO,
- "nd6_ra_input: invalid prefix "
+ nd6log(LOG_INFO, "invalid prefix "
"len %d for prefix information option, "
- "ignored\n", pi->nd_opt_pi_prefix_len));
+ "ignored\n", pi->nd_opt_pi_prefix_len);
continue;
}
if (IN6_IS_ADDR_MULTICAST(&pi->nd_opt_pi_prefix)
|| IN6_IS_ADDR_LINKLOCAL(&pi->nd_opt_pi_prefix)) {
- nd6log((LOG_INFO,
- "nd6_ra_input: invalid prefix "
- "%s, ignored\n",
- ip6_sprintf(&pi->nd_opt_pi_prefix)));
+ nd6log(LOG_INFO,
+ "invalid prefix %s, ignored\n",
+ ip6_sprintf(&pi->nd_opt_pi_prefix));
continue;
}
@@ -370,9 +361,9 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
/* lower bound */
if (mtu < IPV6_MMTU) {
- nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option "
+ nd6log(LOG_INFO, "bogus mtu option "
"mtu=%lu sent from %s, ignoring\n",
- mtu, ip6_sprintf(&ip6->ip6_src)));
+ mtu, ip6_sprintf(&ip6->ip6_src));
goto skip;
}
@@ -386,10 +377,10 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
if (change) /* in6_maxmtu may change */
in6_setmaxmtu();
} else {
- nd6log((LOG_INFO, "nd6_ra_input: bogus mtu "
- "mtu=%lu sent from %s; "
+ nd6log(LOG_INFO,
+ "bogus mtu mtu=%lu sent from %s; "
"exceeds maxmtu %lu, ignoring\n",
- mtu, ip6_sprintf(&ip6->ip6_src), maxmtu));
+ mtu, ip6_sprintf(&ip6->ip6_src), maxmtu);
}
}
@@ -408,10 +399,9 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
}
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
- nd6log((LOG_INFO,
- "nd6_ra_input: lladdrlen mismatch for %s "
+ nd6log(LOG_INFO, "lladdrlen mismatch for %s "
"(if %d, RA packet %d)\n", ip6_sprintf(&saddr6),
- ifp->if_addrlen, lladdrlen - 2));
+ ifp->if_addrlen, lladdrlen - 2);
goto bad;
}
@@ -632,9 +622,8 @@ defrouter_select(void)
* such cases here for safety.
*/
if (ip6_forwarding) {
- nd6log((LOG_WARNING,
- "defrouter_select: called unexpectedly (forwarding=%d, "
- "accept_rtadv=%d)\n", ip6_forwarding, ip6_accept_rtadv));
+ nd6log(LOG_WARNING, "called unexpectedly (forwarding=%d, "
+ "accept_rtadv=%d)\n", ip6_forwarding, ip6_accept_rtadv);
splx(s);
return;
}
@@ -973,10 +962,10 @@ nd6_prelist_add(struct nd_prefixctl *prc, struct nd_defrouter *dr,
int e;
if ((e = nd6_prefix_onlink(newpr)) != 0) {
- nd6log((LOG_ERR, "nd6_prelist_add: failed to make "
+ nd6log(LOG_ERR, "failed to make "
"the prefix %s/%d on-link on %s (errno=%d)\n",
ip6_sprintf(&prc->ndprc_prefix.sin6_addr),
- prc->ndprc_plen, if_name(prc->ndprc_ifp), e));
+ prc->ndprc_plen, if_name(prc->ndprc_ifp), e);
/* proceed anyway. XXX: is it correct? */
}
}
@@ -1009,10 +998,10 @@ prelist_remove(struct nd_prefix *pr)
#endif
if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0 &&
(e = nd6_prefix_offlink(pr)) != 0) {
- nd6log((LOG_ERR, "prelist_remove: failed to make %s/%d offlink "
- "on %s, errno=%d\n",
+ nd6log(LOG_ERR,
+ "failed to make %s/%d offlink on %s, errno=%d\n",
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
+ pr->ndpr_plen, if_name(pr->ndpr_ifp), e);
/* what should we do? */
}
@@ -1098,12 +1087,12 @@ prelist_update(struct nd_prefixctl *newprc,
int e;
if ((e = nd6_prefix_onlink(pr)) != 0) {
- nd6log((LOG_ERR,
- "%s: failed to make "
+ nd6log(LOG_ERR,
+ "failed to make "
"the prefix %s/%d on-link on %s "
- "(errno=%d)\n", __func__,
+ "(errno=%d)\n",
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
+ pr->ndpr_plen, if_name(pr->ndpr_ifp), e);
/* proceed anyway. XXX: is it correct? */
}
}
@@ -1125,12 +1114,12 @@ prelist_update(struct nd_prefixctl *newprc,
error = nd6_prelist_add(newprc, dr, &newpr);
if (error != 0 || newpr == NULL) {
- nd6log((LOG_NOTICE,
- "%s: nd6_prelist_add failed for %s/%d on %s "
- "errno=%d, returnpr=%p\n", __func__,
+ nd6log(LOG_NOTICE,
+ "nd6_prelist_add failed for %s/%d on %s "
+ "errno=%d, returnpr=%p\n",
ip6_sprintf(&newprc->ndprc_prefix.sin6_addr),
newprc->ndprc_plen, if_name(newprc->ndprc_ifp),
- error, newpr));
+ error, newpr);
goto end; /* we should just give up in this case. */
}
@@ -1326,9 +1315,9 @@ prelist_update(struct nd_prefixctl *newprc,
goto end;
}
if (ifidlen + pr->ndpr_plen != 128) {
- nd6log((LOG_INFO,
- "%s: invalid prefixlen %d for %s, ignored\n",
- __func__, pr->ndpr_plen, if_name(ifp)));
+ nd6log(LOG_INFO,
+ "invalid prefixlen %d for %s, ignored\n",
+ pr->ndpr_plen, if_name(ifp));
goto end;
}
@@ -1354,10 +1343,9 @@ prelist_update(struct nd_prefixctl *newprc,
if (ip6_use_tempaddr) {
int e;
if ((e = in6_tmpifadd(ia6, 1, 1)) != 0) {
- nd6log((LOG_NOTICE,
- "%s: failed to create a temporary "
- "address, errno=%d\n", __func__,
- e));
+ nd6log(LOG_NOTICE,
+ "failed to create a temporary "
+ "address, errno=%d\n", e);
}
}
@@ -1507,22 +1495,20 @@ pfxlist_onlink_check(void)
if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 &&
(pr->ndpr_stateflags & NDPRF_ONLINK) != 0) {
if ((e = nd6_prefix_offlink(pr)) != 0) {
- nd6log((LOG_ERR,
- "pfxlist_onlink_check: failed to "
- "make %s/%d offlink, errno=%d\n",
+ nd6log(LOG_ERR,
+ "failed to make %s/%d offlink, errno=%d\n",
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, e));
+ pr->ndpr_plen, e);
}
}
if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 &&
(pr->ndpr_stateflags & NDPRF_ONLINK) == 0 &&
pr->ndpr_raf_onlink) {
if ((e = nd6_prefix_onlink(pr)) != 0) {
- nd6log((LOG_ERR,
- "pfxlist_onlink_check: failed to "
- "make %s/%d onlink, errno=%d\n",
+ nd6log(LOG_ERR,
+ "failed to make %s/%d onlink, errno=%d\n",
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, e));
+ pr->ndpr_plen, e);
}
}
}
@@ -1605,9 +1591,8 @@ nd6_prefix_onlink(struct nd_prefix *pr)
/* sanity check */
if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) {
- nd6log((LOG_ERR,
- "nd6_prefix_onlink: %s/%d is already on-link\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen));
+ nd6log(LOG_ERR, "%s/%d is already on-link\n",
+ ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen);
return (EEXIST);
}
@@ -1652,11 +1637,10 @@ nd6_prefix_onlink(struct nd_prefix *pr)
* after removing all IPv6 addresses on the receiving
* interface. This should, of course, be rare though.
*/
- nd6log((LOG_NOTICE,
- "nd6_prefix_onlink: failed to find any ifaddr"
+ nd6log(LOG_NOTICE, "failed to find any ifaddr"
" to add route for a prefix(%s/%d) on %s\n",
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, if_name(ifp)));
+ pr->ndpr_plen, if_name(ifp));
return (0);
}
@@ -1685,13 +1669,13 @@ nd6_prefix_onlink(struct nd_prefix *pr)
nd6_numroutes++;
pr->ndpr_stateflags |= NDPRF_ONLINK;
} else {
- nd6log((LOG_ERR, "nd6_prefix_onlink: failed to add route for a"
+ nd6log(LOG_ERR, "failed to add route for a"
" prefix (%s/%d) on %s, gw=%s, mask=%s, flags=%lx "
"errno = %d\n",
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(ifp),
ip6_sprintf(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr),
- ip6_sprintf(&mask6.sin6_addr), rtflags, error));
+ ip6_sprintf(&mask6.sin6_addr), rtflags, error);
}
return (error);
@@ -1707,9 +1691,8 @@ nd6_prefix_offlink(struct nd_prefix *pr)
/* sanity check */
if ((pr->ndpr_stateflags & NDPRF_ONLINK) == 0) {
- nd6log((LOG_ERR,
- "nd6_prefix_offlink: %s/%d is already off-link\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen));
+ nd6log(LOG_ERR, "%s/%d is already off-link\n",
+ ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen);
return (EEXIST);
}
@@ -1748,23 +1731,21 @@ nd6_prefix_offlink(struct nd_prefix *pr)
int e;
if ((e = nd6_prefix_onlink(opr)) != 0) {
- nd6log((LOG_ERR,
- "nd6_prefix_offlink: failed to "
+ nd6log(LOG_ERR, "failed to "
"recover a prefix %s/%d from %s "
"to %s (errno = %d)\n",
ip6_sprintf(&opr->ndpr_prefix.sin6_addr),
opr->ndpr_plen, if_name(ifp),
- if_name(opr->ndpr_ifp), e));
+ if_name(opr->ndpr_ifp), e);
}
}
}
} else {
/* XXX: can we still set the NDPRF_ONLINK flag? */
- nd6log((LOG_ERR,
- "nd6_prefix_offlink: failed to delete route: "
+ nd6log(LOG_ERR, "failed to delete route: "
"%s/%d on %s (errno = %d)\n",
ip6_sprintf(&sa6.sin6_addr), pr->ndpr_plen, if_name(ifp),
- error));
+ error);
}
return error;
@@ -1821,9 +1802,9 @@ in6_ifadd(struct nd_prefixctl *prc, int mcast)
/* prefixlen + ifidlen must be equal to 128 */
plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL);
if (prefixlen != plen0) {
- nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s "
+ nd6log(LOG_INFO, "wrong prefixlen for %s "
"(prefix=%d ifid=%d)\n",
- if_name(ifp), prefixlen, 128 - plen0));
+ if_name(ifp), prefixlen, 128 - plen0);
return NULL;
}
@@ -1885,10 +1866,9 @@ in6_ifadd(struct nd_prefixctl *prc, int mcast)
if (mcast)
updateflags |= IN6_IFAUPDATE_DADDELAY;
if ((error = in6_update_ifa(ifp, &ifra, NULL, updateflags)) != 0) {
- nd6log((LOG_ERR,
- "in6_ifadd: failed to make ifaddr %s on %s (errno=%d)\n",
+ nd6log(LOG_ERR, "failed to make ifaddr %s on %s (errno=%d)\n",
ip6_sprintf(&ifra.ifra_addr.sin6_addr), if_name(ifp),
- error));
+ error);
return (NULL); /* ifaddr must not have been allocated. */
}
@@ -1926,8 +1906,7 @@ in6_tmpifadd(
again:
if (in6_get_tmpifid(ifp, (u_int8_t *)randid,
(const u_int8_t *)&ia0->ia_addr.sin6_addr.s6_addr[8], forcegen)) {
- nd6log((LOG_NOTICE, "in6_tmpifadd: failed to find a good "
- "random IFID\n"));
+ nd6log(LOG_NOTICE, "failed to find a good random IFID\n");
return (EINVAL);
}
ifra.ifra_addr.sin6_addr.s6_addr32[2] |=
@@ -1949,8 +1928,8 @@ in6_tmpifadd(
* Give up. Something strange should have
* happened.
*/
- nd6log((LOG_NOTICE, "in6_tmpifadd: failed to "
- "find a unique random IFID\n"));
+ nd6log(LOG_NOTICE,
+ "failed to find a unique random IFID\n");
return (EEXIST);
}
forcegen = 1;
@@ -2006,9 +1985,8 @@ in6_tmpifadd(
newia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr);
if (newia == NULL) { /* XXX: can it happen? */
- nd6log((LOG_ERR,
- "in6_tmpifadd: ifa update succeeded, but we got "
- "no ifaddr\n"));
+ nd6log(LOG_ERR,
+ "ifa update succeeded, but we got no ifaddr\n");
return (EINVAL); /* XXX */
}
newia->ia6_ndpr = ia0->ia6_ndpr;
@@ -2033,9 +2011,9 @@ in6_init_prefix_ltimes(struct nd_prefix *ndpr)
/* check if preferred lifetime > valid lifetime. RFC2462 5.5.3 (c) */
if (ndpr->ndpr_pltime > ndpr->ndpr_vltime) {
- nd6log((LOG_INFO, "in6_init_prefix_ltimes: preferred lifetime"
+ nd6log(LOG_INFO, "preferred lifetime"
"(%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);
}
if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME)