Autotest for netpacket/packet.h, as it is not available on all Linux versions.
Depend AF_PACKET on HAVE_NETPACKET_PACKET_H. Fixes #449157
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 91013a1..f4c5726 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -179,7 +179,7 @@
#undef AF_UNIX
#endif
-#if defined(linux) && defined(AF_PACKET)
+#ifdef HAVE_NETPACKET_PACKET_H
#include <sys/ioctl.h>
#include <net/if.h>
#include <netpacket/packet.h>
@@ -476,7 +476,7 @@
struct sockaddr_in6 in6;
struct sockaddr_storage storage;
#endif
-#if defined(linux) && defined(AF_PACKET)
+#ifdef HAVE_NETPACKET_PACKET_H
struct sockaddr_ll ll;
#endif
} sock_addr;
@@ -715,7 +715,7 @@
}
#endif
-#if defined(linux) && defined(AF_PACKET)
+#ifdef HAVE_NETPACKET_PACKET_H
case AF_PACKET:
{
struct sockaddr_ll *a = (struct sockaddr_ll *)addr;
@@ -828,7 +828,7 @@
}
#endif
-#if defined(linux) && defined(AF_PACKET)
+#ifdef HAVE_NETPACKET_PACKET_H
case AF_PACKET:
{
struct sockaddr_ll* addr;
@@ -901,7 +901,7 @@
}
#endif
-#if defined(linux) && defined(AF_PACKET)
+#ifdef HAVE_NETPACKET_PACKET_H
case AF_PACKET:
{
*len_ret = sizeof (struct sockaddr_ll);
@@ -2983,7 +2983,7 @@
#ifdef AF_ROSE
insint(d, "AF_ROSE", AF_ROSE); /* Amateur Radio X.25 PLP */
#endif
-#if defined(linux) && defined(AF_PACKET)
+#ifdef HAVE_NETPACKET_PACKET_H
insint(d, "AF_PACKET", AF_PACKET);
insint(d, "PF_PACKET", PF_PACKET);
insint(d, "PACKET_HOST", PACKET_HOST);