Snap for 8953554 from 48b5d88c6c63176520ae11266c55d1953466f919 to mainline-wifi-release Change-Id: I8f78787353a751323a9fa11da394b2cb49725b0b
diff --git a/jni/network_stack_utils_jni.cpp b/jni/network_stack_utils_jni.cpp index 6408856..63146d8 100644 --- a/jni/network_stack_utils_jni.cpp +++ b/jni/network_stack_utils_jni.cpp
@@ -126,8 +126,7 @@ int fd = netjniutils::GetNativeFileDescriptor(env, javaFd); if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) { - jniThrowExceptionFmt(env, "java/net/SocketException", - "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno)); + jniThrowErrnoException(env, "setsockopt(SO_ATTACH_FILTER)", errno); } }
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java index b41484c..34c37a2 100644 --- a/src/android/net/dhcp/DhcpClient.java +++ b/src/android/net/dhcp/DhcpClient.java
@@ -699,6 +699,10 @@ Os.bind(mPacketSock, addr); } catch (SocketException | ErrnoException e) { logError("Error creating packet socket", e); + if (e instanceof ErrnoException + && ((ErrnoException) e).errno == 524 /* ENOTSUPP */) { + Log.wtf(TAG, "Errno: ENOTSUPP"); + } closeFd(mPacketSock); mPacketSock = null; return null;
diff --git a/src/android/net/util/NetworkStackUtils.java b/src/android/net/util/NetworkStackUtils.java index 7e0ca29..1730b9d 100755 --- a/src/android/net/util/NetworkStackUtils.java +++ b/src/android/net/util/NetworkStackUtils.java
@@ -18,6 +18,7 @@ import android.content.Context; import android.net.MacAddress; +import android.system.ErrnoException; import androidx.annotation.NonNull; @@ -277,7 +278,7 @@ /** * Attaches a socket filter that accepts DHCP packets to the given socket. */ - public static native void attachDhcpFilter(FileDescriptor fd) throws SocketException; + public static native void attachDhcpFilter(FileDescriptor fd) throws ErrnoException; /** * Attaches a socket filter that accepts ICMPv6 router advertisements to the given socket.