diff options
author | Luke Huang <huangluke@google.com> | 2018-08-29 19:06:05 +0800 |
---|---|---|
committer | Luke Huang <huangluke@google.com> | 2019-01-23 16:25:08 +0800 |
commit | 528af60e4e013c43567d888951633730564991f1 (patch) | |
tree | 13f961e52e61aee6db987f61b2f2782a281f59ba /tests/tun_interface.cpp | |
parent | ff591f95466e683fe519845a5c8711313d91470b (diff) | |
download | netd-528af60e4e013c43567d888951633730564991f1.tar.gz |
Netd unsolicited event porting
Use another buffer to log unsolicited event.
Test: built, flashed, booted
Test: 1. manual test datacall/wifi work
2. manual test tethering work
3. run cts StrictModeTest pass
4. manual test data alert work
5. manual idletimer work
Change-Id: I1e4ed360b0c9d60c14bc7f0ffdf578fc557d3643
Diffstat (limited to 'tests/tun_interface.cpp')
-rw-r--r-- | tests/tun_interface.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/tun_interface.cpp b/tests/tun_interface.cpp index 8e8cb6ea..01278ccf 100644 --- a/tests/tun_interface.cpp +++ b/tests/tun_interface.cpp @@ -42,7 +42,7 @@ using android::base::StringPrintf; namespace android { namespace net { -int TunInterface::init() { +int TunInterface::init(const std::string& ifName) { // Generate a random ULA address pair. arc4random_buf(&mSrcAddr, sizeof(mSrcAddr)); mSrcAddr.s6_addr[0] = 0xfd; @@ -68,7 +68,10 @@ int TunInterface::init() { // It can only be created by BandwidthController::setInterfaceAlert, but that appears to have no // actual callers in the framework, because mActiveAlerts is always empty. // TODO: remove setInterfaceAlert and use a longer interface name. - mIfName = StringPrintf("netd%x", arc4random()); + mIfName = ifName; + if (mIfName.empty()) { + mIfName = StringPrintf("netd%x", arc4random()); + } mIfName.resize(9); struct ifreq ifr = { |