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
--- /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);