src/solaris/native/sun/nio/ch/Net.c
Print this page
@@ -37,87 +37,10 @@
#include "net_util.h"
#include "net_util_md.h"
#include "nio_util.h"
#include "nio.h"
-/**
- * Definitions for source-specific multicast to allow for building
- * with older header files.
- */
-
-#ifdef __solaris__
-
-#ifndef IP_BLOCK_SOURCE
-
-#define IP_BLOCK_SOURCE 0x15
-#define IP_UNBLOCK_SOURCE 0x16
-#define IP_ADD_SOURCE_MEMBERSHIP 0x17
-#define IP_DROP_SOURCE_MEMBERSHIP 0x18
-
-#define MCAST_BLOCK_SOURCE 0x2b
-#define MCAST_UNBLOCK_SOURCE 0x2c
-#define MCAST_JOIN_SOURCE_GROUP 0x2d
-#define MCAST_LEAVE_SOURCE_GROUP 0x2e
-
-#endif /* IP_BLOCK_SOURCE */
-
-struct my_ip_mreq_source {
- struct in_addr imr_multiaddr;
- struct in_addr imr_sourceaddr;
- struct in_addr imr_interface;
-};
-
-/*
- * Use #pragma pack() construct to force 32-bit alignment on amd64.
- */
-#if defined(amd64)
-#pragma pack(4)
-#endif
-
-struct my_group_source_req {
- uint32_t gsr_interface; /* interface index */
- struct sockaddr_storage gsr_group; /* group address */
- struct sockaddr_storage gsr_source; /* source address */
-};
-
-#if defined(amd64)
-#pragma pack()
-#endif
-
-#endif /* __solaris__ */
-
-
-#ifdef __linux__
-
-#ifndef IP_BLOCK_SOURCE
-
-#define IP_BLOCK_SOURCE 38
-#define IP_UNBLOCK_SOURCE 37
-#define IP_ADD_SOURCE_MEMBERSHIP 39
-#define IP_DROP_SOURCE_MEMBERSHIP 40
-
-#define MCAST_BLOCK_SOURCE 43
-#define MCAST_UNBLOCK_SOURCE 44
-#define MCAST_JOIN_SOURCE_GROUP 42
-#define MCAST_LEAVE_SOURCE_GROUP 45
-
-#endif /* IP_BLOCK_SOURCE */
-
-struct my_ip_mreq_source {
- struct in_addr imr_multiaddr;
- struct in_addr imr_interface;
- struct in_addr imr_sourceaddr;
-};
-
-struct my_group_source_req {
- uint32_t gsr_interface; /* interface index */
- struct sockaddr_storage gsr_group; /* group address */
- struct sockaddr_storage gsr_source; /* source address */
-};
-
-#endif /* __linux__ */
-
#ifdef _ALLBSD_SOURCE
#ifndef IP_BLOCK_SOURCE
#define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
@@ -153,13 +76,18 @@
uint32_t gsr_interface; /* interface index */
struct sockaddr_storage gsr_group; /* group address */
struct sockaddr_storage gsr_source; /* source address */
};
-#endif /* _ALLBSD_SOURCE */
+#else /* _ALLBSD_SOURCE */
+#define my_ip_mreq_source ip_mreq_source
+#define my_group_source_req group_source_req
+#endif
+
+
#define COPY_INET6_ADDRESS(env, source, target) \
(*env)->GetByteArrayRegion(env, source, 0, 16, target)
/*
* Copy IPv6 group, interface index, and IPv6 source address
@@ -574,12 +502,12 @@
mreq6.ipv6mr_interface = (int)index;
opt = (join) ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP;
optval = (void*)&mreq6;
optlen = sizeof(mreq6);
} else {
-#if defined (__linux__) || defined(MACOSX)
- /* Include-mode filtering broken on Mac OS & Linux at least to 2.6.24 */
+#ifdef MACOSX
+ /* no IPv6 include-mode filtering for now */
return IOS_UNAVAILABLE;
#else
initGroupSourceReq(env, group, index, source, &req);
opt = (join) ? MCAST_JOIN_SOURCE_GROUP : MCAST_LEAVE_SOURCE_GROUP;
optval = (void*)&req;