From 41bc2a63e25061d6d8c6a71a2c4a68785404c460 Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 24 Jul 2026 21:15:54 +0900 Subject: [PATCH] qtbase: durable patch for struct ifreq on Redox (6.11.1) qnetworkinterface_unix.cpp getifaddrs path declares `struct ifreq ifr` to pass to getMtu(), but Redox relibc provides only interface flags and the if_nameindex() helpers -- no struct ifreq (Redox has no SIOCGIF* ioctls). The SIOCGIFMTU body in getMtu() is #ifdef-guarded and compiles out, so the type only needs to be complete. Define a minimal-but-standard struct ifreq under #if defined(__redox__) at file scope; the ioctls that would use it fail gracefully at runtime (mtu stays 0). Durable patch, wired into qtbase recipe. --- local/recipes/qt/qtbase/recipe.toml | 1 + .../qt/qtbase/redox-ifreq-struct.patch | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 local/recipes/qt/qtbase/redox-ifreq-struct.patch diff --git a/local/recipes/qt/qtbase/recipe.toml b/local/recipes/qt/qtbase/recipe.toml index 1bacaf2745..8bcc7a5856 100644 --- a/local/recipes/qt/qtbase/recipe.toml +++ b/local/recipes/qt/qtbase/recipe.toml @@ -14,6 +14,7 @@ patches = [ "qtwaylandscanner-null-guard-listeners.patch", "redox-in6-pktinfo.patch", "redox-forkfd-rusage-scope.patch", + "redox-ifreq-struct.patch", ] [build] diff --git a/local/recipes/qt/qtbase/redox-ifreq-struct.patch b/local/recipes/qt/qtbase/redox-ifreq-struct.patch new file mode 100644 index 0000000000..b5ebacbfb5 --- /dev/null +++ b/local/recipes/qt/qtbase/redox-ifreq-struct.patch @@ -0,0 +1,39 @@ +--- a/src/network/kernel/qnetworkinterface_unix.cpp ++++ b/src/network/kernel/qnetworkinterface_unix.cpp +@@ -31,6 +31,36 @@ + + #include + ++#if defined(__redox__) ++// Redox relibc's declares the interface flags and if_nameindex() ++// helpers but not struct ifreq (there is no SIOCGIF* ioctl support on Redox). ++// The getifaddrs path below still declares a `struct ifreq` to pass to ++// getMtu(); the SIOCGIFMTU body is #ifdef-guarded and compiles out, so this ++// only needs to be a complete type. Provide a minimal-but-standard layout so ++// the network module builds; the ioctls that would use it fail gracefully at ++// runtime (mtu stays 0). ++# ifndef IFNAMSIZ ++# define IFNAMSIZ 16 ++# endif ++struct ifreq { ++ char ifr_name[IFNAMSIZ]; ++ union { ++ struct sockaddr ifr_addr; ++ struct sockaddr ifr_dstaddr; ++ struct sockaddr ifr_broadaddr; ++ struct sockaddr ifr_netmask; ++ struct sockaddr ifr_hwaddr; ++ short ifr_flags; ++ int ifr_ifindex; ++ int ifr_metric; ++ int ifr_mtu; ++ char ifr_slave[IFNAMSIZ]; ++ char ifr_newname[IFNAMSIZ]; ++ char *ifr_data; ++ }; ++}; ++#endif // __redox__ ++ + QT_BEGIN_NAMESPACE + + static QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex = 0, const QString &ifname = QString())