Module Name:    src
Committed By:   roy
Date:           Wed Sep  7 13:01:39 UTC 2016

Modified Files:
        src/sys/netinet: if_arp.c

Log Message:
Refine arplog to be like nd6log.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/netinet/if_arp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.222 src/sys/netinet/if_arp.c:1.223
--- src/sys/netinet/if_arp.c:1.222	Mon Aug  8 06:28:09 2016
+++ src/sys/netinet/if_arp.c	Wed Sep  7 13:01:39 2016
@@ -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 @@ static int	arp_debug = 1;
 #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 @@ arp_rtrequest(int req, struct rtentry *r
 		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 @@ arp_dad_start(struct ifaddr *ifa)
 	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 @@ arp_dad_timer(struct ifaddr *ifa)
 
 	/* 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 @@ arp_dad_timer(struct ifaddr *ifa)
 		 */
 		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 @@ announce:
 			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);

Reply via email to