mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-03 08:54:55 +00:00
Merge "Fix NAN validate interface existence" into rvc-dev am: 8fce7985c0
Change-Id: I9c85385771a46c3040c35c4fc6565a9ec0b60466
This commit is contained in:
@@ -41,6 +41,7 @@ class MockWifiIfaceUtil : public WifiIfaceUtil {
|
||||
void(const std::string&, IfaceEventHandlers));
|
||||
MOCK_METHOD1(unregisterIfaceEventHandlers, void(const std::string&));
|
||||
MOCK_METHOD2(setUpState, bool(const std::string&, bool));
|
||||
MOCK_METHOD1(ifNameToIndex, unsigned(const std::string&));
|
||||
};
|
||||
} // namespace iface_util
|
||||
} // namespace implementation
|
||||
|
||||
@@ -787,6 +787,8 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithDedicatedNanIface) {
|
||||
property_set("wifi.aware.interface", "aware0");
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
|
||||
EXPECT_CALL(*iface_util_, ifNameToIndex("aware0"))
|
||||
.WillOnce(testing::Return(4));
|
||||
EXPECT_CALL(*iface_util_, setUpState("aware0", true))
|
||||
.WillOnce(testing::Return(true));
|
||||
ASSERT_EQ(createIface(IfaceType::NAN), "aware0");
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
@@ -886,7 +885,7 @@ std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() {
|
||||
}
|
||||
bool is_dedicated_iface = true;
|
||||
std::string ifname = getNanIfaceName();
|
||||
if (ifname.empty() || if_nametoindex(ifname.c_str())) {
|
||||
if (ifname.empty() || !iface_util_.lock()->ifNameToIndex(ifname)) {
|
||||
// Use the first shared STA iface (wlan0) if a dedicated aware iface is
|
||||
// not defined.
|
||||
ifname = getFirstActiveWlanIfaceName();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <net/if.h>
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
@@ -122,6 +123,10 @@ bool WifiIfaceUtil::setUpState(const std::string& iface_name, bool request_up) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned WifiIfaceUtil::ifNameToIndex(const std::string& iface_name) {
|
||||
return if_nametoindex(iface_name.c_str());
|
||||
}
|
||||
} // namespace iface_util
|
||||
} // namespace implementation
|
||||
} // namespace V1_4
|
||||
|
||||
@@ -57,6 +57,7 @@ class WifiIfaceUtil {
|
||||
IfaceEventHandlers handlers);
|
||||
virtual void unregisterIfaceEventHandlers(const std::string& iface_name);
|
||||
virtual bool setUpState(const std::string& iface_name, bool request_up);
|
||||
virtual unsigned ifNameToIndex(const std::string& iface_name);
|
||||
|
||||
private:
|
||||
std::array<uint8_t, 6> createRandomMacAddress();
|
||||
|
||||
Reference in New Issue
Block a user