Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Use __func__ in log messages



details:   https://anonhg.NetBSD.org/src/rev/bf047cbab985
branches:  trunk
changeset: 344483:bf047cbab985
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Apr 01 06:25:51 2016 +0000

description:
Use __func__ in log messages

diffstat:

 sys/netinet6/in6.c     |  50 +++++++++++++++++++++++++-------------------------
 sys/netinet6/nd6_rtr.c |  29 ++++++++++++++---------------
 2 files changed, 39 insertions(+), 40 deletions(-)

diffs (207 lines):

diff -r 6b1f8e12efe5 -r bf047cbab985 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Fri Apr 01 05:23:56 2016 +0000
+++ b/sys/netinet6/in6.c        Fri Apr 01 06:25:51 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.195 2016/02/15 14:59:03 rtr Exp $    */
+/*     $NetBSD: in6.c,v 1.196 2016/04/01 06:25:51 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.195 2016/02/15 14:59:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.196 2016/04/01 06:25:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -844,13 +844,15 @@
 
                if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) == 0) {
                        /* XXX: noisy message */
-                       nd6log((LOG_INFO, "in6_update_ifa: a destination can "
-                           "be specified for a p2p or a loopback IF only\n"));
+                       nd6log((LOG_INFO, "%s: a destination can "
+                           "be specified for a p2p or a loopback IF only\n",
+                           __func__));
                        return EINVAL;
                }
                if (plen != 128) {
-                       nd6log((LOG_INFO, "in6_update_ifa: prefixlen should "
-                           "be 128 when dstaddr is specified\n"));
+                       nd6log((LOG_INFO, "%s: prefixlen should "
+                           "be 128 when dstaddr is specified\n",
+                           __func__));
 #ifdef FORCE_P2PPLEN
                        /*
                         * To be compatible with old configurations,
@@ -879,7 +881,7 @@
                 * configuration mistake or a tool's bug.
                 */
                nd6log((LOG_INFO,
-                   "in6_update_ifa: valid lifetime is 0 for %s\n",
+                   "%s: valid lifetime is 0 for %s\n", __func__,
                    ip6_sprintf(&ifra->ifra_addr.sin6_addr)));
 
                if (ia == NULL)
@@ -947,9 +949,9 @@
                 */
                if (ia->ia_prefixmask.sin6_len &&
                    in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) {
-                       nd6log((LOG_INFO, "in6_update_ifa: the prefix length of an"
+                       nd6log((LOG_INFO, "%s: the prefix length of an"
                            " existing (%s) address should not be changed\n",
-                           ip6_sprintf(&ia->ia_addr.sin6_addr)));
+                           __func__, ip6_sprintf(&ia->ia_addr.sin6_addr)));
                        error = EINVAL;
                        goto unlink;
                }
@@ -965,8 +967,8 @@
            !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, "in6_update_ifa: failed to remove "
-                           "a route to the old destination: %s\n",
+                       nd6log((LOG_ERR, "%s: failed to remove "
+                           "a route to the old destination: %s\n", __func__,
                            ip6_sprintf(&ia->ia_addr.sin6_addr)));
                        /* proceed anyway... */
                } else
@@ -1048,8 +1050,7 @@
                llsol.s6_addr8[12] = 0xff;
                if ((error = in6_setscope(&llsol, ifp, NULL)) != 0) {
                        /* XXX: should not happen */
-                       log(LOG_ERR, "in6_update_ifa: "
-                           "in6_setscope failed\n");
+                       log(LOG_ERR, "%s: in6_setscope failed\n", __func__);
                        goto cleanup;
                }
                dad_delay = 0;
@@ -1070,9 +1071,9 @@
                imm = in6_joingroup(ifp, &llsol, &error, dad_delay);
                if (!imm) {
                        nd6log((LOG_ERR,
-                           "in6_update_ifa: addmulti "
-                           "failed for %s on %s (errno=%d)\n",
-                           ip6_sprintf(&llsol), if_name(ifp), error));
+                           "%s: addmulti failed for %s on %s (errno=%d)\n",
+                           __func__, ip6_sprintf(&llsol), if_name(ifp),
+                           error));
                        goto cleanup;
                }
                LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
