Deleted Added
full compact
if_tun.c (10080) if_tun.c (10429)
1/* $NetBSD: if_tun.c,v 1.14 1994/06/29 06:36:25 cgd Exp $ */
2
3/*
4 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
5 * Nottingham University 1987.
6 *
7 * This source may be freely distributed, however I would be interested
8 * in any changes that are made.

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

57#include "bpfilter.h"
58#if NBPFILTER > 0
59#include <sys/time.h>
60#include <net/bpf.h>
61#endif
62
63#include <net/if_tun.h>
64
1/* $NetBSD: if_tun.c,v 1.14 1994/06/29 06:36:25 cgd Exp $ */
2
3/*
4 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
5 * Nottingham University 1987.
6 *
7 * This source may be freely distributed, however I would be interested
8 * in any changes that are made.

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

57#include "bpfilter.h"
58#if NBPFILTER > 0
59#include <sys/time.h>
60#include <net/bpf.h>
61#endif
62
63#include <net/if_tun.h>
64
65#ifdef __FreeBSD__
66static void tunattach __P((caddr_t));
67PSEUDO_SET(tunattach, if_tun);
68#endif
69
65#define TUNDEBUG if (tundebug) printf
66int tundebug = 0;
67
68struct tun_softc tunctl[NTUN];
69
70d_open_t tunopen;
71d_close_t tunclose;
72int tunoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *,
73 struct rtentry *rt));
74d_rdwr_t tunread;
75d_rdwr_t tunwrite;
76d_ioctl_t tunioctl;
77int tunifioctl __P((struct ifnet *, int, caddr_t));
78d_select_t tunselect;
70#define TUNDEBUG if (tundebug) printf
71int tundebug = 0;
72
73struct tun_softc tunctl[NTUN];
74
75d_open_t tunopen;
76d_close_t tunclose;
77int tunoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *,
78 struct rtentry *rt));
79d_rdwr_t tunread;
80d_rdwr_t tunwrite;
81d_ioctl_t tunioctl;
82int tunifioctl __P((struct ifnet *, int, caddr_t));
83d_select_t tunselect;
79void tunattach __P((void));
80
81static struct cdevsw tuncdevsw =
82{ tunopen, tunclose, tunread, tunwrite,
83 tunioctl, (d_stop_t *)enodev, (d_reset_t *)nullop, (d_ttycv_t *)enodev,
84 tunselect, (d_mmap_t *)enodev, NULL };
85extern dev_t tuncdev;
86
87static int tuninit __P((int));
88
84
85static struct cdevsw tuncdevsw =
86{ tunopen, tunclose, tunread, tunwrite,
87 tunioctl, (d_stop_t *)enodev, (d_reset_t *)nullop, (d_ttycv_t *)enodev,
88 tunselect, (d_mmap_t *)enodev, NULL };
89extern dev_t tuncdev;
90
91static int tuninit __P((int));
92
89void
90tunattach(void)
93static void
94tunattach(udata)
95 caddr_t udata;
91{
92 register int i;
93 struct ifnet *ifp;
94 struct sockaddr_in *sin;
95
96 /*
97 * In case we are an LKM, set up device switch.
98 */

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

116 ifp->if_opackets = 0;
117 if_attach(ifp);
118#if NBPFILTER > 0
119 bpfattach(&tunctl[i].tun_bpf, ifp, DLT_NULL, sizeof(u_int));
120#endif
121 }
122}
123
96{
97 register int i;
98 struct ifnet *ifp;
99 struct sockaddr_in *sin;
100
101 /*
102 * In case we are an LKM, set up device switch.
103 */

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

121 ifp->if_opackets = 0;
122 if_attach(ifp);
123#if NBPFILTER > 0
124 bpfattach(&tunctl[i].tun_bpf, ifp, DLT_NULL, sizeof(u_int));
125#endif
126 }
127}
128
124#ifdef __FreeBSD__
125PSEUDO_SET(tunattach, if_tun);
126#endif
127
128/*
129 * tunnel open - must be superuser & the device must be
130 * configured in
131 */
132int
133tunopen(dev, flag, mode, p)
134 dev_t dev;
135 int flag, mode;

--- 443 unchanged lines hidden ---
129/*
130 * tunnel open - must be superuser & the device must be
131 * configured in
132 */
133int
134tunopen(dev, flag, mode, p)
135 dev_t dev;
136 int flag, mode;

--- 443 unchanged lines hidden ---