git: 3d0d5b21c9b2 - main - IfAPI: Explicitly include <net/if_private.h> in netstack

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Tue, 31 Jan 2023 20:03:16 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=3d0d5b21c9b2cfd7e48209340a090f63ca4bce03

commit 3d0d5b21c9b2cfd7e48209340a090f63ca4bce03
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2023-01-23 15:05:29 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-01-31 20:02:16 +0000

    IfAPI: Explicitly include <net/if_private.h> in netstack
    
    Summary:
    In preparation of making if_t completely opaque outside of the netstack,
    explicitly include the header.  <net/if_var.h> will stop including the
    header in the future.
    
    Sponsored by:   Juniper Networks, Inc.
    Reviewed by:    glebius, melifaro
    Differential Revision: https://reviews.freebsd.org/D38200
---
 sys/net/ifdi_if.m                        | 1 +
 sys/net/ifq.c                            | 1 +
 sys/net80211/ieee80211.c                 | 1 +
 sys/net80211/ieee80211_adhoc.c           | 1 +
 sys/net80211/ieee80211_ddb.c             | 6 +++---
 sys/net80211/ieee80211_freebsd.c         | 1 +
 sys/net80211/ieee80211_hostap.c          | 1 +
 sys/net80211/ieee80211_input.c           | 1 +
 sys/net80211/ieee80211_ioctl.c           | 1 +
 sys/net80211/ieee80211_mesh.c            | 1 +
 sys/net80211/ieee80211_output.c          | 1 +
 sys/net80211/ieee80211_proto.c           | 1 +
 sys/net80211/ieee80211_scan.c            | 1 +
 sys/net80211/ieee80211_scan_sw.c         | 1 +
 sys/net80211/ieee80211_sta.c             | 1 +
 sys/net80211/ieee80211_wds.c             | 1 +
 sys/netgraph/netflow/netflow.c           | 1 +
 sys/netgraph/netflow/ng_netflow.c        | 1 +
 sys/netgraph/ng_eiface.c                 | 1 +
 sys/netgraph/ng_ether.c                  | 1 +
 sys/netgraph/ng_gif.c                    | 1 +
 sys/netgraph/ng_iface.c                  | 1 +
 sys/netgraph/ng_source.c                 | 1 +
 sys/netinet/if_ether.c                   | 1 +
 sys/netinet/igmp.c                       | 1 +
 sys/netinet/in.c                         | 1 +
 sys/netinet/in_fib.c                     | 1 +
 sys/netinet/in_gif.c                     | 1 +
 sys/netinet/in_mcast.c                   | 1 +
 sys/netinet/in_pcb.c                     | 1 +
 sys/netinet/in_rmx.c                     | 1 +
 sys/netinet/ip_carp.c                    | 1 +
 sys/netinet/ip_divert.c                  | 1 +
 sys/netinet/ip_fastfwd.c                 | 1 +
 sys/netinet/ip_gre.c                     | 1 +
 sys/netinet/ip_icmp.c                    | 1 +
 sys/netinet/ip_input.c                   | 1 +
 sys/netinet/ip_mroute.c                  | 1 +
 sys/netinet/ip_output.c                  | 1 +
 sys/netinet/ip_reass.c                   | 1 +
 sys/netinet/netdump/netdump_client.c     | 1 +
 sys/netinet/sctp_os_bsd.h                | 1 +
 sys/netinet/tcp_lro.c                    | 1 +
 sys/netinet/tcp_offload.c                | 1 +
 sys/netinet/tcp_ratelimit.c              | 1 +
 sys/netinet/tcp_stacks/rack_bbr_common.c | 1 +
 sys/netinet/tcp_subr.c                   | 1 +
 sys/netinet/toecore.c                    | 1 +
 sys/netinet6/frag6.c                     | 1 +
 sys/netinet6/icmp6.c                     | 1 +
 sys/netinet6/in6.c                       | 1 +
 sys/netinet6/in6_fib.c                   | 1 +
 sys/netinet6/in6_gif.c                   | 1 +
 sys/netinet6/in6_ifattach.c              | 1 +
 sys/netinet6/in6_mcast.c                 | 1 +
 sys/netinet6/in6_rmx.c                   | 1 +
 sys/netinet6/in6_src.c                   | 1 +
 sys/netinet6/ip6_fastfwd.c               | 1 +
 sys/netinet6/ip6_forward.c               | 1 +
 sys/netinet6/ip6_gre.c                   | 1 +
 sys/netinet6/ip6_mroute.c                | 1 +
 sys/netinet6/ip6_output.c                | 1 +
 sys/netinet6/mld6.c                      | 1 +
 sys/netinet6/nd6.c                       | 1 +
 sys/netinet6/nd6.h                       | 2 +-
 sys/netinet6/nd6_nbr.c                   | 1 +
 sys/netinet6/nd6_rtr.c                   | 1 +
 sys/netinet6/raw_ip6.c                   | 1 +
 sys/netinet6/scope6.c                    | 1 +
 sys/netinet6/send.c                      | 1 +
 sys/netipsec/ipsec_input.c               | 1 +
 sys/netpfil/ipfilter/netinet/ip_compat.h | 1 +
 sys/netpfil/ipfilter/netinet/ip_log.c    | 1 +
 sys/netpfil/ipfw/ip_dn_io.c              | 1 +
 sys/netpfil/ipfw/ip_fw2.c                | 1 +
 sys/netpfil/ipfw/ip_fw_bpf.c             | 1 +
 sys/netpfil/ipfw/ip_fw_iface.c           | 1 +
 sys/netpfil/ipfw/ip_fw_log.c             | 1 +
 sys/netpfil/ipfw/ip_fw_nat.c             | 1 +
 sys/netpfil/ipfw/nat64/nat64_translate.c | 1 +
 sys/netpfil/ipfw/nptv6/nptv6.c           | 1 +
 sys/netpfil/pf/if_pflog.c                | 1 +
 sys/netpfil/pf/if_pfsync.c               | 1 +
 sys/netpfil/pf/pf.c                      | 1 +
 sys/netpfil/pf/pf_if.c                   | 1 +
 sys/netpfil/pf/pf_ioctl.c                | 1 +
 86 files changed, 88 insertions(+), 4 deletions(-)

