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).
This commit is contained in:
Guido van Rossum 1998-05-28 20:18:18 +00:00
parent 617c1b0116
commit 578de30fd7

View File

@ -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);