summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-12-05 01:36:04 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-22 00:02:36 -0800
commit3a1ff175e8ec737bd945bed6574052916693b5f6 (patch)
treebf055b26cd40ad0bfae5ad1f67e769113021f933 /Kernel
parent3080cc16ec954040e98b5c7a3f78cee50b9e5385 (diff)
downloadserenity-3a1ff175e8ec737bd945bed6574052916693b5f6.zip
Kernel: Define and return the ARPHRD_* device type in SIOCGIFHWADDR
The sa_family field in SIOCGIFHWADDR specifies the underlying network interface's device type, this is hardcoded to generic "Ethernet" right now, as we don't have a nice way to query it.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/API/POSIX/net/if_arp.h8
-rw-r--r--Kernel/Net/IPv4Socket.cpp2
2 files changed, 9 insertions, 1 deletions
diff --git a/Kernel/API/POSIX/net/if_arp.h b/Kernel/API/POSIX/net/if_arp.h
index ff5d08af73..5ac1555b17 100644
--- a/Kernel/API/POSIX/net/if_arp.h
+++ b/Kernel/API/POSIX/net/if_arp.h
@@ -21,6 +21,14 @@ struct arpreq {
char arp_dev[16];
};
+#define ARPHRD_ETHER 1
+#define ARPHRD_IEEE802 6
+#define ARPHRD_SLIP 256
+#define ARPHRD_PPP 512
+#define ARPHRD_LOOPBACK 772
+#define ARPHRD_FDDI 774
+#define ARPHRD_IEEE802_TR 800
+
#ifdef __cplusplus
}
#endif
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index b0b03dc037..d51f4d3258 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -712,7 +712,7 @@ ErrorOr<void> IPv4Socket::ioctl(OpenFileDescription&, unsigned request, Userspac
case SIOCGIFHWADDR: {
auto mac_address = adapter->mac_address();
- ifr.ifr_hwaddr.sa_family = AF_INET;
+ ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; // FIXME: Query the underlying network interface for it's type
mac_address.copy_to(Bytes { ifr.ifr_hwaddr.sa_data, sizeof(ifr.ifr_hwaddr.sa_data) });
return copy_to_user(user_ifr, &ifr);
}