Revert "Fix + install guest/libs/wpa_supplicant_8_lib"
Revert submission 1675032
Reason for revert: Build break on goldfish
Reverted Changes:
I9362c0eba:Revert "Remove wpa_supplicant_8_lib"
Iea2108d93:Fix + install guest/libs/wpa_supplicant_8_lib
Bug: 137088260
Change-Id: Id652a1251bad5bf21d34352faaa5392f917a1f26
diff --git a/Android.mk b/Android.mk
index 59e9806..6b5ab61 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,8 +21,3 @@
include $(LOCAL_PATH)/host_package.mk
endif
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/guest/Android.mk b/guest/Android.mk
deleted file mode 100644
index 428f4b5..0000000
--- a/guest/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2021 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/guest/libs/Android.mk b/guest/libs/Android.mk
deleted file mode 100644
index 428f4b5..0000000
--- a/guest/libs/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2021 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c
index 0627261..a2180aa 100644
--- a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c
+++ b/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c
@@ -23,10 +23,21 @@
#include <stdio.h>
#include <stdlib.h>
+#if VSOC_PLATFORM_SDK_AFTER(L_MR1)
+// Android M exposes headers more directly.
#include <netinet/in.h>
#include <linux/if.h>
#include <linux/if_ether.h>
#include "driver_nl80211.h"
+#elif VSOC_PLATFORM_SDK_AFTER(J_MR2)
+// Android versions K and L put structures in hardware_legacy
+#include "hardware_legacy/driver_nl80211.h"
+#else
+// Android version J does not expose structures directly. These structures are
+// manually defined later.
+#include <netinet/in.h>
+#include <linux/if.h>
+#endif
#include "common.h"
#include "wpa_supplicant_i.h"
diff --git a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h b/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h
index 9484778..4256664 100644
--- a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h
+++ b/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <linux/if_ether.h>
+#include <guest/libs/platform_support/api_level_fixes.h>
+
#include <memory.h>
-#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -24,6 +24,7 @@
#include "common.h"
#include "linux_ioctl.h"
#include "wpa_supplicant_i.h"
+#include <linux/if_ether.h>
#define VSOC_WPA_SUPPLICANT_DEBUG 0
@@ -39,3 +40,65 @@
int used_len;
int total_len;
} android_wifi_priv_cmd;
+
+#if VSOC_PLATFORM_SDK_BEFORE(K)
+
+#include "driver.h"
+
+struct i802_bss {
+ struct wpa_driver_nl80211_data* drv;
+ struct i802_bss* next;
+ int ifindex;
+ char ifname[IFNAMSIZ + 1];
+ char brname[IFNAMSIZ];
+
+ unsigned int beacon_set:1;
+ unsigned int added_if_into_bridge:1;
+ unsigned int added_bridge:1;
+ unsigned int in_deinit:1;
+
+ u8 addr[ETH_ALEN];
+
+ int freq;
+
+ void* ctx;
+ struct nl_handle* nl_preq;
+ struct nl_handle* nl_mgmt;
+ struct nl_cb* nl_cb;
+
+ struct nl80211_wiphy_data *wiphy_data;
+ struct dl_list wiphy_list;
+};
+
+struct nl80211_global {
+ struct dl_list interfaces;
+ int if_add_ifindex;
+ struct netlink_data *netlink;
+ struct nl_cb* nl_cb;
+ struct nl_handle* nl;
+ int nl80211_id;
+ int ioctl_sock; // socket for ioctl() use
+
+ struct nl_handle* nl_event;
+};
+
+struct wpa_driver_nl80211_data {
+ struct nl80211_global* global;
+ struct dl_list list;
+ struct dl_list wiphy_list;
+ char phyname[32];
+ void* ctx;
+ int ifindex;
+ int if_removed;
+ int if_disabled;
+ int ignore_if_down_event;
+ struct rfkill_data* rfkill;
+ struct wpa_driver_capa capa;
+ u8* extended_capa;
+ u8* extended_capa_mask;
+ unsigned int extended_capa_len;
+ int has_capability;
+ // More internal data follows.
+};
+
+#endif // VSOC_PLATFORM_SDK_AFTER(J)
diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk
index fd259ca..7820cac 100644
--- a/shared/BoardConfig.mk
+++ b/shared/BoardConfig.mk
@@ -147,8 +147,6 @@
BOARD_WLAN_DEVICE := wlan0
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
-# Defined in device/generic/goldfish/wifi/wpa_supplicant_8_lib/Android.mk
-BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
WPA_SUPPLICANT_VERSION := VER_0_8_X
WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
WIFI_DRIVER_FW_PATH_STA := "/dev/null"