bpf.c (51658) | bpf.c (52248) |
---|---|
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 * $FreeBSD: head/sys/net/bpf.c 51658 1999-09-25 18:24:47Z phk $ | 40 * $FreeBSD: head/sys/net/bpf.c 52248 1999-10-15 05:07:00Z msmith $ |
41 */ 42 43#include "bpf.h" 44 45#ifndef __GNUC__ 46#define inline 47#else 48#define inline __inline --- 525 unchanged lines hidden (view full) --- 574 575 error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, &m, &dst, &datlen); 576 if (error) 577 return (error); 578 579 if (datlen > ifp->if_mtu) 580 return (EMSGSIZE); 581 | 41 */ 42 43#include "bpf.h" 44 45#ifndef __GNUC__ 46#define inline 47#else 48#define inline __inline --- 525 unchanged lines hidden (view full) --- 574 575 error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, &m, &dst, &datlen); 576 if (error) 577 return (error); 578 579 if (datlen > ifp->if_mtu) 580 return (EMSGSIZE); 581 |
582 if (d->bd_hdrcmplt) 583 dst.sa_family = pseudo_AF_HDRCMPLT; 584 |
|
582 s = splnet(); 583#if BSD >= 199103 584 error = (*ifp->if_output)(ifp, m, &dst, (struct rtentry *)0); 585#else 586 error = (*ifp->if_output)(ifp, m, &dst); 587#endif 588 splx(s); 589 /* --- 31 unchanged lines hidden (view full) --- 621 * BIOCGDLT Get link layer type. 622 * BIOCGETIF Get interface name. 623 * BIOCSETIF Set interface. 624 * BIOCSRTIMEOUT Set read timeout. 625 * BIOCGRTIMEOUT Get read timeout. 626 * BIOCGSTATS Get packet stats. 627 * BIOCIMMEDIATE Set immediate mode. 628 * BIOCVERSION Get filter language version. | 585 s = splnet(); 586#if BSD >= 199103 587 error = (*ifp->if_output)(ifp, m, &dst, (struct rtentry *)0); 588#else 589 error = (*ifp->if_output)(ifp, m, &dst); 590#endif 591 splx(s); 592 /* --- 31 unchanged lines hidden (view full) --- 624 * BIOCGDLT Get link layer type. 625 * BIOCGETIF Get interface name. 626 * BIOCSETIF Set interface. 627 * BIOCSRTIMEOUT Set read timeout. 628 * BIOCGRTIMEOUT Get read timeout. 629 * BIOCGSTATS Get packet stats. 630 * BIOCIMMEDIATE Set immediate mode. 631 * BIOCVERSION Get filter language version. |
632 * BIOCGHDRCMPLT Get "header already complete" flag 633 * BIOCSHDRCMPLT Set "header already complete" flag |
|
629 */ 630/* ARGSUSED */ 631static int 632bpfioctl(dev, cmd, addr, flags, p) 633 dev_t dev; 634 u_long cmd; 635 caddr_t addr; 636 int flags; --- 180 unchanged lines hidden (view full) --- 817 { 818 struct bpf_version *bv = (struct bpf_version *)addr; 819 820 bv->bv_major = BPF_MAJOR_VERSION; 821 bv->bv_minor = BPF_MINOR_VERSION; 822 break; 823 } 824 | 634 */ 635/* ARGSUSED */ 636static int 637bpfioctl(dev, cmd, addr, flags, p) 638 dev_t dev; 639 u_long cmd; 640 caddr_t addr; 641 int flags; --- 180 unchanged lines hidden (view full) --- 822 { 823 struct bpf_version *bv = (struct bpf_version *)addr; 824 825 bv->bv_major = BPF_MAJOR_VERSION; 826 bv->bv_minor = BPF_MINOR_VERSION; 827 break; 828 } 829 |
830 /* 831 * Get "header already complete" flag 832 */ 833 case BIOCGHDRCMPLT: 834 *(u_int *)addr = d->bd_hdrcmplt; 835 break; 836 837 /* 838 * Set "header already complete" flag 839 */ 840 case BIOCSHDRCMPLT: 841 d->bd_hdrcmplt = *(u_int *)addr ? 1 : 0; 842 break; 843 |
|
825 case FIONBIO: /* Non-blocking I/O */ 826 break; 827 828 case FIOASYNC: /* Send signal on receive packets */ 829 d->bd_async = *(int *)addr; 830 break; 831 832 case FIOSETOWN: --- 485 unchanged lines hidden --- | 844 case FIONBIO: /* Non-blocking I/O */ 845 break; 846 847 case FIOASYNC: /* Send signal on receive packets */ 848 d->bd_async = *(int *)addr; 849 break; 850 851 case FIOSETOWN: --- 485 unchanged lines hidden --- |