diff --git a/sys/net/ifdi_if.m b/sys/net/ifdi_if.m
index 077b19dd7481..3a17f24fdf91 100644
--- a/sys/net/ifdi_if.m
+++ b/sys/net/ifdi_if.m
@@ -41,6 +41,7 @@
 #include <net/iflib.h>
 #include <net/if_clone.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 
 INTERFACE ifdi;
diff --git a/sys/net/ifq.c b/sys/net/ifq.c
index 0e3159a75d48..c09d962e206a 100644
--- a/sys/net/ifq.c
+++ b/sys/net/ifq.c
@@ -40,6 +40,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/ifq.h>
 
 int
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 1034088c6fb6..fbf3e1ca01c8 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/ethernet.h>
 
diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c
index f591015ab3e0..4789bdd65aa1 100644
--- a/sys/net80211/ieee80211_adhoc.c
+++ b/sys/net80211/ieee80211_adhoc.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_llc.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net/bpf.h>
diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c
index af4f8ea74799..b0e037d492fd 100644
--- a/sys/net80211/ieee80211_ddb.c
+++ b/sys/net80211/ieee80211_ddb.c
@@ -364,7 +364,7 @@ _db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs)
 		db_printf("(%p)", vap->iv_mesh);
 #endif
 	db_printf(" state %s", ieee80211_state_name[vap->iv_state]);
-	db_printf(" ifp %p(%s)", vap->iv_ifp, vap->iv_ifp->if_xname);
+	db_printf(" ifp %p(%s)", vap->iv_ifp, if_name(vap->iv_ifp));
 	db_printf("\n");
 
 	db_printf("\tic %p", vap->iv_ic);
@@ -540,7 +540,7 @@ _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta,
 
 	db_printf("COM: %p:", ic);
 	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
-		db_printf(" %s(%p)", vap->iv_ifp->if_xname, vap);
+		db_printf(" %s(%p)", if_name(vap->iv_ifp), vap);
 	db_printf("\n");
 	db_printf("\tsoftc %p", ic->ic_softc);
 	db_printf("\tname %s", ic->ic_name);
