mirror of
https://github.com/opnsense/src.git
synced 2026-04-29 18:32:49 -04:00
previously always pointing to the default vnet context, to a dynamically changing thread-local one. The currvnet context should be set on entry to networking code via CURVNET_SET() macros, and reverted to previous state via CURVNET_RESTORE(). Recursions on curvnet are permitted, though strongly discuouraged. This change should have no functional impact on nooptions VIMAGE kernel builds, where CURVNET_* macros expand to whitespace. The curthread->td_vnet (aka curvnet) variable's purpose is to be an indicator of the vnet context in which the current network-related operation takes place, in case we cannot deduce the current vnet context from any other source, such as by looking at mbuf's m->m_pkthdr.rcvif->if_vnet, sockets's so->so_vnet etc. Moreover, so far curvnet has turned out to be an invaluable consistency checking aid: it helps to catch cases when sockets, ifnets or any other vnet-aware structures may have leaked from one vnet to another. The exact placement of the CURVNET_SET() / CURVNET_RESTORE() macros was a result of an empirical iterative process, whith an aim to reduce recursions on CURVNET_SET() to a minimum, while still reducing the scope of CURVNET_SET() to networking only operations - the alternative would be calling CURVNET_SET() on each system call entry. In general, curvnet has to be set in three typicall cases: when processing socket-related requests from userspace or from within the kernel; when processing inbound traffic flowing from device drivers to upper layers of the networking stack, and when executing timer-driven networking functions. This change also introduces a DDB subcommand to show the list of all vnet instances. Approved by: julian (mentor) |
||
|---|---|---|
| .. | ||
| dest6.c | ||
| frag6.c | ||
| icmp6.c | ||
| icmp6.h | ||
| in6.c | ||
| in6.h | ||
| in6_cksum.c | ||
| in6_gif.c | ||
| in6_gif.h | ||
| in6_ifattach.c | ||
| in6_ifattach.h | ||
| in6_mcast.c | ||
| in6_pcb.c | ||
| in6_pcb.h | ||
| in6_proto.c | ||
| in6_rmx.c | ||
| in6_src.c | ||
| in6_var.h | ||
| ip6.h | ||
| ip6_ecn.h | ||
| ip6_forward.c | ||
| ip6_id.c | ||
| ip6_input.c | ||
| ip6_ipsec.c | ||
| ip6_ipsec.h | ||
| ip6_mroute.c | ||
| ip6_mroute.h | ||
| ip6_output.c | ||
| ip6_var.h | ||
| ip6protosw.h | ||
| mld6.c | ||
| mld6.h | ||
| mld6_var.h | ||
| nd6.c | ||
| nd6.h | ||
| nd6_nbr.c | ||
| nd6_rtr.c | ||
| pim6.h | ||
| pim6_var.h | ||
| raw_ip6.c | ||
| raw_ip6.h | ||
| route6.c | ||
| scope6.c | ||
| scope6_var.h | ||
| sctp6_usrreq.c | ||
| sctp6_var.h | ||
| tcp6_var.h | ||
| udp6_usrreq.c | ||
| udp6_var.h | ||
| vinet6.h | ||