Date: Fri, 3 Oct 1997 13:51:40 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: freebsd-hackers@freebsd.org Subject: bpfattach() bug Message-ID: <199710032051.NAA23325@bubba.whistle.com>
next in thread | raw e-mail | index | archive | help
FYI- The bpfattach() routine makes an assumption that it will only ever be called at boot time (specifically, before any /dev/bpf* devices are opened). This assumption is false, for example, in any case where an interface can be created dynamically (such as ours). The following patch fixes this in both -stable and -current. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com *** /usr/src/sys/net/bpf.c Wed Apr 9 00:31:05 1997 --- bpf.c Fri Oct 3 13:11:44 1997 *************** *** 115,120 **** --- 115,121 ---- */ static struct bpf_if *bpf_iflist; static struct bpf_d bpf_dtab[NBPFILTER]; + static int bpf_dtab_init; static int bpf_allocbufs __P((struct bpf_d *)); static void bpf_attachd __P((struct bpf_d *d, struct bpf_if *bp)); *************** *** 1293,1301 **** /* * 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); --- 1294,1304 ---- /* * Mark all the descriptors free if this hasn't been done. */ ! if (!bpf_dtab_init) { for (i = 0; i < NBPFILTER; ++i) D_MARKFREE(&bpf_dtab[i]); + bpf_dtab_init = 1; + } if (bootverbose) printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710032051.NAA23325>