From 443545016d834f8da09cadf38d863c546a470869 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 29 Oct 2020 14:07:26 +0100
Subject: Haiku: workaround for NetworkInterface ioctl calls

ATM the Haiku network stack checks for ioctl syscall length parameter.

diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c
index 6077a0b..5190656 100644
--- a/src/solaris/native/java/net/NetworkInterface.c
+++ b/src/solaris/native/java/net/NetworkInterface.c
@@ -2339,7 +2339,7 @@ static int getIndex(int sock, const char *name) {
     memset((char *)&if2, 0, sizeof(if2));
     strncpy(if2.ifr_name, name, sizeof(if2.ifr_name) - 1);
 
-    if (ioctl(sock, SIOCGIFINDEX, (char *)&if2) < 0) {
+    if (ioctl(sock, SIOCGIFINDEX, (char *)&if2, sizeof(if2)) < 0) {
         return -1;
     }
 
@@ -2387,7 +2387,7 @@ static int getMTU(JNIEnv *env, int sock, const char *ifname) {
     memset((char *)&if2, 0, sizeof(if2));
     strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
 
-    if (ioctl(sock, SIOCGIFMTU, (char *)&if2) < 0) {
+    if (ioctl(sock, SIOCGIFMTU, (char *)&if2, sizeof(if2)) < 0) {
         NET_ThrowByNameWithLastError
             (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFMTU) failed");
         return -1;
@@ -2401,7 +2401,7 @@ static int getFlags(int sock, const char *ifname, int *flags) {
     memset((char *)&if2, 0, sizeof(if2));
     strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
 
-    if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
+    if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2, sizeof(if2)) < 0) {
         return -1;
     }
 
-- 
2.28.0

