diff options
author | Remi NGUYEN VAN <reminv@google.com> | 2019-01-29 15:38:52 +0900 |
---|---|---|
committer | Remi NGUYEN VAN <reminv@google.com> | 2019-01-30 10:23:24 +0900 |
commit | 6e9fdbd61e97bd29c88424f6880b578f37c82c2f (patch) | |
tree | 0323fbb7af93a375900fa2fbd383715591b6f7a0 /src/android/net/dhcp/DhcpServer.java | |
parent | 9906ef6e86e9811a44ff584c5b70e6a2bc6f3d74 (diff) |
Remove last NetworkStack usage of hidden APIs
Includes various small changes to stop using hidden APIs
Test: make NetworkStack
Test: flashed, booted, WiFi and tethering working
Bug: 112869080
Change-Id: Id2830795a444f484b377ed6437435a1cd833697a
Diffstat (limited to 'src/android/net/dhcp/DhcpServer.java')
-rw-r--r-- | src/android/net/dhcp/DhcpServer.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/android/net/dhcp/DhcpServer.java b/src/android/net/dhcp/DhcpServer.java index beabd3e..cd993e9 100644 --- a/src/android/net/dhcp/DhcpServer.java +++ b/src/android/net/dhcp/DhcpServer.java @@ -28,6 +28,7 @@ import static android.net.shared.Inet4AddressUtils.getPrefixMaskAsInet4Address; import static android.system.OsConstants.AF_INET; import static android.system.OsConstants.IPPROTO_UDP; import static android.system.OsConstants.SOCK_DGRAM; +import static android.system.OsConstants.SOCK_NONBLOCK; import static android.system.OsConstants.SOL_SOCKET; import static android.system.OsConstants.SO_BROADCAST; import static android.system.OsConstants.SO_REUSEADDR; @@ -43,7 +44,6 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.net.INetworkStackStatusCallback; import android.net.MacAddress; -import android.net.NetworkUtils; import android.net.TrafficStats; import android.net.util.SharedLog; import android.net.util.SocketUtils; @@ -207,7 +207,7 @@ public class DhcpServer extends IDhcpServer.Stub { @Override public void addArpEntry(@NonNull Inet4Address ipv4Addr, @NonNull MacAddress ethAddr, @NonNull String ifname, @NonNull FileDescriptor fd) throws IOException { - NetworkUtils.addArpEntry(ipv4Addr, ethAddr, ifname, fd); + SocketUtils.addArpEntry(ipv4Addr, ethAddr, ifname, fd); } @Override @@ -630,7 +630,7 @@ public class DhcpServer extends IDhcpServer.Stub { // TODO: have and use an API to set a socket tag without going through the thread tag final int oldTag = TrafficStats.getAndSetThreadStatsTag(TAG_SYSTEM_DHCP_SERVER); try { - mSocket = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + mSocket = Os.socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); SocketUtils.bindSocketToInterface(mSocket, mIfName); Os.setsockoptInt(mSocket, SOL_SOCKET, SO_REUSEADDR, 1); Os.setsockoptInt(mSocket, SOL_SOCKET, SO_BROADCAST, 1); |