Date: Wed, 5 Feb 1997 14:26:01 +0100 (MET) From: Jean-Luc.Richier@imag.fr To: FreeBSD-gnats-submit@freebsd.org Subject: kern/2667: Bug in bpfattach Message-ID: <199702051326.OAA00408@tuna.imag.fr> Resent-Message-ID: <199702051330.FAA14661@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2667 >Category: kern >Synopsis: bpfattach can hang the system >Confidential: yes >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Feb 5 05:30:00 PST 1997 >Last-Modified: >Originator: Jean-Luc Richier >Organization: Institut IMAg, Grenoble, France >Release: FreeBSD 2.1.6-RELEASE i386 >Environment: >Description: While working on the IPv6 extensions for NetBSD and FreeBSD, I discovered a problem with bpfattach behaviour. If one tries to make extensions to NetBSD, this behaviour raise problems. Therefore I suggest corrections to the base distribution code. If the ifattach function is called while a bpf filter is open, the system hangs. >How-To-Repeat: - Make a modfication in the system which allows to configure a new driver at any time (In my case, it is a dynamic modification of the number of IPv6 tunnel drivers) - open bpf filters, for example run ``rarpd -a'' - configure a new driver - some seconds later, the system will hang >Fix: Add a static variable to test if it is the first call to bpfattach *** sys/net/bpf.c.DIST Sat Jun 8 08:14:15 1996 --- sys/net/bpf.c Wed Feb 5 11:43:23 1997 *************** *** 1271,1276 **** --- 1271,1277 ---- { struct bpf_if *bp; int i; + static int already = 0; #if BSD < 199103 static struct bpf_if bpf_ifs[NBPFILTER]; static int bpfifno; *************** *** 1303,1311 **** /* * Mark all the descriptors free if this hasn't been done. */ ! if (!D_ISFREE(&bpf_dtab[0])) for (i = 0; i < NBPFILTER; ++i) D_MARKFREE(&bpf_dtab[i]); if (bootverbose) printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); --- 1304,1314 ---- /* * Mark all the descriptors free if this hasn't been done. */ ! if(!already) { ! already = 1; for (i = 0; i < NBPFILTER; ++i) D_MARKFREE(&bpf_dtab[i]); + } if (bootverbose) printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702051326.OAA00408>