freebsd-skq/sys/netgraph
Bjoern A. Zeeb 89856f7e2d Get closer to a VIMAGE network stack teardown from top to bottom rather
than removing the network interfaces first. This change is rather larger
and convoluted as the ordering requirements cannot be separated.

Move the pfil(9) framework to SI_SUB_PROTO_PFIL, move Firewalls and
related modules to their own SI_SUB_PROTO_FIREWALL.
Move initialization of "physical" interfaces to SI_SUB_DRIVERS,
move virtual (cloned) interfaces to SI_SUB_PSEUDO.
Move Multicast to SI_SUB_PROTO_MC.

Re-work parts of multicast initialisation and teardown, not taking the
huge amount of memory into account if used as a module yet.

For interface teardown we try to do as many of them as we can on
SI_SUB_INIT_IF, but for some this makes no sense, e.g., when tunnelling
over a higher layer protocol such as IP. In that case the interface
has to go along (or before) the higher layer protocol is shutdown.

Kernel hhooks need to go last on teardown as they may be used at various
higher layers and we cannot remove them before we cleaned up the higher
layers.

For interface teardown there are multiple paths:
(a) a cloned interface is destroyed (inside a VIMAGE or in the base system),
(b) any interface is moved from a virtual network stack to a different
network stack ("vmove"), or (c) a virtual network stack is being shut down.
All code paths go through if_detach_internal() where we, depending on the
vmove flag or the vnet state, make a decision on how much to shut down;
in case we are destroying a VNET the individual protocol layers will
cleanup their own parts thus we cannot do so again for each interface as
we end up with, e.g., double-frees, destroying locks twice or acquiring
already destroyed locks.
When calling into protocol cleanups we equally have to tell them
whether they need to detach upper layer protocols ("ulp") or not
(e.g., in6_ifdetach()).

Provide or enahnce helper functions to do proper cleanup at a protocol
rather than at an interface level.

Approved by:		re (hrs)
Obtained from:		projects/vnet
Reviewed by:		gnn, jhb
Sponsored by:		The FreeBSD Foundation
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D6747
2016-06-21 13:48:49 +00:00
..
atm sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
bluetooth Disconnect LE socket when the HCI connection associated is disconnected. 2016-06-07 16:57:13 +00:00
netflow Fix style(9). 2016-05-26 19:17:51 +00:00
netgraph.h sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_async.c
ng_async.h
ng_atmllc.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_atmllc.h
ng_base.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_bpf.c
ng_bpf.h
ng_bridge.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_bridge.h
ng_car.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_car.h sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_cisco.c Remove AppleTalk support. 2014-03-14 06:29:43 +00:00
ng_cisco.h
ng_deflate.c Move zlib.c from net to libkern. 2015-04-22 14:38:58 +00:00
ng_deflate.h
ng_device.c Remove ifq_drops from struct ifqueue. Now queue drops are accounted in 2014-09-19 09:01:19 +00:00
ng_device.h
ng_echo.c
ng_echo.h
ng_eiface.c Get closer to a VIMAGE network stack teardown from top to bottom rather 2016-06-21 13:48:49 +00:00
ng_eiface.h
ng_etf.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_etf.h
ng_ether_echo.c
ng_ether_echo.h
ng_ether.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_ether.h
ng_frame_relay.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_frame_relay.h
ng_gif_demux.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_gif_demux.h
ng_gif.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_gif.h
ng_hole.c
ng_hole.h
ng_hub.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_hub.h
ng_iface.c Get closer to a VIMAGE network stack teardown from top to bottom rather 2016-06-21 13:48:49 +00:00
ng_iface.h Remove AppleTalk support. 2014-03-14 06:29:43 +00:00
ng_ip_input.c
ng_ip_input.h
ng_ipfw.c Cleanup unnecessary semicolons from the kernel. 2016-04-10 23:07:00 +00:00
ng_ipfw.h
ng_ksocket.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_ksocket.h
ng_l2tp.c Fix circular math macro. 2014-01-03 12:06:54 +00:00
ng_l2tp.h sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_lmi.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_lmi.h
ng_message.h
ng_mppc.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
ng_mppc.h
ng_nat.c Cleanup unnecessary semicolons from the kernel. 2016-04-10 23:07:00 +00:00
ng_nat.h Add NGM_NAT_LIBALIAS_INFO command, that reports internal stats 2013-03-21 08:36:15 +00:00
ng_one2many.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_one2many.h
ng_parse.c Fix a bunch of -Wcast-qual warnings in netgraph's ng_parse.c, by using 2015-01-30 21:59:53 +00:00
ng_parse.h
ng_patch.c
ng_patch.h
ng_pipe.c Use M_WAITOK for the NGM_PIPE_SET_CFG control message. We expect it to 2014-05-28 13:15:14 +00:00
ng_pipe.h
ng_ppp.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_ppp.h
ng_pppoe.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_pppoe.h Add support for PPP-Max-Payload PPPoE tag (RFC4638). 2015-09-11 09:15:27 +00:00
ng_pptpgre.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_pptpgre.h
ng_pred1.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_pred1.h
ng_rfc1490.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_rfc1490.h
ng_sample.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_sample.h
ng_socket.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
ng_socket.h
ng_socketvar.h
ng_source.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_source.h
ng_split.c
ng_split.h sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_sppp.c Mechanically convert to if_inc_counter(). 2014-09-19 05:03:11 +00:00
ng_sppp.h
ng_tag.c
ng_tag.h
ng_tcpmss.c
ng_tcpmss.h
ng_tee.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_tee.h
ng_tty.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_tty.h
ng_UI.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
ng_UI.h
ng_vjc.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_vjc.h
ng_vlan.c sys/netgraph: spelling fixes in comments. 2016-04-29 21:25:05 +00:00
ng_vlan.h
NOTES