svn commit: r357207 - stable/12/sys/netinet6
Bjoern A. Zeeb
bz at FreeBSD.org
Tue Jan 28 17:48:15 UTC 2020
Author: bz
Date: Tue Jan 28 17:48:14 2020
New Revision: 357207
URL: https://svnweb.freebsd.org/changeset/base/357207
Log:
MFC r356662:
nd6_rtr: constantly use __func__ for nd6log()
Over time one or two hard coded function names did not match the
actual function anymore. Consistently use __func__ for nd6log() calls
and re-wrap/re-format some messages for consitency.
Modified:
stable/12/sys/netinet6/nd6_rtr.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/netinet6/nd6_rtr.c
==============================================================================
--- stable/12/sys/netinet6/nd6_rtr.c Tue Jan 28 17:39:03 2020 (r357206)
+++ stable/12/sys/netinet6/nd6_rtr.c Tue Jan 28 17:48:14 2020 (r357207)
@@ -171,7 +171,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
ip6 = mtod(m, struct ip6_hdr *);
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
- "nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n",
+ "%s: invalid hlim (%d) from %s to %s on %s\n", __func__,
ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src),
ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp)));
goto bad;
@@ -199,7 +199,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
nd6_option_init(nd_rs + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
nd6log((LOG_INFO,
- "nd6_rs_input: invalid ND option, ignored\n"));
+ "%s: invalid ND option, ignored\n", __func__));
/* nd6_options have incremented stats */
goto freeit;
}
@@ -213,9 +213,8 @@ 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 "
- "(if %d, RS packet %d)\n",
- ip6_sprintf(ip6bufs, &saddr6),
+ "%s: lladdrlen mismatch for %s (if %d, RS packet %d)\n",
+ __func__, ip6_sprintf(ip6bufs, &saddr6),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
@@ -267,7 +266,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
ip6 = mtod(m, struct ip6_hdr *);
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
- "nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n",
+ "%s: invalid hlim (%d) from %s to %s on %s\n", __func__,
ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src),
ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp)));
goto bad;
@@ -276,7 +275,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
saddr6 = ip6->ip6_src;
if (!IN6_IS_ADDR_LINKLOCAL(&saddr6)) {
nd6log((LOG_ERR,
- "nd6_ra_input: src %s is not link-local\n",
+ "%s: src %s is not link-local\n", __func__,
ip6_sprintf(ip6bufs, &saddr6)));
goto bad;
}
@@ -295,7 +294,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
nd6_option_init(nd_ra + 1, icmp6len, &ndopts);
if (nd6_options(&ndopts) < 0) {
nd6log((LOG_INFO,
- "nd6_ra_input: invalid ND option, ignored\n"));
+ "%s: invalid ND option, ignored\n", __func__));
/* nd6_options have incremented stats */
goto freeit;
}
@@ -369,26 +368,25 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
if (pi->nd_opt_pi_len != 4) {
nd6log((LOG_INFO,
- "nd6_ra_input: invalid option "
- "len %d for prefix information option, "
- "ignored\n", pi->nd_opt_pi_len));
+ "%s: invalid option len %d for prefix "
+ "information option, ignored\n", __func__,
+ pi->nd_opt_pi_len));
continue;
}
if (128 < pi->nd_opt_pi_prefix_len) {
nd6log((LOG_INFO,
- "nd6_ra_input: invalid prefix "
- "len %d for prefix information option, "
- "ignored\n", pi->nd_opt_pi_prefix_len));
+ "%s: invalid prefix len %d for prefix "
+ "information option, ignored\n", __func__,
+ 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(ip6bufs,
+ "%s: invalid prefix %s, ignored\n",
+ __func__, ip6_sprintf(ip6bufs,
&pi->nd_opt_pi_prefix)));
continue;
}
@@ -425,8 +423,8 @@ 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 "
- "mtu=%lu sent from %s, ignoring\n",
+ nd6log((LOG_INFO, "%s: bogus mtu option mtu=%lu sent "
+ "from %s, ignoring\n", __func__,
mtu, ip6_sprintf(ip6bufs, &ip6->ip6_src)));
goto skip;
}
@@ -444,9 +442,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
rt_updatemtu(ifp);
}
} else {
- nd6log((LOG_INFO, "nd6_ra_input: bogus mtu "
- "mtu=%lu sent from %s; "
- "exceeds maxmtu %lu, ignoring\n",
+ nd6log((LOG_INFO, "%s: bogus mtu=%lu sent from %s; "
+ "exceeds maxmtu %lu, ignoring\n", __func__,
mtu, ip6_sprintf(ip6bufs, &ip6->ip6_src), maxmtu));
}
}
@@ -467,8 +464,8 @@ 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 "
- "(if %d, RA packet %d)\n", ip6_sprintf(ip6bufs, &saddr6),
+ "%s: lladdrlen mismatch for %s (if %d, RA packet %d)\n",
+ __func__, ip6_sprintf(ip6bufs, &saddr6),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
@@ -1135,9 +1132,9 @@ in6_ifadd(struct nd_prefixctl *pr, int mcast)
plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL);
if (prefixlen != plen0) {
ifa_free(ifa);
- nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s "
- "(prefix=%d ifid=%d)\n",
- if_name(ifp), prefixlen, 128 - plen0));
+ nd6log((LOG_INFO,
+ "%s: wrong prefixlen for %s (prefix=%d ifid=%d)\n",
+ __func__, if_name(ifp), prefixlen, 128 - plen0));
return NULL;
}
@@ -1190,7 +1187,7 @@ in6_ifadd(struct nd_prefixctl *pr, int 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",
+ "%s: failed to make ifaddr %s on %s (errno=%d)\n", __func__,
ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr),
if_name(ifp), error));
return (NULL); /* ifaddr must not have been allocated. */
@@ -1292,8 +1289,8 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_def
if (new->ndpr_raf_onlink) {
ND6_ONLINK_LOCK();
if ((error = nd6_prefix_onlink(new)) != 0) {
- nd6log((LOG_ERR, "nd6_prelist_add: failed to make "
- "the prefix %s/%d on-link on %s (errno=%d)\n",
+ nd6log((LOG_ERR, "%s: failed to make the prefix %s/%d "
+ "on-link on %s (errno=%d)\n", __func__,
ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp), error));
/* proceed anyway. XXX: is it correct? */
@@ -1349,8 +1346,8 @@ nd6_prefix_del(struct nd_prefix *pr)
ND6_ONLINK_LOCK();
if ((e = nd6_prefix_offlink(pr)) != 0) {
nd6log((LOG_ERR,
- "nd6_prefix_del: failed to make %s/%d offlink "
- "on %s, errno=%d\n",
+ "%s: failed to make the prefix %s/%d offlink on %s "
+ "(errno=%d)\n", __func__,
ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
/* what should we do? */
@@ -1421,9 +1418,8 @@ prelist_update(struct nd_prefixctl *new, struct nd_def
ND6_ONLINK_LOCK();
if ((error = nd6_prefix_onlink(pr)) != 0) {
nd6log((LOG_ERR,
- "prelist_update: failed to make "
- "the prefix %s/%d on-link on %s "
- "(errno=%d)\n",
+ "%s: failed to make the prefix %s/%d "
+ "on-link on %s (errno=%d)\n", __func__,
ip6_sprintf(ip6buf,
&pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp),
@@ -1443,8 +1439,8 @@ prelist_update(struct nd_prefixctl *new, struct nd_def
error = nd6_prelist_add(new, dr, &pr);
if (error != 0) {
- nd6log((LOG_NOTICE, "prelist_update: "
- "nd6_prelist_add failed for %s/%d on %s errno=%d\n",
+ nd6log((LOG_NOTICE, "%s: nd6_prelist_add() failed for "
+ "the prefix %s/%d on %s (errno=%d)\n", __func__,
ip6_sprintf(ip6buf, &new->ndpr_prefix.sin6_addr),
new->ndpr_plen, if_name(new->ndpr_ifp), error));
goto end; /* we should just give up in this case. */
@@ -1644,9 +1640,8 @@ prelist_update(struct nd_prefixctl *new, struct nd_def
}
if (ifidlen + pr->ndpr_plen != 128) {
nd6log((LOG_INFO,
- "prelist_update: invalid prefixlen "
- "%d for %s, ignored\n",
- pr->ndpr_plen, if_name(ifp)));
+ "%s: invalid prefixlen %d for %s, ignored\n",
+ __func__, pr->ndpr_plen, if_name(ifp)));
goto end;
}
@@ -1672,10 +1667,9 @@ prelist_update(struct nd_prefixctl *new, struct nd_def
if (V_ip6_use_tempaddr) {
int e;
if ((e = in6_tmpifadd(ia6, 1, 1)) != 0) {
- nd6log((LOG_NOTICE, "prelist_update: "
- "failed to create a temporary "
- "address, errno=%d\n",
- e));
+ nd6log((LOG_NOTICE, "%s: failed to "
+ "create a temporary address "
+ "(errno=%d)\n", __func__, e));
}
}
ifa_free(&ia6->ia_ifa);
@@ -1838,16 +1832,16 @@ restart:
if ((flags & NDPRF_ONLINK) != 0 &&
(e = nd6_prefix_offlink(pr)) != 0) {
nd6log((LOG_ERR,
- "pfxlist_onlink_check: failed to "
- "make %s/%d offlink, errno=%d\n",
+ "%s: failed to make %s/%d offlink "
+ "(errno=%d)\n", __func__,
ip6_sprintf(ip6buf,
&pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, e));
} else if ((flags & NDPRF_ONLINK) == 0 &&
(e = nd6_prefix_onlink(pr)) != 0) {
nd6log((LOG_ERR,
- "pfxlist_onlink_check: failed to "
- "make %s/%d onlink, errno=%d\n",
+ "%s: failed to make %s/%d onlink "
+ "(errno=%d)\n", __func__,
ip6_sprintf(ip6buf,
&pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, e));
@@ -1980,9 +1974,9 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, stru
struct sockaddr_in6 *sin6;
sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
- nd6log((LOG_ERR, "nd6_prefix_onlink: failed to add "
+ nd6log((LOG_ERR, "%s: failed to add "
"route for a prefix (%s/%d) on %s, gw=%s, mask=%s, "
- "flags=%lx errno = %d\n",
+ "flags=%lx errno = %d\n", __func__,
ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp),
ip6_sprintf(ip6bufg, &sin6->sin6_addr),
@@ -2073,8 +2067,8 @@ nd6_prefix_onlink(struct nd_prefix *pr)
* interface. This should, of course, be rare though.
*/
nd6log((LOG_NOTICE,
- "nd6_prefix_onlink: failed to find any ifaddr"
- " to add route for a prefix(%s/%d) on %s\n",
+ "%s: failed to find any ifaddr to add route for a "
+ "prefix(%s/%d) on %s\n", __func__,
ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(ifp)));
return (0);
@@ -2173,10 +2167,9 @@ restart:
ND6_RUNLOCK();
if ((e = nd6_prefix_onlink(opr)) != 0) {
nd6log((LOG_ERR,
- "nd6_prefix_offlink: failed to "
- "recover a prefix %s/%d from %s "
- "to %s (errno = %d)\n",
- ip6_sprintf(ip6buf,
+ "%s: failed to recover a prefix "
+ "%s/%d from %s to %s (errno=%d)\n",
+ __func__, ip6_sprintf(ip6buf,
&opr->ndpr_prefix.sin6_addr),
opr->ndpr_plen, if_name(ifp),
if_name(opr->ndpr_ifp), e));
@@ -2191,10 +2184,9 @@ restart:
} else {
/* XXX: can we still set the NDPRF_ONLINK flag? */
nd6log((LOG_ERR,
- "nd6_prefix_offlink: failed to delete route: "
- "%s/%d on %s (errno = %d)\n",
- ip6_sprintf(ip6buf, &sa6.sin6_addr), pr->ndpr_plen,
- if_name(ifp), error));
+ "%s: failed to delete route: %s/%d on %s (errno=%d)\n",
+ __func__, ip6_sprintf(ip6buf, &sa6.sin6_addr),
+ pr->ndpr_plen, if_name(ifp), error));
}
if (a_failure)
@@ -2230,8 +2222,8 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege
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, "%s: failed to find a good random IFID\n",
+ __func__));
return (EINVAL);
}
ifra.ifra_addr.sin6_addr.s6_addr32[2] |=
@@ -2253,8 +2245,8 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege
}
/* Give up. Something strange should have happened. */
- nd6log((LOG_NOTICE, "in6_tmpifadd: failed to "
- "find a unique random IFID\n"));
+ nd6log((LOG_NOTICE, "%s: failed to find a unique random IFID\n",
+ __func__));
return (EEXIST);
}
@@ -2307,8 +2299,8 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege
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"));
+ "%s: ifa update succeeded, but we got no ifaddr\n",
+ __func__));
return (EINVAL); /* XXX */
}
newia->ia6_ndpr = ia0->ia6_ndpr;
More information about the svn-src-stable-12
mailing list