kernel - Fix ifnet scan race in ipv6
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 26 Sep 2013 17:16:04 +0000 (10:16 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 26 Sep 2013 17:26:25 +0000 (10:26 -0700)
commit8e13abe7b6ff0052c108f98a88b0a1f7d7dc5a07
treef8158974fa569789b2c86c6e1016d2584ef8f41d
parent6472f245a4e213c87bd8e43b02f7df9e455af789
kernel - Fix ifnet scan race in ipv6

* Fix situations where an ifnet scan can catch an interface as it is still
  being initialized, before ifp->if_afdata[AF_INET6] is assigned.

* Add a global ifnet_token to protect if_index and the ifnet list.

  WARNING, there are still SMP races in the ifnet scans, they have
  not yet been instrumented with the new token.

* Also reorder the TAILQ_INSERT of a new if into the ifnet list to occur
  after all the domain initialization has been done rather than before.
sys/kern/lwkt_token.c
sys/net/if.c
sys/netinet6/in6.c
sys/netinet6/in6_ifattach.c
sys/netinet6/in6_var.h
sys/netinet6/nd6.c
sys/netinet6/scope6.c
sys/sys/thread.h