Remove legacy WiFi
BUG: 78296257
Test: Local build and boot, wifi connects
Change-Id: Ie222dbe19b8f0dfb18af6bdae709c0dba5e0487b
Merged-In: Ie222dbe19b8f0dfb18af6bdae709c0dba5e0487b
(cherry picked from commit 12d97661cb648bc044fdfc2d541cad64375b8e04)
diff --git a/common/commands/Android.bp b/common/commands/Android.bp
index 4392d9d..8264fcc 100644
--- a/common/commands/Android.bp
+++ b/common/commands/Android.bp
@@ -14,5 +14,4 @@
// limitations under the License.
subdirs = [
- "wifi_relay",
]
diff --git a/common/commands/wifi_relay/Android.bp b/common/commands/wifi_relay/Android.bp
deleted file mode 100644
index fa7a678..0000000
--- a/common/commands/wifi_relay/Android.bp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright (C) 2018 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.
-//
-cc_binary {
- name: "wifi_relay",
- srcs: [
- "cmd.cpp",
- "mac80211_hwsim.cpp",
- "nl_client.cpp",
- "wifi_relay.cpp",
- ],
- shared_libs: [
- "libbase",
- "vsoc_lib",
- "libcuttlefish_fs",
- "libcuttlefish_utils",
- "cuttlefish_auto_resources",
- "liblog",
- "libnl",
- ],
- static_libs: [
- "libgflags",
- ],
- header_libs: [
- "cuttlefish_glog",
- ],
- target: {
- host: {
- static_libs: [
- "libcuttlefish_host_config",
- "libjsoncpp",
- ],
- },
- },
- defaults: ["cuttlefish_host_and_guest", "cuttlefish_native_isa"]
-}
-
diff --git a/common/commands/wifi_relay/cmd.cpp b/common/commands/wifi_relay/cmd.cpp
deleted file mode 100644
index 7e5a88d..0000000
--- a/common/commands/wifi_relay/cmd.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-#include "common/commands/wifi_relay/cmd.h"
-
-namespace cvd {
-
-Cmd::Cmd() : msg_(nlmsg_alloc()) {}
-
-Cmd::Cmd(nlmsghdr* h) : msg_(nlmsg_convert(h)) {}
-
-Cmd::Cmd(nl_msg* h) {
- nlmsg_get(h);
- msg_ = h;
-}
-
-Cmd::~Cmd() {
- for (auto& msg : responses_) {
- nlmsg_free(msg);
- }
- nlmsg_free(msg_);
-}
-
-bool Cmd::OnResponse(nl_msg* msg) {
- // nlmsg_get increases refcount on msg, but does not return the msg
- // so we can't exactly use it as an argument to unique_ptr.
- nlmsg_get(msg);
- responses_.emplace_back(msg);
- auto hdr = nlmsg_hdr(msg);
-
- // Kernel documentation seems to be a bit misleading on this topic saying:
- //
- // In multipart messages (multiple nlmsghdr headers with associated
- // payload in one byte stream) the first and all following headers have
- // the NLM_F_MULTI flag set, except for the last header which has the type
- // NLMSG_DONE.
- //
- // In theory, that would make processing multi-part messages simple, but in
- // practice this does not seem to be true. Specifying exit criteria solely on
- // NLM_F_MULTI flag setting will block some, if not all calls that dump
- // NL80211 wifi interfaces for example.
- if (!(hdr->nlmsg_flags & NLM_F_MULTI) || (hdr->nlmsg_type == NLMSG_DONE) ||
- (hdr->nlmsg_type == NLMSG_ERROR)) {
- std::lock_guard<std::mutex> lock(ready_mutex_);
- ready_signal_.notify_all();
- return true;
- }
-
- return false;
-}
-
-const std::vector<nl_msg*> Cmd::Responses() const {
- WaitComplete();
- return responses_;
-}
-
-void Cmd::WaitComplete() const {
- std::unique_lock<std::mutex> lock(ready_mutex_);
- ready_signal_.wait(lock, [this]() { return responses_.size() > 0; });
-}
-
-} // namespace cvd
diff --git a/common/commands/wifi_relay/cmd.h b/common/commands/wifi_relay/cmd.h
deleted file mode 100644
index f0d633f..0000000
--- a/common/commands/wifi_relay/cmd.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-#pragma once
-
-#include <condition_variable>
-#include <memory>
-#include <thread>
-#include <vector>
-
-#include <netlink/msg.h>
-
-namespace cvd {
-constexpr int kWifiSimVersion = 1;
-
-class Cmd {
- public:
- Cmd();
- explicit Cmd(nlmsghdr* h);
- explicit Cmd(nl_msg* h);
- ~Cmd();
-
- // Cmd() creates netlink request to be sent to kernel.
- // Returns netlink message header structure.
- nl_msg* Msg() const { return msg_; }
-
- // Responses() holds execution until netlink responds to this message.
- // Returns all netlink replies.
- const std::vector<nl_msg*> Responses() const;
-
- // OnResponse() handles data response from netlink.
- // Returns value indicating 'done' state:
- // - false, if more data is expected, or
- // - true, if processing is complete and instance can be disposed of.
- bool OnResponse(nl_msg* msg);
-
- // Wait until message processing is complete.
- void WaitComplete() const;
-
- private:
- nl_msg* msg_;
- std::vector<nl_msg*> responses_;
-
- mutable std::mutex ready_mutex_;
- mutable std::condition_variable ready_signal_;
-
- Cmd(const Cmd&) = delete;
- Cmd& operator=(const Cmd&) = delete;
-};
-
-} // namespace cvd
diff --git a/common/commands/wifi_relay/mac80211_hwsim.cpp b/common/commands/wifi_relay/mac80211_hwsim.cpp
deleted file mode 100644
index ab52a15..0000000
--- a/common/commands/wifi_relay/mac80211_hwsim.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "common/commands/wifi_relay/mac80211_hwsim.h"
-
-#include "common/commands/wifi_relay/mac80211_hwsim_driver.h"
-
-#include <glog/logging.h>
-#include <netlink/genl/ctrl.h>
-#include <netlink/genl/genl.h>
-#include <signal.h>
-#include <sys/uio.h>
-#include <gflags/gflags.h>
-
-DEFINE_string(
- pcap, "", "Path to save a pcap file of packets");
-
-static constexpr char kWifiSimFamilyName[] = "MAC80211_HWSIM";
-static constexpr char kNl80211FamilyName[] = "nl80211";
-
-static constexpr uint32_t kSignalLevelDefault = -24;
-
-#if !defined(ETH_ALEN)
-static constexpr size_t ETH_ALEN = 6;
-#endif
-
-namespace {
-
-struct pcap_hdr_t {
- uint32_t magic_number; /* magic number */
- uint16_t version_major; /* major version number */
- uint16_t version_minor; /* minor version number */
- int32_t thiszone; /* GMT to local correction */
- uint32_t sigfigs; /* accuracy of timestamps */
- uint32_t snaplen; /* max length of captured packets, in octets */
- uint32_t network; /* data link type */
-};
-
-struct pcaprec_hdr_t {
- uint32_t ts_sec; /* timestamp seconds */
- uint32_t ts_usec; /* timestamp microseconds */
- uint32_t incl_len; /* number of octets of packet saved in file */
- uint32_t orig_len; /* actual length of packet */
-};
-
-const pcap_hdr_t pcap_file_header{
- 0xa1b2c3d4,
- 2,
- 4,
- 0,
- 0,
- 65536,
- 105 // IEEE802.11 without radiotap
-};
-
-void WritePCap(const void* buffer, size_t length) {
- if (FLAGS_pcap.empty()) {
- return;
- }
- static int pcap = -1;
- if (pcap == -1) {
- pcap = open(FLAGS_pcap.c_str(), O_RDWR|O_CREAT|O_TRUNC, 0644);
- if (pcap == -1) {
- return;
- }
- (void)write(pcap, &pcap_file_header, sizeof(pcap_file_header));
- }
- size_t write_length = length;
- if (write_length > pcap_file_header.snaplen) {
- write_length = pcap_file_header.snaplen;
- }
- pcaprec_hdr_t hdr;
- struct timespec now;
- clock_gettime(CLOCK_REALTIME, &now);
- hdr.ts_sec = now.tv_sec;
- hdr.ts_usec = now.tv_nsec / 1000;
- hdr.incl_len = write_length;
- hdr.orig_len = length;
- struct iovec iov[2] { {&hdr, sizeof(hdr)},
- { const_cast<void*>(buffer), static_cast<size_t>(write_length)}};
- (void)writev(pcap, iov, 2);
-}
-
-}
-
-Mac80211HwSim::Remote::Remote(
- Mac80211HwSim *parent,
- vsoc::wifi::WifiExchangeView *wifiExchange)
- : mParent(parent),
- mWifiExchange(wifiExchange) {
- mWifiWorker = mWifiExchange->StartWorker();
-
- mThread = std::thread([this]{
- std::unique_ptr<uint8_t[]> buf(
- new uint8_t[Mac80211HwSim::kMessageSizeMax]);
-
- for (;;) {
- intptr_t res =
- mWifiExchange->Recv(buf.get(), Mac80211HwSim::kMessageSizeMax);
-
- if (res < 0) {
- LOG(ERROR) << "WifiExchangeView::Recv failed w/ res " << res;
- continue;
- }
- WritePCap(buf.get(), static_cast<size_t>(res));
-
- // LOG(INFO) << "GUEST->HOST packet of size " << res;
- mParent->injectFrame(buf.get(), res);
- }});
-}
-
-Mac80211HwSim::Remote::~Remote() {
- mDone = true;
- mWifiExchange->InterruptSelf();
-
- mThread.join();
-}
-
-intptr_t Mac80211HwSim::Remote::send(const void *data, size_t size) {
- WritePCap(data, size);
- return mWifiExchange->Send(data, size);
-}
-
-Mac80211HwSim::Mac80211HwSim(const MacAddress &mac)
- : mMAC(mac),
- mSock(nullptr, nl_socket_free) {
- int res;
-
- mSock.reset(nl_socket_alloc());
-
- if (mSock == nullptr) {
- goto bail;
- }
-
- res = nl_connect(mSock.get(), NETLINK_GENERIC);
- if (res < 0) {
- LOG(ERROR) << "nl_connect failed (" << nl_geterror(res) << ")";
- mInitCheck = res;
- goto bail;
- }
-
- nl_socket_disable_seq_check(mSock.get());
-
- res = nl_socket_set_buffer_size(
- mSock.get(), kMessageSizeMax, kMessageSizeMax);
-
- if (res < 0) {
- LOG(ERROR)
- << "nl_socket_set_buffer_size failed ("
- << nl_geterror(res)
- << ")";
-
- mInitCheck = res;
- goto bail;
- }
-
- mMac80211Family = genl_ctrl_resolve(mSock.get(), kWifiSimFamilyName);
- if (mMac80211Family <= 0) {
- LOG(ERROR) << "genl_ctrl_resolve failed.";
- mInitCheck = -ENODEV;
- goto bail;
- }
-
- mNl80211Family = genl_ctrl_resolve(mSock.get(), kNl80211FamilyName);
- if (mNl80211Family <= 0) {
- LOG(ERROR) << "genl_ctrl_resolve failed.";
- mInitCheck = -ENODEV;
- goto bail;
- }
-
-#if !defined(CUTTLEFISH_HOST)
- res = registerOrSubscribe(mMAC);
-
- if (res < 0) {
- mInitCheck = res;
- goto bail;
- }
-#endif
-
- mInitCheck = 0;
- return;
-
-bail:
- ;
-}
-
-int Mac80211HwSim::initCheck() const {
- return mInitCheck;
-}
-
-int Mac80211HwSim::socketFd() const {
- return nl_socket_get_fd(mSock.get());
-}
-
-void Mac80211HwSim::ackFrame(nlmsghdr *inMsg) {
- nlattr *attrs[__HWSIM_ATTR_MAX + 1];
- int res = genlmsg_parse(
- inMsg,
- 0 /* hdrlen */,
- attrs,
- __HWSIM_ATTR_MAX,
- nullptr /* policy */);
-
- if (res < 0) {
- LOG(ERROR) << "genlmsg_parse failed.";
- return;
- }
-
- uint32_t flags = nla_get_u32(attrs[HWSIM_ATTR_FLAGS]);
-
- if (!(flags & HWSIM_TX_CTL_REQ_TX_STATUS)) {
- LOG(VERBOSE) << "Frame doesn't require TX_STATUS.";
- return;
- }
-
- flags |= HWSIM_TX_STAT_ACK;
-
- const uint8_t *xmitterAddr =
- static_cast<const uint8_t *>(
- nla_data(attrs[HWSIM_ATTR_ADDR_TRANSMITTER]));
-
- size_t txRatesLen = nla_len(attrs[HWSIM_ATTR_TX_INFO]);
-
- const struct hwsim_tx_rate *txRates =
- static_cast<const struct hwsim_tx_rate *>(
- nla_data(attrs[HWSIM_ATTR_TX_INFO]));
-
- uint64_t cookie = nla_get_u64(attrs[HWSIM_ATTR_COOKIE]);
-
- std::unique_ptr<nl_msg, void (*)(nl_msg *)> outMsg(
- nlmsg_alloc(), nlmsg_free);
-
- genlmsg_put(
- outMsg.get(),
- NL_AUTO_PID,
- NL_AUTO_SEQ,
- mMac80211Family,
- 0 /* hdrlen */,
- NLM_F_REQUEST,
- HWSIM_CMD_TX_INFO_FRAME,
- 0 /* version */);
-
- nla_put(outMsg.get(), HWSIM_ATTR_ADDR_TRANSMITTER, ETH_ALEN, xmitterAddr);
- nla_put_u32(outMsg.get(), HWSIM_ATTR_FLAGS, flags);
- nla_put_u32(outMsg.get(), HWSIM_ATTR_SIGNAL, kSignalLevelDefault);
- nla_put(outMsg.get(), HWSIM_ATTR_TX_INFO, txRatesLen, txRates);
- nla_put_u64(outMsg.get(), HWSIM_ATTR_COOKIE, cookie);
-
- res = nl_send_auto_complete(mSock.get(), outMsg.get());
- if (res < 0) {
- LOG(ERROR) << "Sending TX Info failed. (" << nl_geterror(res) << ")";
- } else {
- LOG(VERBOSE) << "Sending TX Info SUCCEEDED.";
- }
-}
-
-void Mac80211HwSim::injectFrame(const void *data, size_t size) {
- std::unique_ptr<nl_msg, void (*)(nl_msg *)> msg(nlmsg_alloc(), nlmsg_free);
-
- genlmsg_put(
- msg.get(),
- NL_AUTO_PID,
- NL_AUTO_SEQ,
- mMac80211Family,
- 0 /* hdrlen */,
- NLM_F_REQUEST,
- HWSIM_CMD_FRAME,
- 0 /* version */);
-
- CHECK_EQ(mMAC.size(), static_cast<size_t>(ETH_ALEN));
- nla_put(msg.get(), HWSIM_ATTR_ADDR_RECEIVER, ETH_ALEN, &mMAC[0]);
-
- nla_put(msg.get(), HWSIM_ATTR_FRAME, size, data);
- nla_put_u32(msg.get(), HWSIM_ATTR_RX_RATE, 1);
- nla_put_u32(msg.get(), HWSIM_ATTR_SIGNAL, kSignalLevelDefault);
-
- LOG(VERBOSE) << "INJECTING!";
-
- int res = nl_send_auto_complete(mSock.get(), msg.get());
-
- if (res < 0) {
- LOG(ERROR) << "Injection failed. (" << nl_geterror(res) << ")";
- } else {
- LOG(VERBOSE) << "Injection SUCCEEDED.";
- }
-}
-
-void Mac80211HwSim::handlePacket() {
- sockaddr_nl from;
- uint8_t *data;
-
- int len = nl_recv(mSock.get(), &from, &data, nullptr /* creds */);
- if (len == 0) {
- LOG(ERROR) << "nl_recv received EOF.";
- return;
- } else if (len < 0) {
- LOG(ERROR) << "nl_recv failed (" << nl_geterror(len) << ")";
- return;
- }
-
- std::unique_ptr<nlmsghdr, void (*)(nlmsghdr *)> msg(
- reinterpret_cast<nlmsghdr *>(data),
- [](nlmsghdr *hdr) { free(hdr); });
-
- if (msg->nlmsg_type != mMac80211Family) {
- LOG(VERBOSE)
- << "Received msg of type other than MAC80211: "
- << msg->nlmsg_type;
-
- return;
- }
-
-#ifdef CUTTLEFISH_HOST
- LOG(VERBOSE) << "------------------- Host -> Guest -----------------------";
-#else
- LOG(VERBOSE) << "------------------- Guest -> Host -----------------------";
-#endif
-
- genlmsghdr *hdr = genlmsg_hdr(msg.get());
- if (hdr->cmd != HWSIM_CMD_FRAME) {
- LOG(VERBOSE) << "cmd HWSIM_CMD_FRAME.";
- return;
- }
-
- nlattr *attrs[__HWSIM_ATTR_MAX + 1];
- int res = genlmsg_parse(
- msg.get(),
- 0 /* hdrlen */,
- attrs,
- __HWSIM_ATTR_MAX,
- nullptr /* policy */);
-
- if (res < 0) {
- LOG(ERROR) << "genlmsg_parse failed.";
- return;
- }
-
- nlattr *attr = attrs[HWSIM_ATTR_FRAME];
- if (!attr) {
- LOG(ERROR) << "no HWSIM_ATTR_FRAME.";
- return;
- }
- std::lock_guard<std::mutex> autoLock(mRemotesLock);
- for (auto &remoteEntry : mRemotes) {
- // TODO(andih): Check which remotes to forward this packet to based
- // on the destination address.
- remoteEntry.second->send(nla_data(attr), nla_len(attr));
- }
-
-#if !defined(CUTTLEFISH_HOST)
- ackFrame(msg.get());
-#endif
-
-}
-
-int Mac80211HwSim::registerOrSubscribe(const MacAddress &mac) {
- std::unique_ptr<nl_msg, void (*)(nl_msg *)> msg(nullptr, nlmsg_free);
-
- msg.reset(nlmsg_alloc());
-
- genlmsg_put(
- msg.get(),
- NL_AUTO_PID,
- NL_AUTO_SEQ,
- mMac80211Family,
- 0,
- NLM_F_REQUEST,
-#ifdef CUTTLEFISH_HOST
- HWSIM_CMD_SUBSCRIBE,
-#else
- HWSIM_CMD_REGISTER,
-#endif
- 0);
-
-#ifdef CUTTLEFISH_HOST
- nla_put(msg.get(), HWSIM_ATTR_ADDR_RECEIVER, ETH_ALEN, &mac[0]);
-#else
- // HWSIM_CMD_REGISTER is a global command not specific to a MAC.
- (void)mac;
-#endif
-
- int res = nl_send_auto_complete(mSock.get(), msg.get());
-
- if (res < 0) {
- LOG(ERROR)
- << "Registration/subscription failed. (" << nl_geterror(res) << ")";
-
- return res;
- }
-
- return 0;
-}
-
-int Mac80211HwSim::addRemote(
- const MacAddress &mac,
- vsoc::wifi::WifiExchangeView *wifiExchange) {
-#ifdef CUTTLEFISH_HOST
- int res = registerOrSubscribe(mac);
-
- if (res < 0) {
- return res;
- }
-#endif
-
- std::lock_guard<std::mutex> autoLock(mRemotesLock);
-
- std::unique_ptr<Remote> remote(new Remote(this, wifiExchange));
- mRemotes.insert(std::make_pair(mac, std::move(remote)));
-
- return 0;
-}
-
-void Mac80211HwSim::removeRemote(const MacAddress &mac) {
- std::lock_guard<std::mutex> autoLock(mRemotesLock);
- auto it = mRemotes.find(mac);
- if (it != mRemotes.end()) {
- mRemotes.erase(it);
- }
-}
diff --git a/common/commands/wifi_relay/mac80211_hwsim.h b/common/commands/wifi_relay/mac80211_hwsim.h
deleted file mode 100644
index fb2fc99..0000000
--- a/common/commands/wifi_relay/mac80211_hwsim.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "common/vsoc/lib/wifi_exchange_view.h"
-
-#include <errno.h>
-#include <functional>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <netlink/netlink.h>
-
-struct Mac80211HwSim {
- using MacAddress = vsoc::wifi::WifiExchangeView::MacAddress;
-
- static constexpr size_t kMessageSizeMax = 128 * 1024;
-
- explicit Mac80211HwSim(const MacAddress &mac);
- Mac80211HwSim(const Mac80211HwSim &) = delete;
- Mac80211HwSim &operator=(const Mac80211HwSim &) = delete;
-
- virtual ~Mac80211HwSim() = default;
-
- int initCheck() const;
-
- int socketFd() const;
-
- void handlePacket();
-
- int mac80211Family() const { return mMac80211Family; }
- int nl80211Family() const { return mNl80211Family; }
-
- int addRemote(
- const MacAddress &mac,
- vsoc::wifi::WifiExchangeView *wifiExchange);
-
- void removeRemote(const MacAddress &mac);
-
-private:
- struct Remote {
- explicit Remote(
- Mac80211HwSim *parent,
- vsoc::wifi::WifiExchangeView *wifiExchange);
-
- Remote(const Remote &) = delete;
- Remote &operator=(const Remote &) = delete;
-
- virtual ~Remote();
-
- intptr_t send(const void *data, size_t size);
-
- private:
- Mac80211HwSim *mParent;
- vsoc::wifi::WifiExchangeView *mWifiExchange;
- std::unique_ptr<vsoc::RegionWorker> mWifiWorker;
-
- volatile bool mDone = false;
- std::thread mThread;
- };
-
- int mInitCheck = -ENODEV;
- MacAddress mMAC;
- std::unique_ptr<nl_sock, void (*)(nl_sock *)> mSock;
- int mMac80211Family = 0;
- int mNl80211Family = 0;
-
- std::mutex mRemotesLock;
- std::map<MacAddress, std::unique_ptr<Remote>> mRemotes;
-
- void injectFrame(const void *data, size_t size);
- void ackFrame(nlmsghdr *msg);
- int registerOrSubscribe(const MacAddress &mac);
-};
diff --git a/common/commands/wifi_relay/mac80211_hwsim_driver.h b/common/commands/wifi_relay/mac80211_hwsim_driver.h
deleted file mode 100644
index c472254..0000000
--- a/common/commands/wifi_relay/mac80211_hwsim_driver.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-enum hwsim_cmd {
- HWSIM_CMD_UNSPEC,
- HWSIM_CMD_REGISTER,
- HWSIM_CMD_FRAME,
- HWSIM_CMD_TX_INFO_FRAME,
- HWSIM_CMD_NEW_RADIO,
- HWSIM_CMD_DEL_RADIO,
- HWSIM_CMD_GET_RADIO,
- HWSIM_CMD_SUBSCRIBE,
- __HWSIM_CMD_MAX
-};
-
-enum hwsim_attr {
- /* 0 */ HWSIM_ATTR_UNSPEC,
- /* 1 */ HWSIM_ATTR_ADDR_RECEIVER,
- /* 2 */ HWSIM_ATTR_ADDR_TRANSMITTER,
- /* 3 */ HWSIM_ATTR_FRAME,
- /* 4 */ HWSIM_ATTR_FLAGS,
- /* 5 */ HWSIM_ATTR_RX_RATE,
- /* 6 */ HWSIM_ATTR_SIGNAL,
- /* 7 */ HWSIM_ATTR_TX_INFO,
- /* 8 */ HWSIM_ATTR_COOKIE,
- /* 9 */ HWSIM_ATTR_CHANNELS,
- /* 10 */ HWSIM_ATTR_RADIO_ID,
- /* 11 */ HWSIM_ATTR_REG_HINT_ALPHA2,
- /* 12 */ HWSIM_ATTR_REG_CUSTOM_REG,
- /* 13 */ HWSIM_ATTR_REG_STRICT_REG,
- /* 14 */ HWSIM_ATTR_SUPPORT_P2P_DEVICE,
- /* 15 */ HWSIM_ATTR_USE_CHANCTX,
- /* 16 */ HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
- /* 17 */ HWSIM_ATTR_RADIO_NAME,
- /* 18 */ HWSIM_ATTR_NO_VIF,
- /* 19 */ HWSIM_ATTR_FREQ,
- __HWSIM_ATTR_MAX
-};
-
-enum hwsim_tx_control_flags {
- HWSIM_TX_CTL_REQ_TX_STATUS = 1,
- HWSIM_TX_CTL_NO_ACK = 2,
- HWSIM_TX_STAT_ACK = 4,
-};
diff --git a/common/commands/wifi_relay/netlink.h b/common/commands/wifi_relay/netlink.h
deleted file mode 100644
index 2eb374f..0000000
--- a/common/commands/wifi_relay/netlink.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-#pragma once
-
-#include <memory>
-#include <thread>
-
-#include <netlink/genl/genl.h>
-#include "common/libs/wifi/nl_client.h"
-#include "common/libs/wifi/wr_client.h"
-
-namespace cvd {
-// Netlink provides access to relevant netlink backends and resources.
-class Netlink {
- public:
- Netlink(const std::string& wifirouter_socket);
- ~Netlink() = default;
-
- // Initialize instance of Netlink Factory.
- bool Init();
-
- // Getter for NETLINK_GENERIC NlClient instance.
- NlClient& GeNL() { return genl_; }
-
- // Getter for NETLINK_ROUTE NlClient instance.
- NlClient& RtNL() { return rtnl_; }
-
- WRClient& WRCL() { return wrcl_; }
-
- // Access Family ID for MAC80211 (WIFI Simulator).
- int FamilyMAC80211() const { return mac80211_hwsim_family_; }
-
- // Access Family ID for NL80211 (WIFI management).
- int FamilyNL80211() const { return nl80211_family_; }
-
- private:
- // Loop and process all incoming netlink messages.
- // This function will trigger calls to NlClient's OnResponse() which handles
- // incoming netlink messages.
- void HandleNetlinkMessages();
-
- NlClient genl_;
- NlClient rtnl_;
- WRClient wrcl_;
-
- int mac80211_hwsim_family_ = 0;
-#if 0
- int router_family_ = 0;
-#endif
- int nl80211_family_ = 0;
-
- Netlink(const Netlink&) = delete;
- Netlink& operator=(const Netlink&) = delete;
-};
-
-} // namespace cvd
diff --git a/common/commands/wifi_relay/nl_client.cpp b/common/commands/wifi_relay/nl_client.cpp
deleted file mode 100644
index a00fab1..0000000
--- a/common/commands/wifi_relay/nl_client.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-#include "common/commands/wifi_relay/nl_client.h"
-
-#include <glog/logging.h>
-
-namespace cvd {
-
-NlClient::NlClient(int nl_type)
- : nl_type_(nl_type),
- callback_(nullptr, [](nl_cb* cb) { free(cb); }),
- sock_(nullptr, [](nl_sock* sock) { free(sock); }) {}
-
-bool NlClient::Init() {
- // Set up netlink callbacks.
- callback_.reset(nl_cb_alloc(NL_CB_CUSTOM));
- if (!callback_) {
- LOG(ERROR) << "Could not create netlink callback.";
- return false;
- }
-
- // Register callback that will receive asynchronous messages from netlink.
- nl_cb_set(callback_.get(), NL_CB_MSG_IN, NL_CB_CUSTOM,
- [](nl_msg* msg, void* data) {
- NlClient* self = static_cast<NlClient*>(data);
- return self->OnResponse(msg);
- },
- this);
-
- // Open Netlink target.
- sock_.reset(nl_socket_alloc_cb(callback_.get()));
- if (!sock_) {
- LOG(ERROR) << "Could not create netlink socket. Are you root?";
- return false;
- }
-
- if (nl_connect(sock_.get(), nl_type_) < 0) {
- LOG(ERROR) << "Could not connect to netlink. Are you root?";
- return false;
- }
-
- return true;
-}
-
-void NlClient::Send(Cmd* msg) {
- std::lock_guard<std::mutex> guard(in_flight_mutex_);
- // nl_send_auto sets sequence number (if defaults to NL_AUTO_SEQ).
- // Make sure to execute this while in critical section to ensure we have time
- // to set up callback before we receive response.
- nl_send_auto(sock_.get(), msg->Msg());
- auto seq = nlmsg_hdr(msg->Msg())->nlmsg_seq;
- in_flight_[seq] = msg;
-}
-
-// Handle asynchronous messages & responses from netlink.
-int NlClient::OnResponse(nl_msg* msg) {
- nlmsghdr* header = nlmsg_hdr(msg);
- int seq = header->nlmsg_seq;
-
- // Find & invoke corresponding callback, if any.
- std::lock_guard<std::mutex> guard(in_flight_mutex_);
- auto pos = in_flight_.find(seq);
- if (pos != in_flight_.end()) {
- if (pos->second->OnResponse(msg)) {
- // Erase command if reports it's done.
- in_flight_.erase(seq);
- }
- } else if (default_handler_) {
- default_handler_(msg);
- }
-
- return NL_OK;
-}
-
-void NlClient::SetDefaultHandler(std::function<void(nl_msg*)> cb) {
- std::lock_guard<std::mutex> guard(in_flight_mutex_);
- default_handler_ = std::move(cb);
-}
-
-nl_sock* NlClient::Sock() const { return sock_.get(); }
-
-} // namespace cvd
diff --git a/common/commands/wifi_relay/nl_client.h b/common/commands/wifi_relay/nl_client.h
deleted file mode 100644
index 74bc122..0000000
--- a/common/commands/wifi_relay/nl_client.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-#pragma once
-
-#include <functional>
-#include <map>
-#include <memory>
-#include <mutex>
-
-#include <netlink/genl/genl.h>
-
-#include "common/commands/wifi_relay/cmd.h"
-
-namespace cvd {
-
-class NlClient {
- public:
- NlClient(int nl_type);
- ~NlClient() = default;
-
- // Init this client: set up callback & open socket.
- bool Init();
-
- // Get netlink socket used for sending and receiving messages.
- nl_sock* Sock() const;
-
- // Send message to netlink. Supplied callback will be invoked when response is
- // received.
- void Send(Cmd* msg);
-
- // Set callback receiving all asynchronous messages and responses that do not
- // have any proper recipient.
- // This is useful in situations, where netlink sends asynchronous event
- // notifications, such as new MAC80211 HWSIM frame.
- void SetDefaultHandler(std::function<void(nl_msg*)> cb);
-
- private:
- // Receive & dispatch netlink response.
- int OnResponse(nl_msg* msg);
-
- int nl_type_;
-
- std::unique_ptr<nl_cb, void (*)(nl_cb*)> callback_;
- std::unique_ptr<nl_sock, void (*)(nl_sock*)> sock_;
- std::mutex in_flight_mutex_;
- std::map<uint32_t, Cmd*> in_flight_;
- std::function<void(nl_msg*)> default_handler_;
-
- NlClient(const NlClient&) = delete;
- NlClient& operator=(const NlClient&) = delete;
-};
-
-} // namespace cvd
diff --git a/common/commands/wifi_relay/wifi_relay.cpp b/common/commands/wifi_relay/wifi_relay.cpp
deleted file mode 100644
index 4d862b0..0000000
--- a/common/commands/wifi_relay/wifi_relay.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "wifi_relay.h"
-
-#include "common/commands/wifi_relay/mac80211_hwsim_driver.h"
-#include "common/commands/wifi_relay/nl_client.h"
-
-#if defined(CUTTLEFISH_HOST)
-#include "host/libs/config/cuttlefish_config.h"
-#endif
-
-#include <linux/netdevice.h>
-#include <linux/nl80211.h>
-#include <netlink/genl/ctrl.h>
-#include <netlink/genl/genl.h>
-
-#include <gflags/gflags.h>
-#include <glog/logging.h>
-
-#include <fstream>
-
-#if !defined(CUTTLEFISH_HOST)
-DEFINE_string(
- iface_name, "wlan0", "Name of the wifi interface to be created.");
-#endif
-
-WifiRelay::WifiRelay(
- const Mac80211HwSim::MacAddress &localMAC,
- const Mac80211HwSim::MacAddress &remoteMAC)
- : mMac80211HwSim(new Mac80211HwSim(localMAC)) {
- init_check_ = mMac80211HwSim->initCheck();
-
- if (init_check_ < 0) {
- return;
- }
-
- init_check_ = mMac80211HwSim->addRemote(
- remoteMAC,
-#if defined(CUTTLEFISH_HOST)
- vsoc::wifi::WifiExchangeView::GetInstance(vsoc::GetDomain().c_str())
-#else
- vsoc::wifi::WifiExchangeView::GetInstance()
-#endif
- );
-}
-
-int WifiRelay::initCheck() const {
- return init_check_;
-}
-
-void WifiRelay::run() {
- for (;;) {
- fd_set rs;
- FD_ZERO(&rs);
-
- FD_SET(mMac80211HwSim->socketFd(), &rs);
- int maxFd = mMac80211HwSim->socketFd();
-
- int res = select(maxFd + 1, &rs, nullptr, nullptr, nullptr);
- if (res <= 0) {
- continue;
- }
-
- if (FD_ISSET(mMac80211HwSim->socketFd(), &rs)) {
- mMac80211HwSim->handlePacket();
- }
- }
-}
-
-int WifiRelay::mac80211Family() const {
- return mMac80211HwSim->mac80211Family();
-}
-
-int WifiRelay::nl80211Family() const {
- return mMac80211HwSim->nl80211Family();
-}
-
-int createRadio(cvd::NlClient *nl, int familyMAC80211, const char *phyName) {
- cvd::Cmd msg;
- genlmsg_put(
- msg.Msg(),
- NL_AUTO_PID,
- NL_AUTO_SEQ,
- familyMAC80211,
- 0,
- NLM_F_REQUEST,
- HWSIM_CMD_NEW_RADIO,
- cvd::kWifiSimVersion);
-
- nla_put_string(msg.Msg(), HWSIM_ATTR_RADIO_NAME, phyName);
- nla_put_flag(msg.Msg(), HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE);
-
- nl->Send(&msg);
-
- // Responses() pauses until netlink responds to previously sent message.
- for (auto *r : msg.Responses()) {
- auto hdr = nlmsg_hdr(r);
- if (hdr->nlmsg_type == NLMSG_ERROR) {
- nlmsgerr* err = static_cast<nlmsgerr*>(nlmsg_data(hdr));
- return err->error;
- }
- }
-
- return -1;
-}
-
-int getPhyIndex(const std::string &phyName) {
- std::ifstream file("/sys/class/ieee80211/" + phyName + "/index");
-
- int number;
- file >> number;
-
- return number;
-}
-
-int getInterfaceIndex(cvd::NlClient *nl, int familyNL80211, uint32_t phyIndex) {
- cvd::Cmd msg;
- genlmsg_put(
- msg.Msg(),
- NL_AUTO_PID,
- NL_AUTO_SEQ,
- familyNL80211,
- 0,
- NLM_F_REQUEST | NLM_F_DUMP,
- NL80211_CMD_GET_INTERFACE,
- 0);
-
- nl->Send(&msg);
-
- // Responses() pauses until netlink responds to previously sent message.
- for (auto *r : msg.Responses()) {
- auto hdr = nlmsg_hdr(r);
- if (hdr->nlmsg_type == NLMSG_ERROR) {
- nlmsgerr* err = static_cast<nlmsgerr*>(nlmsg_data(hdr));
- return err->error;
- }
-
- // Last message in entire series.
- if (hdr->nlmsg_type == NLMSG_DONE) {
- break;
- }
-
- // !DONE && !ERROR => content.
- // Decode attributes supplied by netlink.
- // the genlmsg_parse puts each attribute in a respective slot in an array,
- // so we have to preallocate enough space.
- struct nlattr* attrs[NL80211_ATTR_MAX + 1];
- auto err = genlmsg_parse(hdr, 0, attrs, NL80211_ATTR_MAX, nullptr);
-
- // Return error if response could not be parsed. This is actually quite
- // serious.
- if (err < 0) {
- LOG(ERROR) << "Could not process netlink response: " << strerror(-err);
- return err;
- }
-
- // Check if we have WIPHY attribute in response -- and if it's the relevant
- // one.
- auto wiphy = attrs[NL80211_ATTR_WIPHY];
- if (wiphy != nullptr && nla_get_u32(wiphy) == phyIndex) {
- auto number = attrs[NL80211_ATTR_IFINDEX];
-
- if (number != nullptr) {
- return nla_get_u32(number);
- }
- }
- }
-
- return -1;
-}
-
-int updateInterface(
- cvd::NlClient *nlRoute,
- int ifaceIndex,
- const std::string &name,
- const uint8_t *mac) {
- cvd::Cmd msg;
-
- ifinfomsg ifm{};
- ifm.ifi_index = ifaceIndex;
-
- nlmsg_put(
- msg.Msg(), NL_AUTO_PID, NL_AUTO_SEQ, RTM_SETLINK, 0, NLM_F_REQUEST);
-
- nlmsg_append(msg.Msg(), &ifm, sizeof(ifm), 0);
- nla_put_string(msg.Msg(), IFLA_IFNAME, name.c_str());
-
- std::vector<uint8_t> macCopy(MAX_ADDR_LEN);
- memcpy(&macCopy[0], mac, ETH_ALEN);
-
- nla_put(msg.Msg(), IFLA_ADDRESS, MAX_ADDR_LEN, &macCopy[0]);
-
- nlRoute->Send(&msg);
-
- // Responses() pauses until netlink responds to previously sent message.
- for (auto *r : msg.Responses()) {
- auto hdr = nlmsg_hdr(r);
- LOG(VERBOSE) << "got response of type " << hdr->nlmsg_type;
-
- if (hdr->nlmsg_type == NLMSG_ERROR) {
- nlmsgerr* err = static_cast<nlmsgerr*>(nlmsg_data(hdr));
-
- if (err->error < 0) {
- LOG(ERROR) << "updateInterface failed w/ " << err->error
- << " (" << strerror(-err->error) << ")";
- }
-
- return err->error;
- }
- }
-
- LOG(VERBOSE) << "No more responses";
-
- return -1;
-}
-
-int main(int argc, char **argv) {
- ::android::base::InitLogging(argv, android::base::StderrLogger);
- gflags::ParseCommandLineFlags(&argc, &argv, true);
-
- auto wifi_view = vsoc::wifi::WifiExchangeView::GetInstance(
-#if defined(CUTTLEFISH_HOST)
- vsoc::GetDomain().c_str()
-#endif
- );
-
- Mac80211HwSim::MacAddress guestMAC = wifi_view->GetGuestMACAddress();
- Mac80211HwSim::MacAddress hostMAC = wifi_view->GetHostMACAddress();
-
-#ifdef CUTTLEFISH_HOST
- WifiRelay relay(hostMAC, guestMAC);
-#else
- WifiRelay relay(guestMAC, hostMAC);
-#endif
- int res = relay.initCheck();
-
- if (res < 0) {
- LOG(ERROR)
- << "WifiRelay::initCheck() returned error "
- << res
- << " ("
- << strerror(-res)
- << ")";
-
- exit(1);
- }
-
-#if !defined(CUTTLEFISH_HOST)
- cvd::NlClient client(NETLINK_GENERIC);
- if (!client.Init()) {
- LOG(ERROR) << "Could not open Netlink Generic.";
- exit(1);
- }
-
- cvd::NlClient nlRoute(NETLINK_ROUTE);
- if (!nlRoute.Init()) {
- LOG(ERROR) << "Could not open Netlink Route.";
- exit(1);
- }
-
- std::thread([&client, &nlRoute] {
- for (;;) {
- fd_set rs;
- FD_ZERO(&rs);
-
- int fdGeneric = nl_socket_get_fd(client.Sock());
- int fdRoute = nl_socket_get_fd(nlRoute.Sock());
-
- FD_SET(fdGeneric, &rs);
- FD_SET(fdRoute, &rs);
-
- int maxFd = std::max(fdGeneric, fdRoute);
-
- int res = select(maxFd + 1, &rs, nullptr, nullptr, nullptr);
-
- if (res == 0) {
- continue;
- } else if (res < 0) {
- continue;
- }
-
- if (FD_ISSET(fdGeneric, &rs)) {
- nl_recvmsgs_default(client.Sock());
- }
-
- if (FD_ISSET(fdRoute, &rs)) {
- nl_recvmsgs_default(nlRoute.Sock());
- }
- }
- }).detach();
-
- const std::string phyName = FLAGS_iface_name + "_phy";
- if (createRadio(&client, relay.mac80211Family(), phyName.c_str()) < 0) {
- LOG(ERROR) << "Could not create radio.";
- exit(1);
- }
-
- int phyIndex = getPhyIndex(phyName);
- CHECK_GE(phyIndex, 0);
- LOG(VERBOSE) << "Got PHY index " << phyIndex;
-
- int ifaceIndex = getInterfaceIndex(
- &client, relay.nl80211Family(), static_cast<uint32_t>(phyIndex));
-
- CHECK_GE(ifaceIndex, 0);
- LOG(VERBOSE) << "Got interface index " << ifaceIndex;
-
- if (updateInterface(
- &nlRoute, ifaceIndex, FLAGS_iface_name, &guestMAC[0]) < 0) {
- LOG(ERROR) << "Failed to update interface.";
- exit(1);
- }
-#endif // !defined(CUTTLEFISH_HOST)
-
- relay.run();
-
- return 0;
-}
diff --git a/common/commands/wifi_relay/wifi_relay.h b/common/commands/wifi_relay/wifi_relay.h
deleted file mode 100644
index 2edc6db..0000000
--- a/common/commands/wifi_relay/wifi_relay.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "common/commands/wifi_relay/mac80211_hwsim.h"
-
-#include <errno.h>
-#include <memory>
-
-class WifiRelay {
- public:
- WifiRelay(
- const Mac80211HwSim::MacAddress &localMAC,
- const Mac80211HwSim::MacAddress &remoteMAC);
-
- WifiRelay(const WifiRelay &) = delete;
- WifiRelay &operator=(const WifiRelay &) = delete;
-
- virtual ~WifiRelay() = default;
-
- int initCheck() const;
-
- void run();
-
- int mac80211Family() const;
- int nl80211Family() const;
-
- private:
- int init_check_ = -ENODEV;
-
- std::unique_ptr<Mac80211HwSim> mMac80211HwSim;
-};
diff --git a/guest/commands/Android.bp b/guest/commands/Android.bp
index 2f0e565..8264fcc 100644
--- a/guest/commands/Android.bp
+++ b/guest/commands/Android.bp
@@ -13,3 +13,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+subdirs = [
+]
diff --git a/host/commands/launch/main.cc b/host/commands/launch/main.cc
index 90bb752..b41de1f 100644
--- a/host/commands/launch/main.cc
+++ b/host/commands/launch/main.cc
@@ -135,10 +135,6 @@
DEFINE_string(host_mac_address,
"42:00:00:00:00:00",
"MAC address of the wifi interface running on the host.");
-DEFINE_bool(start_wifi_relay, true, "Whether to start the wifi_relay process.");
-DEFINE_string(wifi_relay_binary,
- vsoc::DefaultHostArtifactsPath("bin/wifi_relay"),
- "Location of the wifi_relay binary.");
DEFINE_string(wifi_interface,
vsoc::HostSupportsQemuCli() ? GetPerInstanceDefault("cvd-wbr-")
: GetPerInstanceDefault("cvd-wifi-"),
@@ -428,14 +424,6 @@
}
}
-void LaunchWifiRelayIfEnabled() {
- if (FLAGS_start_wifi_relay) {
- // Launch the wifi relay, don't wait for it to complete
- cvd::subprocess(
- {"/usr/bin/sudo", "-E", FLAGS_wifi_relay_binary, GetConfigFileArg()});
- }
-}
-
bool ResolveInstanceFiles() {
if (FLAGS_system_image_dir.empty()) {
LOG(FATAL) << "--system_image_dir must be specified.";
@@ -681,7 +669,6 @@
LaunchSocketForwardProxyIfEnabled();
LaunchVNCServerIfEnabled();
- LaunchWifiRelayIfEnabled();
pause();
}