Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet rename arplog -> ARPLOG to make it clear that it...
details: https://anonhg.NetBSD.org/src/rev/9a95d4ec5987
branches: trunk
changeset: 350687:9a95d4ec5987
user: christos <christos%NetBSD.org@localhost>
date: Mon Jan 16 15:14:16 2017 +0000
description:
rename arplog -> ARPLOG to make it clear that it is a macro and tuck-in the
buffer used for address formatting.
diffstat:
sys/netinet/if_arp.c | 23 ++++++++++-------------
sys/netinet/in_var.h | 13 +++++++++----
sys/netinet/ip_output.c | 9 ++++-----
3 files changed, 23 insertions(+), 22 deletions(-)
diffs (135 lines):
diff -r 02a06706e5ee -r 9a95d4ec5987 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Mon Jan 16 12:54:25 2017 +0000
+++ b/sys/netinet/if_arp.c Mon Jan 16 15:14:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.234 2017/01/16 07:33:36 ryo Exp $ */
+/* $NetBSD: if_arp.c,v 1.235 2017/01/16 15:14:16 christos 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.234 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.235 2017/01/16 15:14:16 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -689,10 +689,9 @@
{
struct in_ifaddr *ia = ifatoia(ifa);
struct in_addr *ip = &IA_SIN(ifa)->sin_addr;
- char ipbuf[INET_ADDRSTRLEN];
if (ia->ia4_flags & (IN_IFF_NOTREADY | IN_IFF_DETACHED)) {
- arplog(LOG_DEBUG, "%s not ready\n", in_fmtaddr(ipbuf, *ip));
+ ARPLOG(LOG_DEBUG, "%s not ready\n", ARPLOGADDR(*ip));
return;
}
arprequest(ifp, ip, ip, enaddr);
@@ -1631,8 +1630,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(ipbuf, ia->ia_addr.sin_addr));
+ ARPLOG(LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp),
+ ARPLOGADDR(ia->ia_addr.sin_addr));
arp_dad_starttimer(dp, cprng_fast32() % (PROBE_WAIT * hz));
@@ -1706,7 +1705,7 @@
/* timeouted with IFF_{RUNNING,UP} check */
if (dp->dad_arp_tcount > dad_maxtry) {
- arplog(LOG_INFO, "%s: could not run DAD, driver problem?\n",
+ ARPLOG(LOG_INFO, "%s: could not run DAD, driver problem?\n",
if_name(ifa->ifa_ifp));
TAILQ_REMOVE(&dadq, dp, dad_list);
@@ -1739,10 +1738,9 @@
*/
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(ipbuf, ia->ia_addr.sin_addr));
+ if_name(ifa->ifa_ifp), ARPLOGADDR(ia->ia_addr.sin_addr));
dp->dad_arp_announce = ANNOUNCE_NUM;
goto announce;
} else if (dp->dad_arp_acount < dp->dad_arp_announce) {
@@ -1756,10 +1754,9 @@
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(ipbuf, ia->ia_addr.sin_addr));
+ if_name(ifa->ifa_ifp), ARPLOGADDR(ia->ia_addr.sin_addr));
}
TAILQ_REMOVE(&dadq, dp, dad_list);
diff -r 02a06706e5ee -r 9a95d4ec5987 sys/netinet/in_var.h
--- a/sys/netinet/in_var.h Mon Jan 16 12:54:25 2017 +0000
+++ b/sys/netinet/in_var.h Mon Jan 16 15:14:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_var.h,v 1.92 2017/01/16 07:33:36 ryo Exp $ */
+/* $NetBSD: in_var.h,v 1.93 2017/01/16 15:14:16 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -380,10 +380,15 @@
extern int ip_dad_count; /* Duplicate Address Detection probes */
#if defined(INET) && NARP > 0
extern int arp_debug;
-#define arplog(level, fmt, args...) \
- do { if (arp_debug) log(level, "%s: " fmt, __func__, ##args);} while (0)
+#define ARPLOGADDR(a) in_fmtaddr(_ipbuf, a)
+#define ARPLOG(level, fmt, args...) \
+ do { \
+ char _ipbuf[INET_ADDRSTRLEN] __used; \
+ if (arp_debug) \
+ log(level, "%s: " fmt, __func__, ##args); \
+ } while (/*CONSTCOND*/0)
#else
-#define arplog(level, fmt, args...)
+#define ARPLOG(level, fmt, args...)
#endif
/*
diff -r 02a06706e5ee -r 9a95d4ec5987 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c Mon Jan 16 12:54:25 2017 +0000
+++ b/sys/netinet/ip_output.c Mon Jan 16 15:14:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.268 2017/01/16 07:33:36 ryo Exp $ */
+/* $NetBSD: ip_output.c,v 1.269 2017/01/16 15:14:16 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.268 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.269 2017/01/16 15:14:16 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -620,10 +620,9 @@
if ((ia != NULL || (flags & IP_FORWARDING) == 0) &&
(error = ip_ifaddrvalid(ia)) != 0)
{
- char ipbuf[INET_ADDRSTRLEN];
- arplog(LOG_ERR,
+ ARPLOG(LOG_ERR,
"refusing to send from invalid address %s (pid %d)\n",
- in_fmtaddr(ipbuf, ip->ip_src), curproc->p_pid);
+ ARPLOGADDR(ip->ip_src), curproc->p_pid);
IP_STATINC(IP_STAT_ODROPPED);
if (error == 1)
/*
Home |
Main Index |
Thread Index |
Old Index