https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5454

Index: gio/tests/iptosmessage.c
--- gio/tests/iptosmessage.c.orig
+++ gio/tests/iptosmessage.c
@@ -20,6 +20,8 @@
  * Authors: Jakub Adam <jakub.adam@collabora.com>
  */
 
+#include "config.h"
+
 #include <gio/gio.h>
 #include <gio/giptosmessage.h>
 #include <gio/gnetworking.h>
@@ -69,7 +71,9 @@ send_recv_control_message (GSocketFamily family, GSock
 
   if (family == G_SOCKET_FAMILY_IPV4)
     {
+#ifdef HAVE_IP_RECVTOS
       g_socket_set_option (rsock, IPPROTO_IP, IP_RECVTOS, 1, &error);
+#endif
     }
   else
     {
@@ -114,12 +118,8 @@ test_ip_tos (void)
   g_test_skip ("GSocketControlMessage not supported on Windows.");
 #elif defined(__APPLE__)
   g_test_skip ("IP_TOS not supported on macOS.");
-#elif defined(__GNU__)
-  g_test_skip ("IP_RECVTOS not supported on Hurd");
-#elif defined(_AIX)
-  g_test_skip ("IP_RECVTOS not supported on AIX");
-#elif defined(__sun__)
-  g_test_skip ("IP_RECVTOS not supported on Solaris");
+#elif !defined(HAVE_IP_RECVTOS)
+  g_test_skip ("IP_RECVTOS not supported on this platform");
 #else
   GIPTosMessage *smsg;
   GIPTosMessage *rmsg;
