--- /sys/net/if.c	Fri Dec  5 18:12:17 2003
+++ /home/cdp_xe/projekte/fupids/sys/net/if.c	Fri Dec  5 18:12:11 2003
@@ -2,6 +2,7 @@
 /*	$NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $	*/
 
 /*
+ * Copyright (C) 2003 Steffen Wendzel (FUPIDS Code) <cdp@doomed-reality.org>
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  * 
@@ -110,6 +111,10 @@
 #include <netinet/ip_carp.h>
 #endif
 
+#ifdef FUPIDS
+#include <sys/fupids.h>
+#endif
+
 void	if_attachsetup(struct ifnet *);
 void	if_attachdomain1(struct ifnet *);
 int	if_detach_rtdelete(struct radix_node *, void *);
@@ -1345,6 +1350,18 @@
 		if (ifp->if_pcount++ != 0)
 			return (0);
 		ifp->if_flags |= IFF_PROMISC;
+#ifdef FUPIDS
+		/* do not check lo[01] */
+		if ((ifp->if_xname[0] != 'l') && (ifp->if_xname[1] != 'o')){
+			printf("fupids: %s: set in promiscuous mode! [proc: %s pid: %i "
+				"| parent: %s ppid: %i | uid: %i]\n",
+				ifp->if_xname, curproc->p_comm, (int) curproc->p_pid,
+				curproc->p_pptr->p_comm, (int) curproc->p_pptr->p_pid,
+				(int) curproc->p_cred->p_ruid);
+			if(curproc->p_cred->p_ruid >= 1000) /* if the admin setuid's tcpdump ;) */
+				upid_userfind(curproc->p_cred->p_ruid, UPID_PERMMODNIF);
+		}
+#endif
 	} else {
 		if (--ifp->if_pcount > 0)
 			return (0);
