Deleted Added
full compact
if_enc.c (241394) if_enc.c (241610)
1/*-
2 * Copyright (c) 2006 The FreeBSD Project.
3 * 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 *

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2006 The FreeBSD Project.
3 * 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 *

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/net/if_enc.c 241394 2012-10-10 08:36:38Z kevlo $
27 * $FreeBSD: head/sys/net/if_enc.c 241610 2012-10-16 13:37:54Z glebius $
28 */
29
30#include "opt_inet.h"
31#include "opt_inet6.h"
32#include "opt_enc.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

86 struct ifnet *sc_ifp;
87};
88
89static int enc_ioctl(struct ifnet *, u_long, caddr_t);
90static int enc_output(struct ifnet *ifp, struct mbuf *m,
91 struct sockaddr *dst, struct route *ro);
92static int enc_clone_create(struct if_clone *, int, caddr_t);
93static void enc_clone_destroy(struct ifnet *);
28 */
29
30#include "opt_inet.h"
31#include "opt_inet6.h"
32#include "opt_enc.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

86 struct ifnet *sc_ifp;
87};
88
89static int enc_ioctl(struct ifnet *, u_long, caddr_t);
90static int enc_output(struct ifnet *ifp, struct mbuf *m,
91 struct sockaddr *dst, struct route *ro);
92static int enc_clone_create(struct if_clone *, int, caddr_t);
93static void enc_clone_destroy(struct ifnet *);
94static struct if_clone *enc_cloner;
95static const char encname[] = "enc";
94
96
95IFC_SIMPLE_DECLARE(enc, 1);
96
97/*
98 * Sysctls.
99 */
100
101/*
102 * Before and after are relative to when we are stripping the
103 * outer IP header.
104 */

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

138
139 sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
140 ifp = sc->sc_ifp = if_alloc(IFT_ENC);
141 if (ifp == NULL) {
142 free(sc, M_DEVBUF);
143 return (ENOSPC);
144 }
145
97/*
98 * Sysctls.
99 */
100
101/*
102 * Before and after are relative to when we are stripping the
103 * outer IP header.
104 */

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

138
139 sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
140 ifp = sc->sc_ifp = if_alloc(IFT_ENC);
141 if (ifp == NULL) {
142 free(sc, M_DEVBUF);
143 return (ENOSPC);
144 }
145
146 if_initname(ifp, ifc->ifc_name, unit);
146 if_initname(ifp, encname, unit);
147 ifp->if_mtu = ENCMTU;
148 ifp->if_ioctl = enc_ioctl;
149 ifp->if_output = enc_output;
150 ifp->if_snd.ifq_maxlen = ifqmaxlen;
151 ifp->if_softc = sc;
152 if_attach(ifp);
153 bpfattach(ifp, DLT_ENC, sizeof(struct enchdr));
154

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

162}
163
164static int
165enc_modevent(module_t mod, int type, void *data)
166{
167 switch (type) {
168 case MOD_LOAD:
169 mtx_init(&enc_mtx, "enc mtx", NULL, MTX_DEF);
147 ifp->if_mtu = ENCMTU;
148 ifp->if_ioctl = enc_ioctl;
149 ifp->if_output = enc_output;
150 ifp->if_snd.ifq_maxlen = ifqmaxlen;
151 ifp->if_softc = sc;
152 if_attach(ifp);
153 bpfattach(ifp, DLT_ENC, sizeof(struct enchdr));
154

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

162}
163
164static int
165enc_modevent(module_t mod, int type, void *data)
166{
167 switch (type) {
168 case MOD_LOAD:
169 mtx_init(&enc_mtx, "enc mtx", NULL, MTX_DEF);
170 if_clone_attach(&enc_cloner);
170 enc_cloner = if_clone_simple(encname, enc_clone_create,
171 enc_clone_destroy, 0);
171 break;
172 case MOD_UNLOAD:
173 printf("enc module unload - not possible for this module\n");
174 return (EINVAL);
175 default:
176 return (EOPNOTSUPP);
177 }
178 return (0);

--- 186 unchanged lines hidden ---
172 break;
173 case MOD_UNLOAD:
174 printf("enc module unload - not possible for this module\n");
175 return (EINVAL);
176 default:
177 return (EOPNOTSUPP);
178 }
179 return (0);

--- 186 unchanged lines hidden ---