From 578de30fd71c592ff434d7fe238a1f657a3802f4 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 28 May 1998 20:18:18 +0000 Subject: [PATCH] Some systems (e.g. Linux) use enums for some symbols (like IPPROTO_IP) so that our #ifdef test has the wrong effect. Substitute hardcoded values for some important symbols (but not for the whole range -- some are pretty obscure so it's not worth it). --- Modules/socketmodule.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 92001df2fd7..c200b2dd923 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1668,14 +1668,19 @@ initsocket() #endif /* Protocol level and numbers, usable for [gs]etsockopt */ +/* Sigh -- some systems (e.g. Linux) use enums for these. */ #ifdef SOL_SOCKET insint(d, "SOL_SOCKET", SOL_SOCKET); #endif #ifdef IPPROTO_IP insint(d, "IPPROTO_IP", IPPROTO_IP); +#else + insint(d, "IPPROTO_IP", 0); #endif #ifdef IPPROTO_ICMP insint(d, "IPPROTO_ICMP", IPPROTO_ICMP); +#else + insint(d, "IPPROTO_ICMP", 1); #endif #ifdef IPPROTO_IGMP insint(d, "IPPROTO_IGMP", IPPROTO_IGMP); @@ -1685,6 +1690,8 @@ initsocket() #endif #ifdef IPPROTO_TCP insint(d, "IPPROTO_TCP", IPPROTO_TCP); +#else + insint(d, "IPPROTO_TCP", 6); #endif #ifdef IPPROTO_EGP insint(d, "IPPROTO_EGP", IPPROTO_EGP); @@ -1694,6 +1701,8 @@ initsocket() #endif #ifdef IPPROTO_UDP insint(d, "IPPROTO_UDP", IPPROTO_UDP); +#else + insint(d, "IPPROTO_UDP", 17); #endif #ifdef IPPROTO_IDP insint(d, "IPPROTO_IDP", IPPROTO_IDP); @@ -1719,6 +1728,8 @@ initsocket() /**/ #ifdef IPPROTO_RAW insint(d, "IPPROTO_RAW", IPPROTO_RAW); +#else + insint(d, "IPPROTO_RAW", 255); #endif #ifdef IPPROTO_MAX insint(d, "IPPROTO_MAX", IPPROTO_MAX);