Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b156a46

Browse files
committed
Issue #8852: Allow the socket module to build on OpenSolaris.
1 parent 71f8cc9 commit b156a46

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ Tests
184184
Build
185185
-----
186186

187+
- Issue #8852: Allow the socket module to build on OpenSolaris.
188+
187189
- Drop -OPT:Olimit compiler option.
188190

189191
- Issue #10094: Use versioned .so files on GNU/kfreeBSD and the GNU Hurd.

Modules/socketmodule.c

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
11391139
}
11401140
#endif
11411141

1142-
#ifdef HAVE_NETPACKET_PACKET_H
1142+
#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFNAME)
11431143
case AF_PACKET:
11441144
{
11451145
struct sockaddr_ll *a = (struct sockaddr_ll *)addr;
@@ -1455,7 +1455,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
14551455
}
14561456
#endif
14571457

1458-
#ifdef HAVE_NETPACKET_PACKET_H
1458+
#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFINDEX)
14591459
case AF_PACKET:
14601460
{
14611461
struct sockaddr_ll* addr;
@@ -4569,16 +4569,32 @@ PyInit__socket(void)
45694569
PyModule_AddStringConstant(m, "BDADDR_LOCAL", "00:00:00:FF:FF:FF");
45704570
#endif
45714571

4572-
#ifdef HAVE_NETPACKET_PACKET_H
4573-
PyModule_AddIntConstant(m, "AF_PACKET", AF_PACKET);
4574-
PyModule_AddIntConstant(m, "PF_PACKET", PF_PACKET);
4575-
PyModule_AddIntConstant(m, "PACKET_HOST", PACKET_HOST);
4576-
PyModule_AddIntConstant(m, "PACKET_BROADCAST", PACKET_BROADCAST);
4577-
PyModule_AddIntConstant(m, "PACKET_MULTICAST", PACKET_MULTICAST);
4578-
PyModule_AddIntConstant(m, "PACKET_OTHERHOST", PACKET_OTHERHOST);
4579-
PyModule_AddIntConstant(m, "PACKET_OUTGOING", PACKET_OUTGOING);
4580-
PyModule_AddIntConstant(m, "PACKET_LOOPBACK", PACKET_LOOPBACK);
4581-
PyModule_AddIntConstant(m, "PACKET_FASTROUTE", PACKET_FASTROUTE);
4572+
#ifdef AF_PACKET
4573+
PyModule_AddIntMacro(m, AF_PACKET);
4574+
#endif
4575+
#ifdef PF_PACKET
4576+
PyModule_AddIntMacro(m, PF_PACKET);
4577+
#endif
4578+
#ifdef PACKET_HOST
4579+
PyModule_AddIntMacro(m, PACKET_HOST);
4580+
#endif
4581+
#ifdef PACKET_BROADCAST
4582+
PyModule_AddIntMacro(m, PACKET_BROADCAST);
4583+
#endif
4584+
#ifdef PACKET_MULTICAST
4585+
PyModule_AddIntMacro(m, PACKET_MULTICAST);
4586+
#endif
4587+
#ifdef PACKET_OTHERHOST
4588+
PyModule_AddIntMacro(m, PACKET_OTHERHOST);
4589+
#endif
4590+
#ifdef PACKET_OUTGOING
4591+
PyModule_AddIntMacro(m, PACKET_OUTGOING);
4592+
#endif
4593+
#ifdef PACKET_LOOPBACK
4594+
PyModule_AddIntMacro(m, PACKET_LOOPBACK);
4595+
#endif
4596+
#ifdef PACKET_FASTROUTE
4597+
PyModule_AddIntMacro(m, PACKET_FASTROUTE);
45824598
#endif
45834599

45844600
#ifdef HAVE_LINUX_TIPC_H

0 commit comments

Comments
 (0)