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 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); |
254 INIT_VNET_INET(curvnet); 255 int fibnum; 256 void *newrock; 257 struct timeval atv; 258 259 for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { |
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); |
327 328 for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) { |
329 rnh = rt_tables_get_rnh(fibnum, AF_INET); |
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{ |
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++) { |
433 rnh = rt_tables_get_rnh(fibnum, AF_INET); |
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 --- |