Deleted Added
full compact
in_rmx.c (191816) in_rmx.c (193232)
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 191816 2009-05-05 10:56:12Z zec $");
44__FBSDID("$FreeBSD: head/sys/netinet/in_rmx.c 193232 2009-06-01 15:49:42Z bz $");
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>

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

246#endif
247
248static void in_rtqtimo_one(void *rock);
249
250static void
251in_rtqtimo(void *rock)
252{
253 CURVNET_SET((struct vnet *) rock);
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>

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

246#endif
247
248static void in_rtqtimo_one(void *rock);
249
250static void
251in_rtqtimo(void *rock)
252{
253 CURVNET_SET((struct vnet *) rock);
254 INIT_VNET_NET(curvnet);
255 INIT_VNET_INET(curvnet);
256 int fibnum;
257 void *newrock;
258 struct timeval atv;
259
260 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
254 INIT_VNET_INET(curvnet);
255 int fibnum;
256 void *newrock;
257 struct timeval atv;
258
259 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
261 if ((newrock = V_rt_tables[fibnum][AF_INET]) != NULL)
260 newrock = rt_tables_get_rnh(fibnum, AF_INET);
261 if (newrock != 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

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

319 VNET_ITERATOR_DECL(vnet_iter);
320 struct radix_node_head *rnh;
321 struct rtqk_arg arg;
322 int fibnum;
323
324 VNET_LIST_RLOCK();
325 VNET_FOREACH(vnet_iter) {
326 CURVNET_SET(vnet_iter);
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

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

319 VNET_ITERATOR_DECL(vnet_iter);
320 struct radix_node_head *rnh;
321 struct rtqk_arg arg;
322 int fibnum;
323
324 VNET_LIST_RLOCK();
325 VNET_FOREACH(vnet_iter) {
326 CURVNET_SET(vnet_iter);
327 INIT_VNET_NET(vnet_iter);
328
329 for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) {
327
328 for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) {
330 rnh = V_rt_tables[fibnum][AF_INET];
329 rnh = rt_tables_get_rnh(fibnum, AF_INET);
331 arg.found = arg.killed = 0;
332 arg.rnh = rnh;
333 arg.nextstop = 0;
334 arg.draining = 1;
335 arg.updating = 0;
336 RADIX_NODE_HEAD_LOCK(rnh);
337 rnh->rnh_walktree(rnh, in_rtqkill, &arg);
338 RADIX_NODE_HEAD_UNLOCK(rnh);

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

418 }
419 RT_UNLOCK(rt);
420 return 0;
421}
422
423int
424in_ifadown(struct ifaddr *ifa, int delete)
425{
330 arg.found = arg.killed = 0;
331 arg.rnh = rnh;
332 arg.nextstop = 0;
333 arg.draining = 1;
334 arg.updating = 0;
335 RADIX_NODE_HEAD_LOCK(rnh);
336 rnh->rnh_walktree(rnh, in_rtqkill, &arg);
337 RADIX_NODE_HEAD_UNLOCK(rnh);

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

417 }
418 RT_UNLOCK(rt);
419 return 0;
420}
421
422int
423in_ifadown(struct ifaddr *ifa, int delete)
424{
426 INIT_VNET_NET(curvnet);
427 struct in_ifadown_arg arg;
428 struct radix_node_head *rnh;
429 int fibnum;
430
431 if (ifa->ifa_addr->sa_family != AF_INET)
432 return 1;
433
434 for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) {
425 struct in_ifadown_arg arg;
426 struct radix_node_head *rnh;
427 int fibnum;
428
429 if (ifa->ifa_addr->sa_family != AF_INET)
430 return 1;
431
432 for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) {
435 rnh = V_rt_tables[fibnum][AF_INET];
433 rnh = rt_tables_get_rnh(fibnum, AF_INET);
436 arg.ifa = ifa;
437 arg.del = delete;
438 RADIX_NODE_HEAD_LOCK(rnh);
439 rnh->rnh_walktree(rnh, in_ifadownkill, &arg);
440 RADIX_NODE_HEAD_UNLOCK(rnh);
441 ifa->ifa_flags &= ~IFA_ROUTE; /* XXXlocking? */
442 }
443 return 0;

--- 56 unchanged lines hidden ---
434 arg.ifa = ifa;
435 arg.del = delete;
436 RADIX_NODE_HEAD_LOCK(rnh);
437 rnh->rnh_walktree(rnh, in_ifadownkill, &arg);
438 RADIX_NODE_HEAD_UNLOCK(rnh);
439 ifa->ifa_flags &= ~IFA_ROUTE; /* XXXlocking? */
440 }
441 return 0;

--- 56 unchanged lines hidden ---