Date: Thu, 29 Aug 2002 05:43:36 +0200 From: Julien Benoist <julienbenoist@altern.org> To: freebsd-hackers@freebsd.org Subject: toggling promiscuous mode logging on NICs Message-ID: <200208290542.09749.julienbenoist@altern.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
This is a patch allowing to control kernel logging of promiscuous mode changes
on network interfaces through sysctl (enabled by default) :
kern.log_promisc=1
I dont know if this mib should be placed somewhere else, nor if the feature
itself could interest anyone... Patch attached anyway.
--
Julien Benoist
[-- Attachment #2 --]
--- /usr/src.old/sys/net/if.c Sun Apr 28 07:40:25 2002
+++ /usr/src/sys/net/if.c Thu Aug 29 03:52:06 2002
@@ -80,6 +80,10 @@
static void if_slowtimo __P((void *));
static void link_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
static int if_rtdel __P((struct radix_node *, void *));
+static int log_promisc = 1;
+
+SYSCTL_INT(_kern, OID_AUTO, log_promisc, CTLFLAG_RW,
+ &log_promisc, 0 , "toggle promiscuity mode");
SYSINIT(interfaces, SI_SUB_PROTO_IF, SI_ORDER_FIRST, ifinit, NULL)
@@ -1245,14 +1249,18 @@
if (ifp->if_pcount++ != 0)
return (0);
ifp->if_flags |= IFF_PROMISC;
- log(LOG_INFO, "%s%d: promiscuous mode enabled\n",
- ifp->if_name, ifp->if_unit);
+ if (log_promisc==1) {
+ log(LOG_INFO, "%s%d: promiscuous mode enabled\n",
+ ifp->if_name, ifp->if_unit);
+ }
} else {
if (--ifp->if_pcount > 0)
return (0);
ifp->if_flags &= ~IFF_PROMISC;
- log(LOG_INFO, "%s%d: promiscuous mode disabled\n",
- ifp->if_name, ifp->if_unit);
+ if (log_promisc==1) {
+ log(LOG_INFO, "%s%d: promiscuous mode disabled\n",
+ ifp->if_name, ifp->if_unit);
+ }
}
ifr.ifr_flags = ifp->if_flags;
error = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208290542.09749.julienbenoist>
