Deleted Added
full compact
in_rmx.c (191548) in_rmx.c (191816)
1/*-
2 * Copyright 1994, 1995 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

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

36 * requested.
37 * 2) When such routes lose all their references, it arranges for them
38 * to be deleted in some random collection of circumstances, so that
39 * a large quantity of stale routing data is not kept in kernel memory
40 * indefinitely. See in_rtqtimo() below for the exact mechanism.
41 */
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright 1994, 1995 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

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

36 * requested.
37 * 2) When such routes lose all their references, it arranges for them
38 * to be deleted in some random collection of circumstances, so that
39 * a large quantity of stale routing data is not kept in kernel memory
40 * indefinitely. See in_rtqtimo() below for the exact mechanism.
41 */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/sys/netinet/in_rmx.c 191548 2009-04-26 22:06:42Z zec $");
44__FBSDID("$FreeBSD: head/sys/netinet/in_rmx.c 191816 2009-05-05 10:56:12Z zec $");
45
46#include "opt_route.h"
47
48#include <sys/param.h>
49#include <sys/systm.h>
50#include <sys/kernel.h>
51#include <sys/sysctl.h>
52#include <sys/socket.h>

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

245static struct callout rtq_timer;
246#endif
247
248static void in_rtqtimo_one(void *rock);
249
250static void
251in_rtqtimo(void *rock)
252{
45
46#include "opt_route.h"
47
48#include <sys/param.h>
49#include <sys/systm.h>
50#include <sys/kernel.h>
51#include <sys/sysctl.h>
52#include <sys/socket.h>

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

245static struct callout rtq_timer;
246#endif
247
248static void in_rtqtimo_one(void *rock);
249
250static void
251in_rtqtimo(void *rock)
252{
253 CURVNET_SET((struct vnet *) rock);
253 INIT_VNET_NET(curvnet);
254 INIT_VNET_INET(curvnet);
255 int fibnum;
256 void *newrock;
257 struct timeval atv;
258
254 INIT_VNET_NET(curvnet);
255 INIT_VNET_INET(curvnet);
256 int fibnum;
257 void *newrock;
258 struct timeval atv;
259
259 KASSERT((rock == (void *)V_rt_tables[0][AF_INET]),
260 ("in_rtqtimo: unexpected arg"));
261 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
262 if ((newrock = V_rt_tables[fibnum][AF_INET]) != NULL)
263 in_rtqtimo_one(newrock);
264 }
265 atv.tv_usec = 0;
266 atv.tv_sec = V_rtq_timeout;
267 callout_reset(&V_rtq_timer, tvtohz(&atv), in_rtqtimo, rock);
260 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
261 if ((newrock = V_rt_tables[fibnum][AF_INET]) != NULL)
262 in_rtqtimo_one(newrock);
263 }
264 atv.tv_usec = 0;
265 atv.tv_sec = V_rtq_timeout;
266 callout_reset(&V_rtq_timer, tvtohz(&atv), in_rtqtimo, rock);
267 CURVNET_RESTORE();
268}
269
270static void
271in_rtqtimo_one(void *rock)
272{
273 INIT_VNET_INET(curvnet);
274 struct radix_node_head *rnh = rock;
275 struct rtqk_arg arg;

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

372 V_rtq_timeout = RTQ_TIMEOUT;
373
374 rnh = *head;
375 rnh->rnh_addaddr = in_addroute;
376 rnh->rnh_matchaddr = in_matroute;
377 rnh->rnh_close = in_clsroute;
378 if (_in_rt_was_here == 0 ) {
379 callout_init(&V_rtq_timer, CALLOUT_MPSAFE);
268}
269
270static void
271in_rtqtimo_one(void *rock)
272{
273 INIT_VNET_INET(curvnet);
274 struct radix_node_head *rnh = rock;
275 struct rtqk_arg arg;

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

372 V_rtq_timeout = RTQ_TIMEOUT;
373
374 rnh = *head;
375 rnh->rnh_addaddr = in_addroute;
376 rnh->rnh_matchaddr = in_matroute;
377 rnh->rnh_close = in_clsroute;
378 if (_in_rt_was_here == 0 ) {
379 callout_init(&V_rtq_timer, CALLOUT_MPSAFE);
380 in_rtqtimo(rnh); /* kick off timeout first time */
380 callout_reset(&V_rtq_timer, 1, in_rtqtimo, curvnet);
381 _in_rt_was_here = 1;
382 }
383 return 1;
384}
385
386/*
387 * This zaps old routes when the interface goes down or interface
388 * address is deleted. In the latter case, it deletes static routes

--- 111 unchanged lines hidden ---
381 _in_rt_was_here = 1;
382 }
383 return 1;
384}
385
386/*
387 * This zaps old routes when the interface goes down or interface
388 * address is deleted. In the latter case, it deletes static routes

--- 111 unchanged lines hidden ---