Merge "BpfNetMaps: auto populate interface tracker" into main
diff --git a/service/src/com/android/server/BpfNetMaps.java b/service/src/com/android/server/BpfNetMaps.java
index 923920f..9bd407d 100644
--- a/service/src/com/android/server/BpfNetMaps.java
+++ b/service/src/com/android/server/BpfNetMaps.java
@@ -915,10 +915,13 @@
final InetAddress address, final int protocol, final int remotePort,
final boolean isAllowed) {
throwIfPre25Q2("addLocalNetAccess is not available on pre-B devices");
- final int ifIndex;
if (iface == null) {
- ifIndex = 0;
- } else {
+ Log.e(TAG, "Null iface, skip addLocalNetAccess for " + address);
+ return;
+ }
+ int ifIndex = mInterfaceTracker.getInterfaceIndex(iface);
+ if (ifIndex == 0) {
+ mInterfaceTracker.addInterface(iface);
ifIndex = mInterfaceTracker.getInterfaceIndex(iface);
}
if (ifIndex == 0) {