Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/netinet Pull up following revision(s) (requested by o...



details:   https://anonhg.NetBSD.org/src/rev/d352a2c6a61e
branches:  netbsd-6
changeset: 777008:d352a2c6a61e
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Nov 15 17:51:52 2015 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #1328):
        sys/netinet/if_arp.c: revision 1.160
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 5f17e2d9c312 -r d352a2c6a61e sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Sun Nov 15 17:49:31 2015 +0000
+++ b/sys/netinet/if_arp.c      Sun Nov 15 17:51:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.154.2.1 2014/06/03 15:34:00 msaitoh Exp $ */
+/*     $NetBSD: if_arp.c,v 1.154.2.2 2015/11/15 17:51:52 bouyer 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.154.2.1 2014/06/03 15:34:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.154.2.2 2015/11/15 17:51:52 bouyer 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.
@@ -1306,17 +1307,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);
@@ -1708,6 +1712,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