Author: n_hibma
Date: Thu May 12 19:42:13 2016
New Revision: 299559
URL: https://svnweb.freebsd.org/changeset/base/299559

Log:
  Allow silencing of 'promiscuous mode enabled/disabled' messages.
  
  PR:           166255
  Submitted by: eugen.grosbein.net
  Obtained from:        eugen.grosbein.net
  MFC after:    1 week

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c   Thu May 12 19:40:47 2016        (r299558)
+++ head/sys/net/if.c   Thu May 12 19:42:13 2016        (r299559)
@@ -112,6 +112,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,
@@ -2326,9 +2333,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);
@@ -2813,7 +2822,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");
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to