Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 May 2016 09:44:06 +0000 (UTC)
From:      Nick Hibma <n_hibma@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r300488 - stable/10/sys/net
Message-ID:  <201605230944.u4N9i69B068252@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: n_hibma
Date: Mon May 23 09:44:06 2016
New Revision: 300488
URL: https://svnweb.freebsd.org/changeset/base/300488

Log:
  MFC 299559:
  
  	 Allow silencing of 'promiscuous mode enabled/disabled'
  	 messages.

Modified:
  stable/10/sys/net/if.c

Modified: stable/10/sys/net/if.c
==============================================================================
--- stable/10/sys/net/if.c	Mon May 23 07:32:34 2016	(r300487)
+++ stable/10/sys/net/if.c	Mon May 23 09:44:06 2016	(r300488)
@@ -113,6 +113,13 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link
 	&log_link_state_change, 0,
 	"log interface link state change events");
 
+/* Log promiscuous mode change events */
+static int log_promisc_mode_change = 1;
+
+SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RW,
+	&log_promisc_mode_change, 1,
+	"log promiscuous mode change events");
+
 /* Interface description */
 static unsigned int ifdescr_maxlen = 1024;
 SYSCTL_UINT(_net, OID_AUTO, ifdescr_maxlen, CTLFLAG_RW,
@@ -2394,9 +2401,11 @@ ifhwioctl(u_long cmd, struct ifnet *ifp,
 				ifp->if_flags |= IFF_PROMISC;
 			else if (ifp->if_pcount == 0)
 				ifp->if_flags &= ~IFF_PROMISC;
-			log(LOG_INFO, "%s: permanently promiscuous mode %s\n",
-			    ifp->if_xname,
-			    (new_flags & IFF_PPROMISC) ? "enabled" : "disabled");
+			if (log_promisc_mode_change)
+                                log(LOG_INFO, "%s: permanently promiscuous mode %s\n",
+                                    ifp->if_xname,
+                                    ((new_flags & IFF_PPROMISC) ?
+                                     "enabled" : "disabled"));
 		}
 		ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
 			(new_flags &~ IFF_CANTCHANGE);
@@ -2951,7 +2960,8 @@ ifpromisc(struct ifnet *ifp, int pswitch
 	error = if_setflag(ifp, IFF_PROMISC, IFF_PPROMISC,
 			   &ifp->if_pcount, pswitch);
 	/* If promiscuous mode status has changed, log a message */
-	if (error == 0 && ((ifp->if_flags ^ oldflags) & IFF_PROMISC))
+	if (error == 0 && ((ifp->if_flags ^ oldflags) & IFF_PROMISC) &&
+            log_promisc_mode_change)
 		log(LOG_INFO, "%s: promiscuous mode %s\n",
 		    ifp->if_xname,
 		    (ifp->if_flags & IFF_PROMISC) ? "enabled" : "disabled");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605230944.u4N9i69B068252>