Deleted Added
full compact
if_me.c (274246) if_me.c (284066)
1/*-
2 * Copyright (c) 2014 Andrey V. Elsukov <ae@FreeBSD.org>
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 *

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2014 Andrey V. Elsukov <ae@FreeBSD.org>
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 *

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net/if_me.c 274246 2014-11-07 19:13:19Z ae $");
28__FBSDID("$FreeBSD: stable/10/sys/net/if_me.c 284066 2015-06-06 12:44:42Z ae $");
29
30#include <sys/param.h>
31#include <sys/jail.h>
32#include <sys/kernel.h>
33#include <sys/lock.h>
34#include <sys/libkern.h>
35#include <sys/malloc.h>
36#include <sys/module.h>

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

135#endif
136
137static VNET_DEFINE(int, max_me_nesting) = MAX_ME_NEST;
138#define V_max_me_nesting VNET(max_me_nesting)
139SYSCTL_INT(_net_link_me, OID_AUTO, max_nesting, CTLFLAG_RW | CTLFLAG_VNET,
140 &VNET_NAME(max_me_nesting), 0, "Max nested tunnels");
141
142extern struct domain inetdomain;
29
30#include <sys/param.h>
31#include <sys/jail.h>
32#include <sys/kernel.h>
33#include <sys/lock.h>
34#include <sys/libkern.h>
35#include <sys/malloc.h>
36#include <sys/module.h>

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

135#endif
136
137static VNET_DEFINE(int, max_me_nesting) = MAX_ME_NEST;
138#define V_max_me_nesting VNET(max_me_nesting)
139SYSCTL_INT(_net_link_me, OID_AUTO, max_nesting, CTLFLAG_RW | CTLFLAG_VNET,
140 &VNET_NAME(max_me_nesting), 0, "Max nested tunnels");
141
142extern struct domain inetdomain;
143static void me_input10(struct mbuf *, int);
143static const struct protosw in_mobile_protosw = {
144 .pr_type = SOCK_RAW,
145 .pr_domain = &inetdomain,
146 .pr_protocol = IPPROTO_MOBILE,
147 .pr_flags = PR_ATOMIC|PR_ADDR,
144static const struct protosw in_mobile_protosw = {
145 .pr_type = SOCK_RAW,
146 .pr_domain = &inetdomain,
147 .pr_protocol = IPPROTO_MOBILE,
148 .pr_flags = PR_ATOMIC|PR_ADDR,
148 .pr_input = me_input,
149 .pr_output = rip_output,
149 .pr_input = me_input10,
150 .pr_output = (pr_output_t *)rip_output,
150 .pr_ctlinput = rip_ctlinput,
151 .pr_ctloutput = rip_ctloutput,
152 .pr_usrreqs = &rip_usrreqs
153};
154
155static void
156vnet_me_init(const void *unused __unused)
157{

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

392
393 while (nwords-- > 0)
394 sum += *p++;
395 sum = (sum >> 16) + (sum & 0xffff);
396 sum += (sum >> 16);
397 return (~sum);
398}
399
151 .pr_ctlinput = rip_ctlinput,
152 .pr_ctloutput = rip_ctloutput,
153 .pr_usrreqs = &rip_usrreqs
154};
155
156static void
157vnet_me_init(const void *unused __unused)
158{

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

393
394 while (nwords-- > 0)
395 sum += *p++;
396 sum = (sum >> 16) + (sum & 0xffff);
397 sum += (sum >> 16);
398 return (~sum);
399}
400
401static void
402me_input10(struct mbuf *m, int off)
403{
404 int proto;
405
406 proto = (mtod(m, struct ip *))->ip_p;
407 me_input(&m, &off, proto);
408}
409
400int
401me_input(struct mbuf **mp, int *offp, int proto)
402{
403 struct me_softc *sc;
404 struct mobhdr *mh;
405 struct ifnet *ifp;
406 struct mbuf *m;
407 struct ip *ip;

--- 240 unchanged lines hidden ---
410int
411me_input(struct mbuf **mp, int *offp, int proto)
412{
413 struct me_softc *sc;
414 struct mobhdr *mh;
415 struct ifnet *ifp;
416 struct mbuf *m;
417 struct ip *ip;

--- 240 unchanged lines hidden ---