Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Refine arplog to be like nd6log.



details:   https://anonhg.NetBSD.org/src/rev/578d8d749e58
branches:  trunk
changeset: 817770:578d8d749e58
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Sep 07 13:01:39 2016 +0000

description:
Refine arplog to be like nd6log.

diffstat:

 sys/netinet/if_arp.c |  26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diffs (86 lines):

diff -r 7898257b31d2 -r 578d8d749e58 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Wed Sep 07 11:33:48 2016 +0000
+++ b/sys/netinet/if_arp.c      Wed Sep 07 13:01:39 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.222 2016/08/08 06:28:09 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.223 2016/09/07 13:01:39 roy Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.222 2016/08/08 06:28:09 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.223 2016/09/07 13:01:39 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -153,7 +153,8 @@
 #else
 static int     arp_debug = 0;
 #endif
-#define arplog(x)      do { if (arp_debug) log x; } while (/*CONSTCOND*/ 0)
+#define arplog(level, fmt, args...) \
+       do { if (arp_debug) log(level, "%s: " fmt, __func__, ##args);} while (0)
 
 static void arp_init(void);
 
@@ -461,8 +462,7 @@
                if (ifatoia(ifa)->ia4_flags &
                    (IN_IFF_NOTREADY | IN_IFF_DETACHED))
                {
-                       arplog((LOG_DEBUG, "arp_request: %s not ready\n",
-                          in_fmtaddr(*in)));
+                       arplog(LOG_DEBUG, "%s not ready\n", in_fmtaddr(*in));
                        return;
                }
 
@@ -1621,8 +1621,8 @@
        dp->dad_arp_acount = dp->dad_arp_ocount = dp->dad_arp_tcount = 0;
        TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list);
 
-       arplog((LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp),
-           in_fmtaddr(ia->ia_addr.sin_addr)));
+       arplog(LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp),
+           in_fmtaddr(ia->ia_addr.sin_addr));
 
        arp_dad_starttimer(dp, cprng_fast32() % (PROBE_WAIT * hz));
 
@@ -1696,8 +1696,8 @@
 
        /* timeouted with IFF_{RUNNING,UP} check */
        if (dp->dad_arp_tcount > dad_maxtry) {
-               arplog((LOG_INFO, "%s: could not run DAD, driver problem?\n",
-                   if_name(ifa->ifa_ifp)));
+               arplog(LOG_INFO, "%s: could not run DAD, driver problem?\n",
+                   if_name(ifa->ifa_ifp));
 
                TAILQ_REMOVE(&dadq, dp, dad_list);
                free(dp, M_IPARP);
@@ -1729,10 +1729,10 @@
                 */
                ia->ia4_flags &= ~IN_IFF_TENTATIVE;
                rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
-               arplog((LOG_DEBUG,
+               arplog(LOG_DEBUG,
                    "%s: DAD complete for %s - no duplicates found\n",
                    if_name(ifa->ifa_ifp),
-                   in_fmtaddr(ia->ia_addr.sin_addr)));
+                   in_fmtaddr(ia->ia_addr.sin_addr));
                dp->dad_arp_announce = ANNOUNCE_NUM;
                goto announce;
        } else if (dp->dad_arp_acount < dp->dad_arp_announce) {
@@ -1748,10 +1748,10 @@
                        arp_dad_starttimer(dp, ANNOUNCE_INTERVAL * hz);
                        goto done;
                }
-               arplog((LOG_DEBUG,
+               arplog(LOG_DEBUG,
                    "%s: ARP announcement complete for %s\n",
                    if_name(ifa->ifa_ifp),
-                   in_fmtaddr(ia->ia_addr.sin_addr)));
+                   in_fmtaddr(ia->ia_addr.sin_addr));
        }
 
        TAILQ_REMOVE(&dadq, dp, dad_list);



Home | Main Index | Thread Index | Old Index