Allow users to turn off certain arp logging.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 13 Apr 2009 11:37:07 +0000 (19:37 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 13 Apr 2009 11:38:25 +0000 (19:38 +0800)
Obtained-from: FreeBSD

sys/netinet/if_ether.c

index f94affa..d922ce9 100644 (file)
@@ -607,10 +607,22 @@ arpintr(struct netmsg *msg)
  * We no longer reply to requests for ETHERTYPE_TRAIL protocol either,
  * but formerly didn't normally send requests.
  */
-static int log_arp_wrong_iface = 1;
+
+static int     log_arp_wrong_iface = 1;
+static int     log_arp_movements = 1;
+static int     log_arp_permanent_modify = 1;
+
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW,
           &log_arp_wrong_iface, 0,
-          "log arp packets arriving on the wrong interface");
+          "Log arp packets arriving on the wrong interface");
+SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_movements, CTLFLAG_RW,
+          &log_arp_movements, 0,
+          "Log arp replies from MACs different than the one in the cache");
+SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_permanent_modify, CTLFLAG_RW,
+          &log_arp_permanent_modify, 0,
+          "Log arp replies from MACs different than the one "
+          "in the permanent arp entry");
+
 
 static void
 arp_hold_output(struct netmsg *nmsg)
@@ -661,7 +673,7 @@ arp_update_oncpu(struct mbuf *m, in_addr_t saddr, boolean_t create,
                if (sdl->sdl_alen &&
                    bcmp(ar_sha(ah), LLADDR(sdl), sdl->sdl_alen)) {
                        if (rt->rt_expire != 0) {
-                               if (dologging) {
+                               if (dologging && log_arp_movements) {
                                        log(LOG_INFO,
                                        "arp: %s moved from %*D to %*D on %s\n",
                                        inet_ntoa(isaddr),
@@ -671,7 +683,7 @@ arp_update_oncpu(struct mbuf *m, in_addr_t saddr, boolean_t create,
                                        ifp->if_xname);
                                }
                        } else {
-                               if (dologging) {
+                               if (dologging && log_arp_permanent_modify) {
                                        log(LOG_ERR,
                                        "arp: %*D attempts to modify "
                                        "permanent entry for %s on %s\n",