Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/7e6bc0bac821
branches:  netbsd-7
changeset: 799649:7e6bc0bac821
user:      riz <riz%NetBSD.org@localhost>
date:      Fri Nov 06 00:46:50 2015 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #985):
        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 42b4714932cc -r 7e6bc0bac821 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Fri Nov 06 00:40:02 2015 +0000
+++ b/sys/netinet/if_arp.c      Fri Nov 06 00:46:50 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.158 2014/06/03 01:24:32 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.158.2.1 2015/11/06 00:46:50 riz 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.158 2014/06/03 01:24:32 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.158.2.1 2015/11/06 00:46:50 riz 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