Deleted Added
full compact
ip_input.c (192893) ip_input.c (193219)
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>
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 192893 2009-05-27 12:44:36Z trasz $");
33__FBSDID("$FreeBSD: head/sys/netinet/ip_input.c 193219 2009-06-01 10:41:38Z rwatson $");
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#include "opt_mac.h"
41#include "opt_carp.h"

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

159 * packets for those addresses are received.
160 */
161SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO,
162 check_interface, CTLFLAG_RW, ip_checkinterface, 0,
163 "Verify packet arrives on correct interface");
164
165struct pfil_head inet_pfil_hook; /* Packet filter hooks */
166
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#include "opt_mac.h"
41#include "opt_carp.h"

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

159 * packets for those addresses are received.
160 */
161SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO,
162 check_interface, CTLFLAG_RW, ip_checkinterface, 0,
163 "Verify packet arrives on correct interface");
164
165struct pfil_head inet_pfil_hook; /* Packet filter hooks */
166
167static struct ifqueue ipintrq;
168static int ipqmaxlen = IFQ_MAXLEN;
167static struct netisr_handler ip_nh = {
168 .nh_name = "ip",
169 .nh_handler = ip_input,
170 .nh_proto = NETISR_IP,
171 .nh_policy = NETISR_POLICY_FLOW,
172};
169
170extern struct domain inetdomain;
171extern struct protosw inetsw[];
172u_char ip_protox[IPPROTO_MAX];
173
173
174extern struct domain inetdomain;
175extern struct protosw inetsw[];
176u_char ip_protox[IPPROTO_MAX];
177
174SYSCTL_INT(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_queue_maxlen, CTLFLAG_RW,
175 &ipintrq.ifq_maxlen, 0, "Maximum size of the IP input queue");
176SYSCTL_INT(_net_inet_ip, IPCTL_INTRQDROPS, intr_queue_drops, CTLFLAG_RD,
177 &ipintrq.ifq_drops, 0,
178 "Number of packets dropped from the IP input queue");
179
180SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW,
181 ipstat, ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)");
182
183#ifdef VIMAGE_GLOBALS
184static uma_zone_t ipq_zone;
185#endif
186static struct mtx ipqlock;

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

244{
245
246 vnet_mod_register(&vnet_inet_modinfo);
247}
248
249SYSINIT(inet, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, vnet_inet_register, 0);
250#endif
251
178
179SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW,
180 ipstat, ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)");
181
182#ifdef VIMAGE_GLOBALS
183static uma_zone_t ipq_zone;
184#endif
185static struct mtx ipqlock;

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

243{
244
245 vnet_mod_register(&vnet_inet_modinfo);
246}
247
248SYSINIT(inet, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, vnet_inet_register, 0);
249#endif
250
251static int
252sysctl_netinet_intr_queue_maxlen(SYSCTL_HANDLER_ARGS)
253{
254 int error, qlimit;
255
256 netisr_getqlimit(&ip_nh, &qlimit);
257 error = sysctl_handle_int(oidp, &qlimit, 0, req);
258 if (error || !req->newptr)
259 return (error);
260 if (qlimit < 1)
261 return (EINVAL);
262 return (netisr_setqlimit(&ip_nh, qlimit));
263}
264SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_queue_maxlen,
265 CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_netinet_intr_queue_maxlen, "I",
266 "Maximum size of the IP input queue");
267
268static int
269sysctl_netinet_intr_queue_drops(SYSCTL_HANDLER_ARGS)
270{
271 u_int64_t qdrops_long;
272 int error, qdrops;
273
274 netisr_getqdrops(&ip_nh, &qdrops_long);
275 qdrops = qdrops_long;
276 error = sysctl_handle_int(oidp, &qdrops, 0, req);
277 if (error || !req->newptr)
278 return (error);
279 if (qdrops != 0)
280 return (EINVAL);
281 netisr_clearqdrops(&ip_nh);
282 return (0);
283}
284
285SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQDROPS, intr_queue_drops,
286 CTLTYPE_INT|CTLFLAG_RD, 0, 0, sysctl_netinet_intr_queue_drops, "I",
287 "Number of packets dropped from the IP input queue");
288
252/*
253 * IP initialization: fill in IP protocol switch table.
254 * All protocols not implemented in kernel go to raw IP protocol handler.
255 */
256void
257ip_init(void)
258{
259 INIT_VNET_INET(curvnet);

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

342 callout_reset(&ipport_tick_callout, 1, ipport_tick, NULL);
343 EVENTHANDLER_REGISTER(shutdown_pre_sync, ip_fini, NULL,
344 SHUTDOWN_PRI_DEFAULT);
345 EVENTHANDLER_REGISTER(nmbclusters_change, ipq_zone_change,
346 NULL, EVENTHANDLER_PRI_ANY);
347
348 /* Initialize various other remaining things. */
349 IPQ_LOCK_INIT();
289/*
290 * IP initialization: fill in IP protocol switch table.
291 * All protocols not implemented in kernel go to raw IP protocol handler.
292 */
293void
294ip_init(void)
295{
296 INIT_VNET_INET(curvnet);

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

379 callout_reset(&ipport_tick_callout, 1, ipport_tick, NULL);
380 EVENTHANDLER_REGISTER(shutdown_pre_sync, ip_fini, NULL,
381 SHUTDOWN_PRI_DEFAULT);
382 EVENTHANDLER_REGISTER(nmbclusters_change, ipq_zone_change,
383 NULL, EVENTHANDLER_PRI_ANY);
384
385 /* Initialize various other remaining things. */
386 IPQ_LOCK_INIT();
350 ipintrq.ifq_maxlen = ipqmaxlen;
351 mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF);
352 netisr_register(NETISR_IP, ip_input, &ipintrq, 0);
353
387 netisr_register(&ip_nh);
354 ip_ft = flowtable_alloc(ip_output_flowtable_size, FL_PCPU);
355}
356
357void
358ip_fini(void *xtp)
359{
360
361 callout_stop(&ipport_tick_callout);

--- 1383 unchanged lines hidden ---
388 ip_ft = flowtable_alloc(ip_output_flowtable_size, FL_PCPU);
389}
390
391void
392ip_fini(void *xtp)
393{
394
395 callout_stop(&ipport_tick_callout);

--- 1383 unchanged lines hidden ---