Deleted Added
full compact
if_disc.c (41757) if_disc.c (48645)
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93
34 * $Id: if_disc.c,v 1.20 1998/06/07 17:12:03 dfr Exp $
34 * $Id: if_disc.c,v 1.21 1998/12/14 01:59:16 eivind Exp $
35 */
36
37/*
38 * Discard interface driver for protocol testing and timing.
39 * (Based on the loopback.)
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/mbuf.h>
46#include <sys/socket.h>
47#include <sys/sockio.h>
48
49#include <net/if.h>
50#include <net/if_types.h>
51#include <net/route.h>
52#include <net/bpf.h>
53
35 */
36
37/*
38 * Discard interface driver for protocol testing and timing.
39 * (Based on the loopback.)
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/mbuf.h>
46#include <sys/socket.h>
47#include <sys/sockio.h>
48
49#include <net/if.h>
50#include <net/if_types.h>
51#include <net/route.h>
52#include <net/bpf.h>
53
54#include "bpfilter.h"
54#include "bpf.h"
55#include "opt_inet.h"
56
57#ifdef TINY_DSMTU
58#define DSMTU (1024+512)
59#else
60#define DSMTU 65532
61#endif
62

--- 17 unchanged lines hidden (view full) ---

80 ifp->if_mtu = DSMTU;
81 ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
82 ifp->if_ioctl = discioctl;
83 ifp->if_output = discoutput;
84 ifp->if_type = IFT_LOOP;
85 ifp->if_hdrlen = 0;
86 ifp->if_addrlen = 0;
87 if_attach(ifp);
55#include "opt_inet.h"
56
57#ifdef TINY_DSMTU
58#define DSMTU (1024+512)
59#else
60#define DSMTU 65532
61#endif
62

--- 17 unchanged lines hidden (view full) ---

80 ifp->if_mtu = DSMTU;
81 ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
82 ifp->if_ioctl = discioctl;
83 ifp->if_output = discoutput;
84 ifp->if_type = IFT_LOOP;
85 ifp->if_hdrlen = 0;
86 ifp->if_addrlen = 0;
87 if_attach(ifp);
88#if NBPFILTER > 0
88#if NBPF > 0
89 bpfattach(ifp, DLT_NULL, sizeof(u_int));
90#endif
91}
92
93static int
94discoutput(ifp, m, dst, rt)
95 struct ifnet *ifp;
96 register struct mbuf *m;
97 struct sockaddr *dst;
98 register struct rtentry *rt;
99{
100 if ((m->m_flags & M_PKTHDR) == 0)
101 panic("discoutput no HDR");
89 bpfattach(ifp, DLT_NULL, sizeof(u_int));
90#endif
91}
92
93static int
94discoutput(ifp, m, dst, rt)
95 struct ifnet *ifp;
96 register struct mbuf *m;
97 struct sockaddr *dst;
98 register struct rtentry *rt;
99{
100 if ((m->m_flags & M_PKTHDR) == 0)
101 panic("discoutput no HDR");
102#if NBPFILTER > 0
102#if NBPF > 0
103 /* BPF write needs to be handled specially */
104 if (dst->sa_family == AF_UNSPEC) {
105 dst->sa_family = *(mtod(m, int *));
106 m->m_len -= sizeof(int);
107 m->m_pkthdr.len -= sizeof(int);
108 m->m_data += sizeof(int);
109 }
110

--- 92 unchanged lines hidden ---
103 /* BPF write needs to be handled specially */
104 if (dst->sa_family == AF_UNSPEC) {
105 dst->sa_family = *(mtod(m, int *));
106 m->m_len -= sizeof(int);
107 m->m_pkthdr.len -= sizeof(int);
108 m->m_data += sizeof(int);
109 }
110

--- 92 unchanged lines hidden ---