Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Refine nd6log
details: https://anonhg.NetBSD.org/src/rev/aed81eb6149d
branches: trunk
changeset: 814627:aed81eb6149d
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Apr 01 08:12:00 2016 +0000
description:
Refine nd6log
Add __func__ to nd6log itself instead of adding it to callers.
diffstat:
sys/netinet6/icmp6.c | 90 ++++++++++------------
sys/netinet6/in6.c | 74 ++++++++----------
sys/netinet6/in6_ifattach.c | 58 +++++++-------
sys/netinet6/ip6_input.c | 9 +-
sys/netinet6/nd6.c | 22 ++--
sys/netinet6/nd6.h | 5 +-
sys/netinet6/nd6_nbr.c | 88 +++++++++------------
sys/netinet6/nd6_rtr.c | 174 +++++++++++++++++++------------------------
8 files changed, 236 insertions(+), 284 deletions(-)
diffs (truncated from 1349 to 300 lines):
diff -r 12aac9771625 -r aed81eb6149d sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Fri Apr 01 07:23:15 2016 +0000
+++ b/sys/netinet6/icmp6.c Fri Apr 01 08:12:00 2016 +0000
@@ -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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
}
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 -r 12aac9771625 -r aed81eb6149d sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Fri Apr 01 07:23:15 2016 +0000
+++ b/sys/netinet6/in6.c Fri Apr 01 08:12:00 2016 +0000
@@ -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 @@
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 @@
* 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 @@
*/
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_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 @@
/* 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 @@
}
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),
Home |
Main Index |
Thread Index |
Old Index