ip_divert.c (0b08f5f73743f75cfe4603d65bf68a36aca310af) ip_divert.c (3d4d47f39858441d8b8625898e74563f7b60e2b5)
1/*
2 * Copyright (c) 1982, 1986, 1988, 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

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

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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 *
1/*
2 * Copyright (c) 1982, 1986, 1988, 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

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

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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 * $Id: ip_divert.c,v 1.19 1998/02/04 22:33:06 eivind Exp $
33 * $Id: ip_divert.c,v 1.20 1998/02/06 12:13:50 eivind Exp $
34 */
35
36#include "opt_inet.h"
37
38#ifndef INET
39#error IPDIVERT requires INET.
40#endif
41
42#include <sys/param.h>
43#include <sys/malloc.h>
44#include <sys/mbuf.h>
45#include <sys/socket.h>
46#include <sys/protosw.h>
47#include <sys/socketvar.h>
48#include <sys/systm.h>
49#include <sys/proc.h>
34 */
35
36#include "opt_inet.h"
37
38#ifndef INET
39#error IPDIVERT requires INET.
40#endif
41
42#include <sys/param.h>
43#include <sys/malloc.h>
44#include <sys/mbuf.h>
45#include <sys/socket.h>
46#include <sys/protosw.h>
47#include <sys/socketvar.h>
48#include <sys/systm.h>
49#include <sys/proc.h>
50#include <vm/vm_zone.h>
50
51#include <net/if.h>
52#include <net/route.h>
53
54#include <netinet/in.h>
55#include <netinet/in_systm.h>
56#include <netinet/ip.h>
57#include <netinet/in_pcb.h>

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

111 divcbinfo.listhead = &divcb;
112 /*
113 * XXX We don't use the hash list for divert IP, but it's easier
114 * to allocate a one entry hash list than it is to check all
115 * over the place for hashbase == NULL.
116 */
117 divcbinfo.hashbase = hashinit(1, M_PCB, &divcbinfo.hashmask);
118 divcbinfo.porthashbase = hashinit(1, M_PCB, &divcbinfo.porthashmask);
51
52#include <net/if.h>
53#include <net/route.h>
54
55#include <netinet/in.h>
56#include <netinet/in_systm.h>
57#include <netinet/ip.h>
58#include <netinet/in_pcb.h>

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

112 divcbinfo.listhead = &divcb;
113 /*
114 * XXX We don't use the hash list for divert IP, but it's easier
115 * to allocate a one entry hash list than it is to check all
116 * over the place for hashbase == NULL.
117 */
118 divcbinfo.hashbase = hashinit(1, M_PCB, &divcbinfo.hashmask);
119 divcbinfo.porthashbase = hashinit(1, M_PCB, &divcbinfo.porthashmask);
120 divcbinfo.ipi_zone = zinit("divcb", sizeof(struct inpcb),
121 nmbclusters/4, ZONE_INTERRUPT, 0);
119}
120
121/*
122 * Setup generic address and protocol structures
123 * for div_input routine, then pass them along with
124 * mbuf chain. ip->ip_len is assumed to have had
125 * the header length (hlen) subtracted out already.
126 * We tell whether the packet was incoming or outgoing

--- 248 unchanged lines hidden ---
122}
123
124/*
125 * Setup generic address and protocol structures
126 * for div_input routine, then pass them along with
127 * mbuf chain. ip->ip_len is assumed to have had
128 * the header length (hlen) subtracted out already.
129 * We tell whether the packet was incoming or outgoing

--- 248 unchanged lines hidden ---