Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Add sysctl to selectively log arp packets from u...
details: https://anonhg.NetBSD.org/src/rev/92356b1f1eb9
branches: trunk
changeset: 333677:92356b1f1eb9
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 13 16:11:18 2014 +0000
description:
Add sysctl to selectively log arp packets from unknown network. (Adrien URBAN).
diffstat:
sys/netinet/if_arp.c | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
diffs (68 lines):
diff -r 69e2fbe06865 -r 92356b1f1eb9 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Thu Nov 13 16:10:21 2014 +0000
+++ b/sys/netinet/if_arp.c Thu Nov 13 16:11:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.159 2014/09/05 06:02:11 matt Exp $ */
+/* $NetBSD: if_arp.c,v 1.160 2014/11/13 16:11:18 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.159 2014/09/05 06:02:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.160 2014/11/13 16:11:18 christos Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -194,6 +194,7 @@
static int log_movements = 1;
static int log_permanent_modify = 1;
static int log_wrong_iface = 1;
+static int log_unknown_network = 1;
/*
* this should be elsewhere.
@@ -1305,17 +1306,20 @@
return (struct llinfo_arp *)rt->rt_llinfo;
if (create) {
- if (rt->rt_flags & RTF_GATEWAY)
- why = "host is not on local network";
- else if ((rt->rt_flags & RTF_LLINFO) == 0) {
+ if (rt->rt_flags & RTF_GATEWAY) {
+ if (log_unknown_network)
+ why = "host is not on local network";
+ } else if ((rt->rt_flags & RTF_LLINFO) == 0) {
ARP_STATINC(ARP_STAT_ALLOCFAIL);
why = "could not allocate llinfo";
} else
why = "gateway route is not ours";
- log(LOG_DEBUG, "arplookup: unable to enter address"
- " for %s@%s on %s (%s)\n",
- in_fmtaddr(*addr), lla_snprintf(ar_sha(ah), ah->ar_hln),
- (ifp) ? ifp->if_xname : "null", why);
+ if (why) {
+ log(LOG_DEBUG, "arplookup: unable to enter address"
+ " for %s@%s on %s (%s)\n", in_fmtaddr(*addr),
+ lla_snprintf(ar_sha(ah), ah->ar_hln),
+ (ifp) ? ifp->if_xname : "null", why);
+ }
if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_CLONED) != 0) {
rtrequest(RTM_DELETE, rt_getkey(rt),
rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL);
@@ -1704,6 +1708,13 @@
" interface"),
NULL, 0, &log_wrong_iface, 0,
CTL_NET,PF_INET, node->sysctl_num, CTL_CREATE, CTL_EOL);
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "log_unknown_network",
+ SYSCTL_DESCR("log ARP packets from non-local network"),
+ NULL, 0, &log_unknown_network, 0,
+ CTL_NET,PF_INET, node->sysctl_num, CTL_CREATE, CTL_EOL);
}
#endif /* INET */
Home |
Main Index |
Thread Index |
Old Index