bpf.c (48645) | bpf.c (49827) |
---|---|
1/* 2 * Copyright (c) 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from the Stanford/CMU enet packet filter, 6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 * Berkeley Laboratory. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)bpf.c 8.2 (Berkeley) 3/28/94 39 * | 1/* 2 * Copyright (c) 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from the Stanford/CMU enet packet filter, 6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 * Berkeley Laboratory. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)bpf.c 8.2 (Berkeley) 3/28/94 39 * |
40 * $Id: bpf.c,v 1.51 1999/05/31 11:28:08 phk Exp $ | 40 * $Id: bpf.c,v 1.52 1999/07/06 19:23:10 des Exp $ |
41 */ 42 43#include "bpf.h" 44 45#ifndef __GNUC__ 46#define inline 47#else 48#define inline __inline --- 24 unchanged lines hidden (view full) --- 73#include <net/bpf.h> 74#include <net/bpfdesc.h> 75 76#include <netinet/in.h> 77#include <netinet/if_ether.h> 78#include <sys/kernel.h> 79#include <sys/sysctl.h> 80 | 41 */ 42 43#include "bpf.h" 44 45#ifndef __GNUC__ 46#define inline 47#else 48#define inline __inline --- 24 unchanged lines hidden (view full) --- 73#include <net/bpf.h> 74#include <net/bpfdesc.h> 75 76#include <netinet/in.h> 77#include <netinet/if_ether.h> 78#include <sys/kernel.h> 79#include <sys/sysctl.h> 80 |
81#include "opt_devfs.h" | 81MALLOC_DEFINE(M_BPF, "BPF", "BPF data"); |
82 | 82 |
83#ifdef DEVFS 84#include <sys/devfsext.h> 85#endif /*DEVFS*/ 86 | |
87#if NBPF > 0 88 89/* 90 * Older BSDs don't have kernel malloc. 91 */ 92#if BSD < 199103 93extern bcopy(); 94static caddr_t bpf_alloc(); --- 11 unchanged lines hidden (view full) --- 106 * The default read buffer size is patchable. 107 */ 108static int bpf_bufsize = BPF_BUFSIZE; 109SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW, 110 &bpf_bufsize, 0, ""); 111 112/* 113 * bpf_iflist is the list of interfaces; each corresponds to an ifnet | 83#if NBPF > 0 84 85/* 86 * Older BSDs don't have kernel malloc. 87 */ 88#if BSD < 199103 89extern bcopy(); 90static caddr_t bpf_alloc(); --- 11 unchanged lines hidden (view full) --- 102 * The default read buffer size is patchable. 103 */ 104static int bpf_bufsize = BPF_BUFSIZE; 105SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW, 106 &bpf_bufsize, 0, ""); 107 108/* 109 * bpf_iflist is the list of interfaces; each corresponds to an ifnet |
114 * bpf_dtab holds the descriptors, indexed by minor device # | |
115 */ 116static struct bpf_if *bpf_iflist; | 110 */ 111static struct bpf_if *bpf_iflist; |
117static struct bpf_d bpf_dtab[NBPF]; 118static int bpf_dtab_init; | |
119 120static int bpf_allocbufs __P((struct bpf_d *)); 121static void bpf_attachd __P((struct bpf_d *d, struct bpf_if *bp)); 122static void bpf_detachd __P((struct bpf_d *d)); 123static void bpf_freed __P((struct bpf_d *)); 124static void bpf_ifname __P((struct ifnet *, struct ifreq *)); 125static void bpf_mcopy __P((const void *, void *, size_t)); 126static int bpf_movein __P((struct uio *, int, --- 207 unchanged lines hidden (view full) --- 334 if (bp->bif_dlist == 0) 335 /* 336 * Let the driver know that there are no more listeners. 337 */ 338 d->bd_bif->bif_ifp->if_bpf = 0; 339 d->bd_bif = 0; 340} 341 | 112 113static int bpf_allocbufs __P((struct bpf_d *)); 114static void bpf_attachd __P((struct bpf_d *d, struct bpf_if *bp)); 115static void bpf_detachd __P((struct bpf_d *d)); 116static void bpf_freed __P((struct bpf_d *)); 117static void bpf_ifname __P((struct ifnet *, struct ifreq *)); 118static void bpf_mcopy __P((const void *, void *, size_t)); 119static int bpf_movein __P((struct uio *, int, --- 207 unchanged lines hidden (view full) --- 327 if (bp->bif_dlist == 0) 328 /* 329 * Let the driver know that there are no more listeners. 330 */ 331 d->bd_bif->bif_ifp->if_bpf = 0; 332 d->bd_bif = 0; 333} 334 |
342 | |
343/* | 335/* |
344 * Mark a descriptor free by making it point to itself. 345 * This is probably cheaper than marking with a constant since 346 * the address should be in a register anyway. 347 */ 348#define D_ISFREE(d) ((d) == (d)->bd_next) 349#define D_MARKFREE(d) ((d)->bd_next = (d)) 350#define D_MARKUSED(d) ((d)->bd_next = 0) 351 352/* | |
353 * Open ethernet device. Returns ENXIO for illegal minor device number, 354 * EBUSY if file is open by another process. 355 */ 356/* ARGSUSED */ 357static int 358bpfopen(dev, flags, fmt, p) 359 dev_t dev; 360 int flags; 361 int fmt; 362 struct proc *p; 363{ 364 register struct bpf_d *d; 365 366 if (p->p_prison) 367 return (EPERM); 368 | 336 * Open ethernet device. Returns ENXIO for illegal minor device number, 337 * EBUSY if file is open by another process. 338 */ 339/* ARGSUSED */ 340static int 341bpfopen(dev, flags, fmt, p) 342 dev_t dev; 343 int flags; 344 int fmt; 345 struct proc *p; 346{ 347 register struct bpf_d *d; 348 349 if (p->p_prison) 350 return (EPERM); 351 |
369 if (minor(dev) >= NBPF) 370 return (ENXIO); | 352 d = dev->si_drv1; |
371 /* | 353 /* |
372 * Each minor can be opened by only one process. If the requested | 354 * Each minor can be opened by only one process. If the requested |
373 * minor is in use, return EBUSY. 374 */ | 355 * minor is in use, return EBUSY. 356 */ |
375 d = &bpf_dtab[minor(dev)]; 376 if (!D_ISFREE(d)) | 357 if (d) |
377 return (EBUSY); | 358 return (EBUSY); |
378 379 /* Mark "free" and do most initialization. */ 380 bzero((char *)d, sizeof(*d)); | 359 make_dev(&bpf_cdevsw, minor(dev), 0, 0, 0600, "bpf%d", lminor(dev)); 360 MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK); 361 bzero(d, sizeof(*d)); 362 dev->si_drv1 = d; |
381 d->bd_bufsize = bpf_bufsize; 382 d->bd_sig = SIGIO; 383 384 return (0); 385} 386 387/* 388 * Close the descriptor by detaching it from its interface, 389 * deallocating its buffers, and marking it free. 390 */ 391/* ARGSUSED */ 392static int 393bpfclose(dev, flags, fmt, p) 394 dev_t dev; 395 int flags; 396 int fmt; 397 struct proc *p; 398{ | 363 d->bd_bufsize = bpf_bufsize; 364 d->bd_sig = SIGIO; 365 366 return (0); 367} 368 369/* 370 * Close the descriptor by detaching it from its interface, 371 * deallocating its buffers, and marking it free. 372 */ 373/* ARGSUSED */ 374static int 375bpfclose(dev, flags, fmt, p) 376 dev_t dev; 377 int flags; 378 int fmt; 379 struct proc *p; 380{ |
399 register struct bpf_d *d = &bpf_dtab[minor(dev)]; | 381 register struct bpf_d *d = dev->si_drv1; |
400 register int s; 401 402 funsetown(d->bd_sigio); 403 s = splimp(); 404 if (d->bd_bif) 405 bpf_detachd(d); 406 splx(s); 407 bpf_freed(d); | 382 register int s; 383 384 funsetown(d->bd_sigio); 385 s = splimp(); 386 if (d->bd_bif) 387 bpf_detachd(d); 388 splx(s); 389 bpf_freed(d); |
390 dev->si_drv1 = 0; 391 FREE(d, M_BPF); |
|
408 409 return (0); 410} 411 412/* 413 * Support for SunOS, which does not have tsleep. 414 */ 415#if BSD < 199103 --- 47 unchanged lines hidden (view full) --- 463 * bpfread - read next chunk of packets from buffers 464 */ 465static int 466bpfread(dev, uio, ioflag) 467 dev_t dev; 468 register struct uio *uio; 469 int ioflag; 470{ | 392 393 return (0); 394} 395 396/* 397 * Support for SunOS, which does not have tsleep. 398 */ 399#if BSD < 199103 --- 47 unchanged lines hidden (view full) --- 447 * bpfread - read next chunk of packets from buffers 448 */ 449static int 450bpfread(dev, uio, ioflag) 451 dev_t dev; 452 register struct uio *uio; 453 int ioflag; 454{ |
471 register struct bpf_d *d = &bpf_dtab[minor(dev)]; | 455 register struct bpf_d *d = dev->si_drv1; |
472 int error; 473 int s; 474 475 /* 476 * Restrict application to use a buffer the same size as 477 * as kernel buffers. 478 */ 479 if (uio->uio_resid != d->bd_bufsize) --- 93 unchanged lines hidden (view full) --- 573} 574 575static int 576bpfwrite(dev, uio, ioflag) 577 dev_t dev; 578 struct uio *uio; 579 int ioflag; 580{ | 456 int error; 457 int s; 458 459 /* 460 * Restrict application to use a buffer the same size as 461 * as kernel buffers. 462 */ 463 if (uio->uio_resid != d->bd_bufsize) --- 93 unchanged lines hidden (view full) --- 557} 558 559static int 560bpfwrite(dev, uio, ioflag) 561 dev_t dev; 562 struct uio *uio; 563 int ioflag; 564{ |
581 register struct bpf_d *d = &bpf_dtab[minor(dev)]; | 565 register struct bpf_d *d = dev->si_drv1; |
582 struct ifnet *ifp; 583 struct mbuf *m; 584 int error, s; 585 static struct sockaddr dst; 586 int datlen; 587 588 if (d->bd_bif == 0) 589 return (ENXIO); --- 62 unchanged lines hidden (view full) --- 652static int 653bpfioctl(dev, cmd, addr, flags, p) 654 dev_t dev; 655 u_long cmd; 656 caddr_t addr; 657 int flags; 658 struct proc *p; 659{ | 566 struct ifnet *ifp; 567 struct mbuf *m; 568 int error, s; 569 static struct sockaddr dst; 570 int datlen; 571 572 if (d->bd_bif == 0) 573 return (ENXIO); --- 62 unchanged lines hidden (view full) --- 636static int 637bpfioctl(dev, cmd, addr, flags, p) 638 dev_t dev; 639 u_long cmd; 640 caddr_t addr; 641 int flags; 642 struct proc *p; 643{ |
660 register struct bpf_d *d = &bpf_dtab[minor(dev)]; | 644 register struct bpf_d *d = dev->si_drv1; |
661 int s, error = 0; 662 663 switch (cmd) { 664 665 default: 666 error = EINVAL; 667 break; 668 --- 235 unchanged lines hidden (view full) --- 904 if (fp->bf_insns == 0) { 905 if (fp->bf_len != 0) 906 return (EINVAL); 907 s = splimp(); 908 d->bd_filter = 0; 909 reset_d(d); 910 splx(s); 911 if (old != 0) | 645 int s, error = 0; 646 647 switch (cmd) { 648 649 default: 650 error = EINVAL; 651 break; 652 --- 235 unchanged lines hidden (view full) --- 888 if (fp->bf_insns == 0) { 889 if (fp->bf_len != 0) 890 return (EINVAL); 891 s = splimp(); 892 d->bd_filter = 0; 893 reset_d(d); 894 splx(s); 895 if (old != 0) |
912 free((caddr_t)old, M_DEVBUF); | 896 free((caddr_t)old, M_BPF); |
913 return (0); 914 } 915 flen = fp->bf_len; 916 if (flen > BPF_MAXINSNS) 917 return (EINVAL); 918 919 size = flen * sizeof(*fp->bf_insns); | 897 return (0); 898 } 899 flen = fp->bf_len; 900 if (flen > BPF_MAXINSNS) 901 return (EINVAL); 902 903 size = flen * sizeof(*fp->bf_insns); |
920 fcode = (struct bpf_insn *)malloc(size, M_DEVBUF, M_WAITOK); | 904 fcode = (struct bpf_insn *)malloc(size, M_BPF, M_WAITOK); |
921 if (copyin((caddr_t)fp->bf_insns, (caddr_t)fcode, size) == 0 && 922 bpf_validate(fcode, (int)flen)) { 923 s = splimp(); 924 d->bd_filter = fcode; 925 reset_d(d); 926 splx(s); 927 if (old != 0) | 905 if (copyin((caddr_t)fp->bf_insns, (caddr_t)fcode, size) == 0 && 906 bpf_validate(fcode, (int)flen)) { 907 s = splimp(); 908 d->bd_filter = fcode; 909 reset_d(d); 910 splx(s); 911 if (old != 0) |
928 free((caddr_t)old, M_DEVBUF); | 912 free((caddr_t)old, M_BPF); |
929 930 return (0); 931 } | 913 914 return (0); 915 } |
932 free((caddr_t)fcode, M_DEVBUF); | 916 free((caddr_t)fcode, M_BPF); |
933 return (EINVAL); 934} 935 936/* 937 * Detach a file from its current interface (if attached at all) and attach 938 * to the interface indicated by the name stored in ifr. 939 * Return an errno or 0. 940 */ --- 85 unchanged lines hidden (view full) --- 1026{ 1027 register struct bpf_d *d; 1028 register int s; 1029 int revents = 0; 1030 1031 /* 1032 * An imitation of the FIONREAD ioctl code. 1033 */ | 917 return (EINVAL); 918} 919 920/* 921 * Detach a file from its current interface (if attached at all) and attach 922 * to the interface indicated by the name stored in ifr. 923 * Return an errno or 0. 924 */ --- 85 unchanged lines hidden (view full) --- 1010{ 1011 register struct bpf_d *d; 1012 register int s; 1013 int revents = 0; 1014 1015 /* 1016 * An imitation of the FIONREAD ioctl code. 1017 */ |
1034 d = &bpf_dtab[minor(dev)]; | 1018 d = dev->si_drv1; |
1035 1036 s = splimp(); 1037 if (events & (POLLIN | POLLRDNORM)) { 1038 if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0)) 1039 revents |= events & (POLLIN | POLLRDNORM); 1040 else 1041 selrecord(p, &d->bd_sel); 1042 } --- 161 unchanged lines hidden (view full) --- 1204 1205/* 1206 * Initialize all nonzero fields of a descriptor. 1207 */ 1208static int 1209bpf_allocbufs(d) 1210 register struct bpf_d *d; 1211{ | 1019 1020 s = splimp(); 1021 if (events & (POLLIN | POLLRDNORM)) { 1022 if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0)) 1023 revents |= events & (POLLIN | POLLRDNORM); 1024 else 1025 selrecord(p, &d->bd_sel); 1026 } --- 161 unchanged lines hidden (view full) --- 1188 1189/* 1190 * Initialize all nonzero fields of a descriptor. 1191 */ 1192static int 1193bpf_allocbufs(d) 1194 register struct bpf_d *d; 1195{ |
1212 d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK); | 1196 d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, M_WAITOK); |
1213 if (d->bd_fbuf == 0) 1214 return (ENOBUFS); 1215 | 1197 if (d->bd_fbuf == 0) 1198 return (ENOBUFS); 1199 |
1216 d->bd_sbuf = (caddr_t)malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK); | 1200 d->bd_sbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, M_WAITOK); |
1217 if (d->bd_sbuf == 0) { | 1201 if (d->bd_sbuf == 0) { |
1218 free(d->bd_fbuf, M_DEVBUF); | 1202 free(d->bd_fbuf, M_BPF); |
1219 return (ENOBUFS); 1220 } 1221 d->bd_slen = 0; 1222 d->bd_hlen = 0; 1223 return (0); 1224} 1225 1226/* --- 5 unchanged lines hidden (view full) --- 1232 register struct bpf_d *d; 1233{ 1234 /* 1235 * We don't need to lock out interrupts since this descriptor has 1236 * been detached from its interface and it yet hasn't been marked 1237 * free. 1238 */ 1239 if (d->bd_sbuf != 0) { | 1203 return (ENOBUFS); 1204 } 1205 d->bd_slen = 0; 1206 d->bd_hlen = 0; 1207 return (0); 1208} 1209 1210/* --- 5 unchanged lines hidden (view full) --- 1216 register struct bpf_d *d; 1217{ 1218 /* 1219 * We don't need to lock out interrupts since this descriptor has 1220 * been detached from its interface and it yet hasn't been marked 1221 * free. 1222 */ 1223 if (d->bd_sbuf != 0) { |
1240 free(d->bd_sbuf, M_DEVBUF); | 1224 free(d->bd_sbuf, M_BPF); |
1241 if (d->bd_hbuf != 0) | 1225 if (d->bd_hbuf != 0) |
1242 free(d->bd_hbuf, M_DEVBUF); | 1226 free(d->bd_hbuf, M_BPF); |
1243 if (d->bd_fbuf != 0) | 1227 if (d->bd_fbuf != 0) |
1244 free(d->bd_fbuf, M_DEVBUF); | 1228 free(d->bd_fbuf, M_BPF); |
1245 } 1246 if (d->bd_filter) | 1229 } 1230 if (d->bd_filter) |
1247 free((caddr_t)d->bd_filter, M_DEVBUF); 1248 1249 D_MARKFREE(d); | 1231 free((caddr_t)d->bd_filter, M_BPF); |
1250} 1251 1252/* 1253 * Attach an interface to bpf. driverp is a pointer to a (struct bpf_if *) 1254 * in the driver's softc; dlt is the link layer type; hdrlen is the fixed 1255 * size of the link header (variable length headers not yet supported). 1256 */ 1257void 1258bpfattach(ifp, dlt, hdrlen) 1259 struct ifnet *ifp; 1260 u_int dlt, hdrlen; 1261{ 1262 struct bpf_if *bp; | 1232} 1233 1234/* 1235 * Attach an interface to bpf. driverp is a pointer to a (struct bpf_if *) 1236 * in the driver's softc; dlt is the link layer type; hdrlen is the fixed 1237 * size of the link header (variable length headers not yet supported). 1238 */ 1239void 1240bpfattach(ifp, dlt, hdrlen) 1241 struct ifnet *ifp; 1242 u_int dlt, hdrlen; 1243{ 1244 struct bpf_if *bp; |
1263 int i; 1264 bp = (struct bpf_if *)malloc(sizeof(*bp), M_DEVBUF, M_DONTWAIT); | 1245 bp = (struct bpf_if *)malloc(sizeof(*bp), M_BPF, M_DONTWAIT); |
1265 if (bp == 0) 1266 panic("bpfattach"); 1267 1268 bp->bif_dlist = 0; 1269 bp->bif_ifp = ifp; 1270 bp->bif_dlt = dlt; 1271 1272 bp->bif_next = bpf_iflist; --- 4 unchanged lines hidden (view full) --- 1277 /* 1278 * Compute the length of the bpf header. This is not necessarily 1279 * equal to SIZEOF_BPF_HDR because we want to insert spacing such 1280 * that the network layer header begins on a longword boundary (for 1281 * performance reasons and to alleviate alignment restrictions). 1282 */ 1283 bp->bif_hdrlen = BPF_WORDALIGN(hdrlen + SIZEOF_BPF_HDR) - hdrlen; 1284 | 1246 if (bp == 0) 1247 panic("bpfattach"); 1248 1249 bp->bif_dlist = 0; 1250 bp->bif_ifp = ifp; 1251 bp->bif_dlt = dlt; 1252 1253 bp->bif_next = bpf_iflist; --- 4 unchanged lines hidden (view full) --- 1258 /* 1259 * Compute the length of the bpf header. This is not necessarily 1260 * equal to SIZEOF_BPF_HDR because we want to insert spacing such 1261 * that the network layer header begins on a longword boundary (for 1262 * performance reasons and to alleviate alignment restrictions). 1263 */ 1264 bp->bif_hdrlen = BPF_WORDALIGN(hdrlen + SIZEOF_BPF_HDR) - hdrlen; 1265 |
1285 /* 1286 * Mark all the descriptors free if this hasn't been done. 1287 */ 1288 if (!bpf_dtab_init) { 1289 for (i = 0; i < NBPF; ++i) 1290 D_MARKFREE(&bpf_dtab[i]); 1291 bpf_dtab_init = 1; 1292 } 1293 | |
1294 if (bootverbose) 1295 printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); 1296} 1297 | 1266 if (bootverbose) 1267 printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); 1268} 1269 |
1298#ifdef DEVFS 1299static void *bpf_devfs_token[NBPF]; 1300#endif 1301 1302static int bpf_devsw_installed; 1303 | |
1304static void bpf_drvinit __P((void *unused)); | 1270static void bpf_drvinit __P((void *unused)); |
1271 |
|
1305static void 1306bpf_drvinit(unused) 1307 void *unused; 1308{ | 1272static void 1273bpf_drvinit(unused) 1274 void *unused; 1275{ |
1309#ifdef DEVFS 1310 int i; 1311#endif | |
1312 | 1276 |
1313 if( ! bpf_devsw_installed ) { 1314 cdevsw_add(&bpf_cdevsw); 1315 bpf_devsw_installed = 1; 1316#ifdef DEVFS 1317 1318 for ( i = 0 ; i < NBPF ; i++ ) { 1319 bpf_devfs_token[i] = 1320 devfs_add_devswf(&bpf_cdevsw, i, DV_CHR, 0, 0, 1321 0600, "bpf%d", i); 1322 } 1323#endif 1324 } | 1277 cdevsw_add(&bpf_cdevsw); |
1325} 1326 1327SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) 1328 1329#else /* !BPF */ 1330/* 1331 * NOP stubs to allow bpf-using drivers to load and function. 1332 * --- 28 unchanged lines hidden (view full) --- 1361 register struct bpf_insn *pc; 1362 register u_char *p; 1363 u_int wirelen; 1364 register u_int buflen; 1365{ 1366 return -1; /* "no filter" behaviour */ 1367} 1368 | 1278} 1279 1280SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) 1281 1282#else /* !BPF */ 1283/* 1284 * NOP stubs to allow bpf-using drivers to load and function. 1285 * --- 28 unchanged lines hidden (view full) --- 1314 register struct bpf_insn *pc; 1315 register u_char *p; 1316 u_int wirelen; 1317 register u_int buflen; 1318{ 1319 return -1; /* "no filter" behaviour */ 1320} 1321 |
1369#endif | 1322#endif /* !BPF */ |