+ /*
+ * Call IP filter on last header only
+ */
+ if ((ip6_protox[nxt]->pr_flags & PR_LASTHDR) != 0 && !TAILQ_EMPTY(&ipv6_filters)) {
+ ipf_ref();
+ TAILQ_FOREACH(filter, &ipv6_filters, ipf_link) {
+ if (seen == 0) {
+ if ((struct ipfilter *)inject_ipfref == filter)
+ seen = 1;
+ } else if (filter->ipf_filter.ipf_input) {
+ errno_t result;
+
+ result = filter->ipf_filter.ipf_input(
+ filter->ipf_filter.cookie, (mbuf_t*)&m, off, nxt);
+ if (result == EJUSTRETURN) {
+ ipf_unref();
+ return;
+ }
+ if (result != 0) {
+ ipf_unref();
+ m_freem(m);
+ return;
+ }
+ }
+ }
+ ipf_unref();
+ }
+ if (!(ip6_protox[nxt]->pr_flags & PR_PROTOLOCK)) {
+ lck_mtx_lock(inet6_domain_mutex);
+ nxt = (*ip6_protox[nxt]->pr_input)(&m, &off);
+ lck_mtx_unlock(inet6_domain_mutex);
+ }
+ else
+ nxt = (*ip6_protox[nxt]->pr_input)(&m, &off);