ip_divert.c (157423) | ip_divert.c (157927) |
---|---|
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 --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 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 --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/netinet/ip_divert.c 157423 2006-04-03 09:01:17Z rwatson $ | 29 * $FreeBSD: head/sys/netinet/ip_divert.c 157927 2006-04-21 09:25:40Z ps $ |
30 */ 31 32#if !defined(KLD_MODULE) 33#include "opt_inet.h" 34#include "opt_ipfw.h" 35#include "opt_mac.h" 36#ifndef INET 37#error "IPDIVERT requires INET." --- 73 unchanged lines hidden (view full) --- 111static struct inpcbinfo divcbinfo; 112 113static u_long div_sendspace = DIVSNDQ; /* XXX sysctl ? */ 114static u_long div_recvspace = DIVRCVQ; /* XXX sysctl ? */ 115 116/* 117 * Initialize divert connection block queue. 118 */ | 30 */ 31 32#if !defined(KLD_MODULE) 33#include "opt_inet.h" 34#include "opt_ipfw.h" 35#include "opt_mac.h" 36#ifndef INET 37#error "IPDIVERT requires INET." --- 73 unchanged lines hidden (view full) --- 111static struct inpcbinfo divcbinfo; 112 113static u_long div_sendspace = DIVSNDQ; /* XXX sysctl ? */ 114static u_long div_recvspace = DIVRCVQ; /* XXX sysctl ? */ 115 116/* 117 * Initialize divert connection block queue. 118 */ |
119static void 120div_zone_change(void *tag) 121{ 122 123 uma_zone_set_max(divcbinfo.ipi_zone, maxsockets); 124} 125 |
|
119void 120div_init(void) 121{ 122 INP_INFO_LOCK_INIT(&divcbinfo, "div"); 123 LIST_INIT(&divcb); 124 divcbinfo.listhead = &divcb; 125 /* 126 * XXX We don't use the hash list for divert IP, but it's easier 127 * to allocate a one entry hash list than it is to check all 128 * over the place for hashbase == NULL. 129 */ 130 divcbinfo.hashbase = hashinit(1, M_PCB, &divcbinfo.hashmask); 131 divcbinfo.porthashbase = hashinit(1, M_PCB, &divcbinfo.porthashmask); 132 divcbinfo.ipi_zone = uma_zcreate("divcb", sizeof(struct inpcb), 133 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); 134 uma_zone_set_max(divcbinfo.ipi_zone, maxsockets); | 126void 127div_init(void) 128{ 129 INP_INFO_LOCK_INIT(&divcbinfo, "div"); 130 LIST_INIT(&divcb); 131 divcbinfo.listhead = &divcb; 132 /* 133 * XXX We don't use the hash list for divert IP, but it's easier 134 * to allocate a one entry hash list than it is to check all 135 * over the place for hashbase == NULL. 136 */ 137 divcbinfo.hashbase = hashinit(1, M_PCB, &divcbinfo.hashmask); 138 divcbinfo.porthashbase = hashinit(1, M_PCB, &divcbinfo.porthashmask); 139 divcbinfo.ipi_zone = uma_zcreate("divcb", sizeof(struct inpcb), 140 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); 141 uma_zone_set_max(divcbinfo.ipi_zone, maxsockets); |
142 EVENTHANDLER_REGISTER(maxsockets_change, div_zone_change, 143 NULL, EVENTHANDLER_PRI_ANY); |
|
135} 136 137/* 138 * IPPROTO_DIVERT is not in the real IP protocol number space; this 139 * function should never be called. Just in case, drop any packets. 140 */ 141void 142div_input(struct mbuf *m, int off) --- 564 unchanged lines hidden --- | 144} 145 146/* 147 * IPPROTO_DIVERT is not in the real IP protocol number space; this 148 * function should never be called. Just in case, drop any packets. 149 */ 150void 151div_input(struct mbuf *m, int off) --- 564 unchanged lines hidden --- |