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 * 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 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet/ip_input.c 215701 2010-11-22 19:32:54Z dim $"); |
34 35#include "opt_bootp.h" 36#include "opt_ipfw.h" 37#include "opt_ipstealth.h" 38#include "opt_ipsec.h" 39#include "opt_route.h" 40 41#include <sys/param.h> --- 49 unchanged lines hidden (view full) --- 91 92VNET_DEFINE(int, rsvp_on); 93 94VNET_DEFINE(int, ipforwarding); 95SYSCTL_VNET_INT(_net_inet_ip, IPCTL_FORWARDING, forwarding, CTLFLAG_RW, 96 &VNET_NAME(ipforwarding), 0, 97 "Enable IP forwarding between interfaces"); 98 |
99static VNET_DEFINE(int, ipsendredirects) = 1; /* XXX */ |
100#define V_ipsendredirects VNET(ipsendredirects) 101SYSCTL_VNET_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_RW, 102 &VNET_NAME(ipsendredirects), 0, 103 "Enable sending IP redirects"); 104 105VNET_DEFINE(int, ip_defttl) = IPDEFTTL; 106SYSCTL_VNET_INT(_net_inet_ip, IPCTL_DEFTTL, ttl, CTLFLAG_RW, 107 &VNET_NAME(ip_defttl), 0, 108 "Maximum TTL on IP packets"); 109 |
110static VNET_DEFINE(int, ip_keepfaith); |
111#define V_ip_keepfaith VNET(ip_keepfaith) 112SYSCTL_VNET_INT(_net_inet_ip, IPCTL_KEEPFAITH, keepfaith, CTLFLAG_RW, 113 &VNET_NAME(ip_keepfaith), 0, 114 "Enable packet capture for FAITH IPv4->IPv6 translater daemon"); 115 |
116static VNET_DEFINE(int, ip_sendsourcequench); |
117#define V_ip_sendsourcequench VNET(ip_sendsourcequench) 118SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, sendsourcequench, CTLFLAG_RW, 119 &VNET_NAME(ip_sendsourcequench), 0, 120 "Enable the transmission of source quench packets"); 121 122VNET_DEFINE(int, ip_do_randomid); 123SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, random_id, CTLFLAG_RW, 124 &VNET_NAME(ip_do_randomid), 0, --- 7 unchanged lines hidden (view full) --- 132 * 133 * XXX - ip_checkinterface currently must be disabled if you use ipnat 134 * to translate the destination address to another local interface. 135 * 136 * XXX - ip_checkinterface must be disabled if you add IP aliases 137 * to the loopback interface instead of the interface where the 138 * packets for those addresses are received. 139 */ |
140static VNET_DEFINE(int, ip_checkinterface); |
141#define V_ip_checkinterface VNET(ip_checkinterface) 142SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, check_interface, CTLFLAG_RW, 143 &VNET_NAME(ip_checkinterface), 0, 144 "Verify packet arrives on correct interface"); 145 146VNET_DEFINE(struct pfil_head, inet_pfil_hook); /* Packet filter hooks */ 147 148static struct netisr_handler ip_nh = { --- 10 unchanged lines hidden (view full) --- 159VNET_DEFINE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); /* inet addr hash table */ 160VNET_DEFINE(u_long, in_ifaddrhmask); /* mask for hash table */ 161 162VNET_DEFINE(struct ipstat, ipstat); 163SYSCTL_VNET_STRUCT(_net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW, 164 &VNET_NAME(ipstat), ipstat, 165 "IP statistics (struct ipstat, netinet/ip_var.h)"); 166 |
167static VNET_DEFINE(uma_zone_t, ipq_zone); 168static VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]); |
169static struct mtx ipqlock; 170 171#define V_ipq_zone VNET(ipq_zone) 172#define V_ipq VNET(ipq) 173 174#define IPQ_LOCK() mtx_lock(&ipqlock) 175#define IPQ_UNLOCK() mtx_unlock(&ipqlock) 176#define IPQ_LOCK_INIT() mtx_init(&ipqlock, "ipqlock", NULL, MTX_DEF) 177#define IPQ_LOCK_ASSERT() mtx_assert(&ipqlock, MA_OWNED) 178 179static void maxnipq_update(void); 180static void ipq_zone_change(void *); 181static void ip_drain_locked(void); 182 |
183static VNET_DEFINE(int, maxnipq); /* Administrative limit on # reass queues. */ 184static VNET_DEFINE(int, nipq); /* Total # of reass queues */ |
185#define V_maxnipq VNET(maxnipq) 186#define V_nipq VNET(nipq) 187SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD, 188 &VNET_NAME(nipq), 0, 189 "Current number of IPv4 fragment reassembly queue entries"); 190 |
191static VNET_DEFINE(int, maxfragsperpacket); |
192#define V_maxfragsperpacket VNET(maxfragsperpacket) 193SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, maxfragsperpacket, CTLFLAG_RW, 194 &VNET_NAME(maxfragsperpacket), 0, 195 "Maximum number of IPv4 fragments allowed per packet"); 196 197struct callout ipport_tick_callout; 198 199#ifdef IPCTL_DEFMTU --- 4 unchanged lines hidden (view full) --- 204#ifdef IPSTEALTH 205VNET_DEFINE(int, ipstealth); 206SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, stealth, CTLFLAG_RW, 207 &VNET_NAME(ipstealth), 0, 208 "IP stealth mode, no TTL decrementation on forwarding"); 209#endif 210 211#ifdef FLOWTABLE |
212static VNET_DEFINE(int, ip_output_flowtable_size) = 2048; |
213VNET_DEFINE(struct flowtable *, ip_ft); 214#define V_ip_output_flowtable_size VNET(ip_output_flowtable_size) 215 216SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, output_flowtable_size, CTLFLAG_RDTUN, 217 &VNET_NAME(ip_output_flowtable_size), 2048, 218 "number of entries in the per-cpu output flow caches"); 219#endif 220 --- 1493 unchanged lines hidden (view full) --- 1714} 1715 1716/* 1717 * XXXRW: Multicast routing code in ip_mroute.c is generally MPSAFE, but the 1718 * ip_rsvp and ip_rsvp_on variables need to be interlocked with rsvp_on 1719 * locking. This code remains in ip_input.c as ip_mroute.c is optionally 1720 * compiled. 1721 */ |
1722static VNET_DEFINE(int, ip_rsvp_on); |
1723VNET_DEFINE(struct socket *, ip_rsvpd); 1724 1725#define V_ip_rsvp_on VNET(ip_rsvp_on) 1726 1727int 1728ip_rsvp_init(struct socket *so) 1729{ 1730 --- 62 unchanged lines hidden --- |