@@ -706,7 +706,7 @@ _db_show_all_vaps(void *arg, struct ieee80211com *ic)
 		const struct ieee80211vap *vap;
 		db_printf("%s: com %p vaps:", ic->ic_name, ic);
 		TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
-			db_printf(" %s(%p)", vap->iv_ifp->if_xname, vap);
+			db_printf(" %s(%p)", if_name(vap->iv_ifp), vap);
 		db_printf("\n");
 	} else
 		_db_show_com(ic, 1, 1, 1, 1);
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c
index 7158ada291ab..93b01af1d222 100644
--- a/sys/net80211/ieee80211_freebsd.c
+++ b/sys/net80211/ieee80211_freebsd.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_dl.h>
 #include <net/if_clone.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/ethernet.h>
 #include <net/route.h>
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c
index 6c3bb44053f5..12b34b2e0509 100644
--- a/sys/net80211/ieee80211_hostap.c
+++ b/sys/net80211/ieee80211_hostap.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_llc.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net/bpf.h>
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index b7d9c6f9457e..78483a3ad2e1 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_llc.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 
 #include <net80211/ieee80211_var.h>
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 839f965f542f..0fbbb74e1e65 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #ifdef INET
diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c
index f4f0d79b3ac3..100a0a385f84 100644
--- a/sys/net80211/ieee80211_mesh.c
+++ b/sys/net80211/ieee80211_mesh.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_llc.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net80211/ieee80211_var.h>
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index 07cc8ed1c3ed..bf3e48761684 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_llc.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 
 #include <net80211/ieee80211_var.h>
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 7e76a3ae9226..ec94f2cf7275 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>		/* XXX for ether_sprintf */
 
 #include <net80211/ieee80211_var.h>
diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c
index 50b3151063fa..fd387e68e39f 100644
--- a/sys/net80211/ieee80211_scan.c
+++ b/sys/net80211/ieee80211_scan.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net80211/ieee80211_var.h>
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
index 4c184095ad35..1456fafd60a1 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net80211/ieee80211_var.h>
diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
index 719df1bcfacc..7dde2a609459 100644
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_llc.h>
 #include <net/if_dl.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net/bpf.h>
diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c
index 238b10a6e4ff..65a36a807d91 100644
--- a/sys/net80211/ieee80211_wds.c
+++ b/sys/net80211/ieee80211_wds.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_llc.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 
 #include <net/bpf.h>
diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c
index 9c58674779ae..00fb0d9f68a7 100644
--- a/sys/netgraph/netflow/netflow.c
+++ b/sys/netgraph/netflow/netflow.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c
index ab0aff5cf7fc..fbb232b327d8 100644
--- a/sys/netgraph/netflow/ng_netflow.c
+++ b/sys/netgraph/netflow/ng_netflow.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <net/route.h>
 #include <net/if_arp.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 #include <net/bpf.h>
 #include <netinet/in.h>
diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c
index 5b12ecc70c11..1f4699d71fcb 100644
--- a/sys/netgraph/ng_eiface.c
+++ b/sys/netgraph/ng_eiface.c
@@ -46,6 +46,7 @@
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
 #include <net/route.h>
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 40e06604b8bb..b3f1e8762b3d 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -63,6 +63,7 @@
 #include <net/if_types.h>
 #include <net/if_arp.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/ethernet.h>
 #include <net/if_bridgevar.h>
 #include <net/vnet.h>
diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c
index d4cb8922d1d6..aa2e57384b1e 100644
--- a/sys/netgraph/ng_gif.c
+++ b/sys/netgraph/ng_gif.c
@@ -84,6 +84,7 @@
 #include <net/if_types.h>
 #include <net/if_var.h>
 #include <net/if_gif.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 
 #include <netgraph/ng_message.h>
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c
index e6871435fa88..2ba7a788633f 100644
--- a/sys/netgraph/ng_iface.c
+++ b/sys/netgraph/ng_iface.c
@@ -74,6 +74,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/bpf.h>
 #include <net/netisr.h>
diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c
index 0eee9ceb25c5..c04f477cd7f2 100644
--- a/sys/netgraph/ng_source.c
+++ b/sys/netgraph/ng_source.c
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/syslog.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netgraph/ng_message.h>
 #include <netgraph/netgraph.h>
 #include <netgraph/ng_parse.h>
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 1c6c35f180aa..711f2ce153a8 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
 #include <net/ethernet.h>
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index cebde1798c6d..394ee81d6941 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/vnet.h>
 
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index b6b412042dad..a17e3cac8744 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_arp.h>
 #include <net/if_dl.h>
 #include <net/if_llatbl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
diff --git a/sys/netinet/in_fib.c b/sys/netinet/in_fib.c
index 6f0e95bcf117..d84997deb29b 100644
--- a/sys/netinet/in_fib.c
+++ b/sys/netinet/in_fib.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
 #include <net/route/route_var.h>
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index 6290de6cb31e..e43b4c645372 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/vnet.h>
 
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index b2bfce038088..bbedbf8ceaa3 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/in_fib.h>
 #include <netinet/in_pcb.h>
 #include <netinet/in_var.h>
+#include <net/if_private.h>
 #include <netinet/ip_var.h>
 #include <netinet/igmp_var.h>
 
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index e7f425f8593a..0a99981d059b 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/if_llatbl.h>
 #include <net/route.h>
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c
index 623e788eec91..8c3974e15ba3 100644
--- a/sys/netinet/in_rmx.c
+++ b/sys/netinet/in_rmx.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
 #include <net/route/route_var.h>
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 3846576b4482..22b256238774 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_dl.h>
 #include <net/if_llatbl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/vnet.h>
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index dd76a1792325..e570418ebc8e 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 
 #include <netinet/in.h>
diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c
index ee97cb4af65a..121db3ddee3a 100644
--- a/sys/netinet/ip_fastfwd.c
+++ b/sys/netinet/ip_fastfwd.c
@@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_types.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/pfil.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c
index 12c13cbce2e7..f4be4252a822 100644
--- a/sys/netinet/ip_gre.c
+++ b/sys/netinet/ip_gre.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 
 #include <netinet/in.h>
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index c108a8f3ab05..98f290486ec5 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index b33d1e1b6697..b8fb3861c5b8 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_types.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/pfil.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 383f2dfc076e..6cabef8a1b16 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
 #include <net/route.h>
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 375db580296e..739138a6f791 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 #include <net/if_llatbl.h>
 #include <net/ethernet.h>
diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c
index 06cdbca2961c..5209dfb0d1cb 100644
--- a/sys/netinet/ip_reass.c
+++ b/sys/netinet/ip_reass.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/rss_config.h>
 #include <net/netisr.h>
 #include <net/vnet.h>
diff --git a/sys/netinet/netdump/netdump_client.c b/sys/netinet/netdump/netdump_client.c
index 95795c73f8d6..c2f10ba52253 100644
--- a/sys/netinet/netdump/netdump_client.c
+++ b/sys/netinet/netdump/netdump_client.c
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/debugnet.h>
 
 #include <netinet/in.h>
diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h
index d9b5c140f14c..80c187b3c5ef 100644
--- a/sys/netinet/sctp_os_bsd.h
+++ b/sys/netinet/sctp_os_bsd.h
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
 #include <net/vnet.h>
diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 268be18edb37..f44d1a0848c3 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <net/vnet.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/infiniband.h>
 #include <net/if_lagg.h>
diff --git a/sys/netinet/tcp_offload.c b/sys/netinet/tcp_offload.c
index b93d6027a01e..102a4935631c 100644
--- a/sys/netinet/tcp_offload.c
+++ b/sys/netinet/tcp_offload.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/sockopt.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
 #include <netinet/in.h>
diff --git a/sys/netinet/tcp_ratelimit.c b/sys/netinet/tcp_ratelimit.c
index ca619e66c07d..82aea5bdf0de 100644
--- a/sys/netinet/tcp_ratelimit.c
+++ b/sys/netinet/tcp_ratelimit.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/ck.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netinet/in.h>
 #include <netinet/in_pcb.h>
 #define TCPSTATES		/* for logging */
diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c
index d684132f80c3..83b3d74b8dcc 100644
--- a/sys/netinet/tcp_stacks/rack_bbr_common.c
+++ b/sys/netinet/tcp_stacks/rack_bbr_common.c
@@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$");
 #include <netipsec/ipsec_support.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 
 #if defined(IPSEC) || defined(IPSEC_SUPPORT)
 #include <netipsec/ipsec.h>
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 99fcd1f90a8a..01fd5eed34c8 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
 #include <net/route/nhop.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 
 #include <netinet/in.h>
diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c
index 39423a425b36..c6af4a00c6c3 100644
--- a/sys/netinet/toecore.c
+++ b/sys/netinet/toecore.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
 #include <net/if_llatbl.h>
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 9f12d4d691b6..d634f869acd5 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/route.h>
 #include <net/vnet.h>
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 2cd54abbb76e..5c94a0c56be1 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_var.h>
 #include <net/if_dl.h>
 #include <net/if_llatbl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 0a00ea6b8be4..27dc3550177c 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/netinet6/in6_fib.c b/sys/netinet6/in6_fib.c
index 8a0760aff02a..34aff5feda8e 100644
--- a/sys/netinet6/in6_fib.c
+++ b/sys/netinet6/in6_fib.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
 #include <net/route/route_var.h>
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index 54cb81c6130f..04f136b6bed5 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/vnet.h>
 
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 629509f61ac1..b0b2e4e95985 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/vnet.h>
diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 04c4f1aa9d93..4a141d984715 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
 #include <net/vnet.h>
diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 5cd401611db9..7a1ca781d712 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
 #include <net/route/route_var.h>
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 7188282013cc..373f80b7ac19 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
 #include <net/if_llatbl.h>
diff --git a/sys/netinet6/ip6_fastfwd.c b/sys/netinet6/ip6_fastfwd.c
index e1c30629643e..7ecd08a4e450 100644
--- a/sys/netinet6/ip6_fastfwd.c
+++ b/sys/netinet6/ip6_fastfwd.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
 #include <net/pfil.h>
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index 39c93ac35427..a95e58ba09a1 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
diff --git a/sys/netinet6/ip6_gre.c b/sys/netinet6/ip6_gre.c
index 2bae6d754a03..8c9f7f5f668c 100644
--- a/sys/netinet6/ip6_gre.c
+++ b/sys/netinet6/ip6_gre.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 
 #include <netinet/in.h>
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 9465c6662018..e690cb64894f 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -108,6 +108,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/vnet.h>
 
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index ebb7f7bc6ed1..bce5ed846227 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 #include <net/if_llatbl.h>
 #include <net/ethernet.h>
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index f20348f653ef..63f4e33ac64d 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/vnet.h>
 
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index de35127bd17d..082266c84294 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index d653a432dbe4..76e91905bf5e 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -99,7 +99,7 @@ struct nd_ifinfo {
 
 #ifdef _KERNEL
 #define ND_IFINFO(ifp) \
-	(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)
+	(((struct in6_ifextra *)if_getafdata(ifp, AF_INET6))->nd_ifinfo)
 #define IN6_LINKMTU(ifp) \
 	((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
 	    ? ND_IFINFO(ifp)->linkmtu \
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index cd7119c9ccbc..a4fb5f75fa93 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_types.h>
 #include <net/if_dl.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/vnet.h>
 
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 793befc47aa5..dbdf12d310c6 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/if_dl.h>
 #include <net/route.h>
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 0ae5bbcc9218..9cfbbaedf51c 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/vnet.h>
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
index 7957cec44f79..c4eb9a4ab829 100644
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 
 #include <netinet/in.h>
diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c
index 0684e2eea22c..6d3496f5b1af 100644
--- a/sys/netinet6/send.c
+++ b/sys/netinet6/send.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <net/route.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 
 #include <netinet/in.h>
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
index 9feb0df8bd15..7abf74426853 100644
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_enc.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/vnet.h>
 
diff --git a/sys/netpfil/ipfilter/netinet/ip_compat.h b/sys/netpfil/ipfilter/netinet/ip_compat.h
index 170326dc33f1..8266f22a63a3 100644
--- a/sys/netpfil/ipfilter/netinet/ip_compat.h
+++ b/sys/netpfil/ipfilter/netinet/ip_compat.h
@@ -135,6 +135,7 @@
 						rw_runlock(&(x)->ipf_lk); \
*** 174 LINES SKIPPED ***