@@ -1135,9 +1136,8 @@
                imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0);
                if (!imm) {
                        nd6log((LOG_WARNING,
-                           "in6_update_ifa: addmulti failed for "
-                           "%s on %s (errno=%d)\n",
-                           ip6_sprintf(&mltaddr.sin6_addr),
+                           "%s: addmulti failed for %s on %s (errno=%d)\n",
+                           __func__, ip6_sprintf(&mltaddr.sin6_addr),
                            if_name(ifp), error));
                        goto cleanup;
                }
@@ -1159,9 +1159,9 @@
                        ;
                else if ((imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error,
                          dad_delay)) == NULL) { /* XXX jinmei */
-                       nd6log((LOG_WARNING, "in6_update_ifa: "
-                           "addmulti failed for %s on %s (errno=%d)\n",
-                           ip6_sprintf(&mltaddr.sin6_addr),
+                       nd6log((LOG_WARNING,
+                           "%s: addmulti failed for %s on %s (errno=%d)\n",
+                           __func__, ip6_sprintf(&mltaddr.sin6_addr),
                            if_name(ifp), error));
                        /* XXX not very fatal, go on... */
                } else {
@@ -1219,9 +1219,9 @@
                }
                imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0);
                if (!imm) {
-                       nd6log((LOG_WARNING, "in6_update_ifa: "
-                           "addmulti failed for %s on %s (errno=%d)\n",
-                           ip6_sprintf(&mltaddr.sin6_addr),
+                       nd6log((LOG_WARNING,
+                           "%s: addmulti failed for %s on %s (errno=%d)\n",
+                           __func__, ip6_sprintf(&mltaddr.sin6_addr),
                            if_name(ifp), error));
                        goto cleanup;
                } else {
diff -r 6b1f8e12efe5 -r bf047cbab985 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Fri Apr 01 05:23:56 2016 +0000
+++ b/sys/netinet6/nd6_rtr.c    Fri Apr 01 06:25:51 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_rtr.c,v 1.105 2015/11/25 06:21:26 ozaki-r Exp $    */
+/*     $NetBSD: nd6_rtr.c,v 1.106 2016/04/01 06:33:19 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.105 2015/11/25 06:21:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.106 2016/04/01 06:33:19 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1099,9 +1099,9 @@
 
                        if ((e = nd6_prefix_onlink(pr)) != 0) {
                                nd6log((LOG_ERR,
-                                   "prelist_update: failed to make "
+                                   "%s: failed to make "
                                    "the prefix %s/%d on-link on %s "
-                                   "(errno=%d)\n",
+                                   "(errno=%d)\n", __func__,
                                    ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
                                    pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
                                /* proceed anyway. XXX: is it correct? */
@@ -1125,9 +1125,9 @@
 
                error = nd6_prelist_add(newprc, dr, &newpr);
                if (error != 0 || newpr == NULL) {
-                       nd6log((LOG_NOTICE, "prelist_update: "
-                           "nd6_prelist_add failed for %s/%d on %s "
-                           "errno=%d, returnpr=%p\n",
+                       nd6log((LOG_NOTICE,
+                           "%s: nd6_prelist_add failed for %s/%d on %s "
+                           "errno=%d, returnpr=%p\n", __func__,
                            ip6_sprintf(&newprc->ndprc_prefix.sin6_addr),
                            newprc->ndprc_plen, if_name(newprc->ndprc_ifp),
                            error, newpr));
@@ -1321,15 +1321,14 @@
                ifidlen = in6_if2idlen(ifp);
                if (ifidlen < 0) {
                        /* this should not happen, so we always log it. */
-                       log(LOG_ERR, "prelist_update: IFID undefined (%s)\n",
-                           if_name(ifp));
+                       log(LOG_ERR, "%s: IFID undefined (%s)\n",
+                           __func__, if_name(ifp));
                        goto end;
                }
                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;
                }
 
@@ -1355,9 +1354,9 @@
                        if (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",
+                                       nd6log((LOG_NOTICE,
+                                           "%s: failed to create a temporary "
+                                           "address, errno=%d\n", __func__,
                                            e));
                                }
                        }



Home | Main Index | Thread Index | Old Index