freebsd-dev/sys/netgraph
Marko Zec f089869fa5 Introduce a mechanism for detecting calls from outbound path of the
network stack when reentering the inbound path from netgraph, and
force queueing of mbufs at the outbound netgraph node.

The mechanism relies on two components.  First, in netgraph nodes
where outbound path of the network stack calls into netgraph, the
current thread has to be appropriately marked using the new
NG_OUTBOUND_THREAD_REF() macro before proceeding to call further
into the netgraph topology, and unmarked using the
NG_OUTBOUND_THREAD_UNREF() macro before returning to the caller.
Second, netgraph nodes which can potentially reenter the network
stack in the inbound path have to mark their inbound hooks using
NG_HOOK_SET_TO_INBOUND() macro.  The netgraph framework will then
detect when there is a danger of a call graph looping back from
outbound to inbound path via netgraph, and defer handing off the
mbufs to the "inbound" node to a worker thread with a clean stack.

In this first pass only the most obvious netgraph nodes have been
updated to ensure no outbound to inbound calls can occur.  Nodes
such as ng_ipfw, ng_gif etc. should be further examined whether a
potential for outbound to inbound call looping exists.

This commit changes the layout of struct thread, but due to
__FreeBSD_version number shortage a version bump has been omitted
at this time, nevertheless kernel and modules have to be rebuilt.

Reviewed by:	julian, rwatson, bz
Approved by:	julian (mentor)
2009-06-11 16:50:49 +00:00
..
atm After r193232 rt_tables in vnet.h are no longer indirectly dependent on 2009-06-08 19:57:35 +00:00
bluetooth Rework socket upcalls to close some races with setup/teardown of upcalls. 2009-06-01 21:17:03 +00:00
netflow Fix copy-paste bug in NGM_NETFLOW_SETCONFIG argument size verification. 2009-05-13 02:26:34 +00:00
netgraph.h Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_async.c Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
ng_async.h
ng_atmllc.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_atmllc.h
ng_base.c Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_bpf.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_bpf.h
ng_bridge.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_bridge.h
ng_car.c - Account all node stats at the shape mode. 2008-03-30 07:53:51 +00:00
ng_car.h Add option to set packets per second limits instead of default 2007-12-19 22:50:14 +00:00
ng_cisco.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_cisco.h
ng_deflate.c Use m_unshare()+m_copyback() instead of m_freem()+m_devget() to keep 2009-01-18 19:25:36 +00:00
ng_deflate.h A node that implements the Deflate sub-protocols of the Compression Control 2006-12-28 15:44:05 +00:00
ng_device.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_device.h
ng_echo.c
ng_echo.h
ng_eiface.c Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_eiface.h
ng_etf.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_etf.h
ng_ether_echo.c Add a trivial node to reflect ethernet frames to whence they came. 2008-12-25 00:01:29 +00:00
ng_ether_echo.h Add a trivial node to reflect ethernet frames to whence they came. 2008-12-25 00:01:29 +00:00
ng_ether.c Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_ether.h
ng_fec.c Change if_output to take a struct route as its fourth argument in order 2009-04-16 20:30:28 +00:00
ng_fec.h
ng_frame_relay.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_frame_relay.h
ng_gif_demux.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_gif_demux.h
ng_gif.c After r193232 rt_tables in vnet.h are no longer indirectly dependent on 2009-06-08 19:57:35 +00:00
ng_gif.h
ng_hole.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_hole.h
ng_hub.c
ng_hub.h
ng_iface.c Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_iface.h Check for infinite recursion possible on some broken PPTP/L2TP/... VPN setups. 2009-01-20 22:26:09 +00:00
ng_ip_input.c Introduce a mechanism for detecting calls from outbound path of the 2009-06-11 16:50:49 +00:00
ng_ip_input.h
ng_ipfw.c Close long existed race with net.inet.ip.fw.one_pass = 0: 2009-06-09 21:27:11 +00:00
ng_ipfw.h Close long existed race with net.inet.ip.fw.one_pass = 0: 2009-06-09 21:27:11 +00:00
ng_ksocket.c Rework socket upcalls to close some races with setup/teardown of upcalls. 2009-06-01 21:17:03 +00:00
ng_ksocket.h
ng_l2tp.c Add memmove() to the kernel, making the kernel compile with Clang. 2009-02-28 16:21:25 +00:00
ng_l2tp.h
ng_lmi.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_lmi.h
ng_message.h World now builds without these defines, so eliminate them. 2009-06-09 07:07:20 +00:00
ng_mppc.c If source mbuf chain consists of only one mbuf, use it directly as source 2009-01-18 21:09:34 +00:00
ng_mppc.h
ng_nat.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_nat.h Fix incorrect field name. 2008-03-04 11:10:54 +00:00
ng_one2many.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_one2many.h
ng_parse.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_parse.h
ng_pipe.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_pipe.h Add Marko's pipe node. 2008-09-03 18:17:45 +00:00
ng_ppp.c Remove strict limitation on minimal multilink MRRU. RFC claims that MRRU 2009-01-18 12:03:43 +00:00
ng_ppp.h Add 64bit statistic counters to the ng_ppp node. 2007-08-01 20:49:35 +00:00
ng_pppoe.c Make Netgraph compile with Clang. 2009-03-03 18:47:33 +00:00
ng_pppoe.h Make Netgraph compile with Clang. 2009-03-03 18:47:33 +00:00
ng_pptpgre.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_pptpgre.h Rewrite node to support multiple hooks, alike to ng_l2tp, to use one pair 2008-03-24 22:55:22 +00:00
ng_pred1.c Use m_unshare()+m_copyback() instead of m_freem()+m_devget() to keep 2009-01-18 19:25:36 +00:00
ng_pred1.h A node that implements Predictor-1 compression for PPP. 2006-12-29 09:54:32 +00:00
ng_rfc1490.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_rfc1490.h
ng_sample.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_sample.h
ng_socket.c Remove unused variable. 2008-11-22 16:55:55 +00:00
ng_socket.h
ng_socketvar.h
ng_source.c Fix error message content. 2008-09-21 07:33:33 +00:00
ng_source.h Add "setcounter" and "getcounter" messages, providing the the ability 2007-03-02 01:44:04 +00:00
ng_split.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_split.h
ng_sppp.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_sppp.h
ng_tag.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_tag.h
ng_tcpmss.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_tcpmss.h
ng_tee.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_tee.h
ng_tty.c Remove node shutdown on tty close. This could be easily done by user-level 2008-12-13 22:05:46 +00:00
ng_tty.h Assign new cookie to the node to reflect API change. 2008-11-08 02:05:41 +00:00
ng_UI.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_UI.h
ng_vjc.c Mark ng_vjc node as FORCE_WRITER to protect slcompress state. 2009-01-08 17:51:15 +00:00
ng_vjc.h
ng_vlan.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_vlan.h
NOTES