1 /*
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <string.h>
29 #include <netinet/in.h>
30 #include <netinet/tcp.h>
31
32 #include "jni.h"
33 #include "jni_util.h"
34 #include "jvm.h"
35 #include "jlong.h"
36 #include "sun_nio_ch_Net.h"
37 #include "net_util.h"
38 #include "net_util_md.h"
39 #include "nio_util.h"
40 #include "nio.h"
41 #include "sun_nio_ch_PollArrayWrapper.h"
42
43
44 /**
45 * IP_MULTICAST_ALL supported since 2.6.31 but may not be available at
46 * build time.
47 */
48 #ifdef __linux__
49 #ifndef IP_MULTICAST_ALL
50 #define IP_MULTICAST_ALL 49
51 #endif
52 #endif
53
54 #ifdef _ALLBSD_SOURCE
55
56 #ifndef IP_BLOCK_SOURCE
57
58 #define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
59 #define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */
60 #define IP_BLOCK_SOURCE 72 /* block a source */
61 #define IP_UNBLOCK_SOURCE 73 /* unblock a source */
62
63 #endif /* IP_BLOCK_SOURCE */
64
65 #ifndef MCAST_BLOCK_SOURCE
66
67 #define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */
68 #define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */
69 #define MCAST_BLOCK_SOURCE 84 /* block a source */
70 #define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
71
72 #endif /* MCAST_BLOCK_SOURCE */
73
74 #ifndef IPV6_ADD_MEMBERSHIP
75
76 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
77 #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
78
79 #endif /* IPV6_ADD_MEMBERSHIP */
80
81 struct my_ip_mreq_source {
82 struct in_addr imr_multiaddr;
83 struct in_addr imr_interface;
84 struct in_addr imr_sourceaddr;
85 };
86
87 struct my_group_source_req {
88 uint32_t gsr_interface; /* interface index */
89 struct sockaddr_storage gsr_group; /* group address */
90 struct sockaddr_storage gsr_source; /* source address */
91 };
106 * into group_source_req structure.
107 */
108 #ifdef AF_INET6
109 static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
110 jbyteArray source, struct my_group_source_req* req)
111 {
112 struct sockaddr_in6* sin6;
113
114 req->gsr_interface = (uint32_t)index;
115
116 sin6 = (struct sockaddr_in6*)&(req->gsr_group);
117 sin6->sin6_family = AF_INET6;
118 COPY_INET6_ADDRESS(env, group, (jbyte*)&(sin6->sin6_addr));
119
120 sin6 = (struct sockaddr_in6*)&(req->gsr_source);
121 sin6->sin6_family = AF_INET6;
122 COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
123 }
124 #endif
125
126 JNIEXPORT void JNICALL
127 Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
128 {
129 /* Here because Windows native code does need to init IDs */
130 }
131
132 JNIEXPORT jboolean JNICALL
133 Java_sun_nio_ch_Net_isIPv6Available0(JNIEnv* env, jclass cl)
134 {
135 return (ipv6_available()) ? JNI_TRUE : JNI_FALSE;
136 }
137
138 JNIEXPORT jint JNICALL
139 Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) {
140 return -1;
141 }
142
143 JNIEXPORT jboolean JNICALL
144 Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl)
145 {
458 JNIEXPORT jint JNICALL
459 Java_sun_nio_ch_Net_joinOrDrop4(JNIEnv *env, jobject this, jboolean join, jobject fdo,
460 jint group, jint interf, jint source)
461 {
462 struct ip_mreq mreq;
463 struct my_ip_mreq_source mreq_source;
464 int opt, n, optlen;
465 void* optval;
466
467 if (source == 0) {
468 mreq.imr_multiaddr.s_addr = htonl(group);
469 mreq.imr_interface.s_addr = htonl(interf);
470 opt = (join) ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP;
471 optval = (void*)&mreq;
472 optlen = sizeof(mreq);
473 } else {
474 #ifdef MACOSX
475 /* no IPv4 include-mode filtering for now */
476 return IOS_UNAVAILABLE;
477 #else
478 mreq_source.imr_multiaddr.s_addr = htonl(group);
479 mreq_source.imr_sourceaddr.s_addr = htonl(source);
480 mreq_source.imr_interface.s_addr = htonl(interf);
481 opt = (join) ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP;
482 optval = (void*)&mreq_source;
483 optlen = sizeof(mreq_source);
484 #endif
485 }
486
487 n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen);
488 if (n < 0) {
489 if (join && (errno == ENOPROTOOPT))
490 return IOS_UNAVAILABLE;
491 handleSocketError(env, errno);
492 }
493 return 0;
494 }
495
496 JNIEXPORT jint JNICALL
497 Java_sun_nio_ch_Net_blockOrUnblock4(JNIEnv *env, jobject this, jboolean block, jobject fdo,
498 jint group, jint interf, jint source)
499 {
500 #ifdef MACOSX
501 /* no IPv4 exclude-mode filtering for now */
502 return IOS_UNAVAILABLE;
503 #else
504 struct my_ip_mreq_source mreq_source;
505 int n;
506 int opt = (block) ? IP_BLOCK_SOURCE : IP_UNBLOCK_SOURCE;
507
508 mreq_source.imr_multiaddr.s_addr = htonl(group);
509 mreq_source.imr_sourceaddr.s_addr = htonl(source);
510 mreq_source.imr_interface.s_addr = htonl(interf);
511
512 n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt,
513 (void*)&mreq_source, sizeof(mreq_source));
514 if (n < 0) {
515 if (block && (errno == ENOPROTOOPT))
516 return IOS_UNAVAILABLE;
517 handleSocketError(env, errno);
518 }
519 return 0;
520 #endif
521 }
522
523 JNIEXPORT jint JNICALL
524 Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobject fdo,
525 jbyteArray group, jint index, jbyteArray source)
526 {
527 #ifdef AF_INET6
528 struct ipv6_mreq mreq6;
529 struct my_group_source_req req;
530 int opt, n, optlen;
531 void* optval;
532
533 if (source == NULL) {
534 COPY_INET6_ADDRESS(env, group, (jbyte*)&(mreq6.ipv6mr_multiaddr));
535 mreq6.ipv6mr_interface = (int)index;
536 opt = (join) ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP;
537 optval = (void*)&mreq6;
538 optlen = sizeof(mreq6);
539 } else {
540 #ifdef MACOSX
541 /* no IPv6 include-mode filtering for now */
542 return IOS_UNAVAILABLE;
543 #else
544 initGroupSourceReq(env, group, index, source, &req);
545 opt = (join) ? MCAST_JOIN_SOURCE_GROUP : MCAST_LEAVE_SOURCE_GROUP;
546 optval = (void*)&req;
547 optlen = sizeof(req);
548 #endif
549 }
550
551 n = setsockopt(fdval(env,fdo), IPPROTO_IPV6, opt, optval, optlen);
552 if (n < 0) {
553 if (join && (errno == ENOPROTOOPT))
554 return IOS_UNAVAILABLE;
555 handleSocketError(env, errno);
556 }
557 return 0;
558 #else
559 JNU_ThrowInternalError(env, "Should not get here");
560 return IOS_THROWN;
561 #endif /* AF_INET6 */
562 }
563
564 JNIEXPORT jint JNICALL
565 Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, jobject fdo,
566 jbyteArray group, jint index, jbyteArray source)
567 {
568 #ifdef AF_INET6
569 #ifdef MACOSX
570 /* no IPv6 exclude-mode filtering for now */
571 return IOS_UNAVAILABLE;
572 #else
573 struct my_group_source_req req;
574 int n;
575 int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE;
576
577 initGroupSourceReq(env, group, index, source, &req);
578
579 n = setsockopt(fdval(env,fdo), IPPROTO_IPV6, opt,
580 (void*)&req, sizeof(req));
581 if (n < 0) {
582 if (block && (errno == ENOPROTOOPT))
583 return IOS_UNAVAILABLE;
584 handleSocketError(env, errno);
585 }
586 return 0;
587 #endif
588 #else
589 JNU_ThrowInternalError(env, "Should not get here");
590 return IOS_THROWN;
591 #endif
592 }
593
594 JNIEXPORT void JNICALL
595 Java_sun_nio_ch_Net_setInterface4(JNIEnv* env, jobject this, jobject fdo, jint interf)
596 {
597 struct in_addr in;
598 socklen_t arglen = sizeof(struct in_addr);
599 int n;
600
601 in.s_addr = htonl(interf);
602
|
1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <string.h>
29 #include <netinet/in.h>
30 #include <netinet/tcp.h>
31
32 #include "jni.h"
33 #include "jni_util.h"
34 #include "jvm.h"
35 #include "jlong.h"
36 #include "sun_nio_ch_Net.h"
37 #include "net_util.h"
38 #include "net_util_md.h"
39 #include "nio_util.h"
40 #include "nio.h"
41 #include "sun_nio_ch_PollArrayWrapper.h"
42
43 #ifdef _AIX
44 #include <sys/utsname.h>
45 #endif
46
47 /**
48 * IP_MULTICAST_ALL supported since 2.6.31 but may not be available at
49 * build time.
50 */
51 #ifdef __linux__
52 #ifndef IP_MULTICAST_ALL
53 #define IP_MULTICAST_ALL 49
54 #endif
55 #endif
56
57 #if defined(_ALLBSD_SOURCE) || defined(_AIX)
58
59 #ifndef IP_BLOCK_SOURCE
60
61 #if defined(_AIX)
62
63 #define IP_BLOCK_SOURCE 58 /* Block data from a given source to a given group */
64 #define IP_UNBLOCK_SOURCE 59 /* Unblock data from a given source to a given group */
65 #define IP_ADD_SOURCE_MEMBERSHIP 60 /* Join a source-specific group */
66 #define IP_DROP_SOURCE_MEMBERSHIP 61 /* Leave a source-specific group */
67
68 #else
69
70 #define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
71 #define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */
72 #define IP_BLOCK_SOURCE 72 /* block a source */
73 #define IP_UNBLOCK_SOURCE 73 /* unblock a source */
74
75 #endif /* _AIX */
76
77 #endif /* IP_BLOCK_SOURCE */
78
79 #ifndef MCAST_BLOCK_SOURCE
80
81 #if defined(_AIX)
82
83 #define MCAST_BLOCK_SOURCE 64
84 #define MCAST_UNBLOCK_SOURCE 65
85 #define MCAST_JOIN_SOURCE_GROUP 66
86 #define MCAST_LEAVE_SOURCE_GROUP 67
87
88 #else
89
90 #define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */
91 #define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */
92 #define MCAST_BLOCK_SOURCE 84 /* block a source */
93 #define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
94
95 #endif /* _AIX */
96
97 #endif /* MCAST_BLOCK_SOURCE */
98
99 #ifndef IPV6_ADD_MEMBERSHIP
100
101 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
102 #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
103
104 #endif /* IPV6_ADD_MEMBERSHIP */
105
106 struct my_ip_mreq_source {
107 struct in_addr imr_multiaddr;
108 struct in_addr imr_interface;
109 struct in_addr imr_sourceaddr;
110 };
111
112 struct my_group_source_req {
113 uint32_t gsr_interface; /* interface index */
114 struct sockaddr_storage gsr_group; /* group address */
115 struct sockaddr_storage gsr_source; /* source address */
116 };
131 * into group_source_req structure.
132 */
133 #ifdef AF_INET6
134 static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
135 jbyteArray source, struct my_group_source_req* req)
136 {
137 struct sockaddr_in6* sin6;
138
139 req->gsr_interface = (uint32_t)index;
140
141 sin6 = (struct sockaddr_in6*)&(req->gsr_group);
142 sin6->sin6_family = AF_INET6;
143 COPY_INET6_ADDRESS(env, group, (jbyte*)&(sin6->sin6_addr));
144
145 sin6 = (struct sockaddr_in6*)&(req->gsr_source);
146 sin6->sin6_family = AF_INET6;
147 COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
148 }
149 #endif
150
151 #ifdef _AIX
152
153 /*
154 * Checks whether or not "socket extensions for multicast source filters" is supported.
155 * Returns JNI_TRUE if it is supported, JNI_FALSE otherwise
156 */
157 static jboolean isSourceFilterSupported(){
158 static jboolean alreadyChecked = JNI_FALSE;
159 static jboolean result = JNI_TRUE;
160 if (alreadyChecked != JNI_TRUE){
161 struct utsname uts;
162 memset(&uts, 0, sizeof(uts));
163 strcpy(uts.sysname, "?");
164 const int utsRes = uname(&uts);
165 int major = -1;
166 int minor = -1;
167 major = atoi(uts.version);
168 minor = atoi(uts.release);
169 if (strcmp(uts.sysname, "AIX") == 0) {
170 if (major < 6 || (major == 6 && minor < 1)) {// unsupported on aix < 6.1
171 result = JNI_FALSE;
172 }
173 }
174 alreadyChecked = JNI_TRUE;
175 }
176 return result;
177 }
178
179 #endif /* _AIX */
180
181 JNIEXPORT void JNICALL
182 Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
183 {
184 /* Here because Windows native code does need to init IDs */
185 }
186
187 JNIEXPORT jboolean JNICALL
188 Java_sun_nio_ch_Net_isIPv6Available0(JNIEnv* env, jclass cl)
189 {
190 return (ipv6_available()) ? JNI_TRUE : JNI_FALSE;
191 }
192
193 JNIEXPORT jint JNICALL
194 Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) {
195 return -1;
196 }
197
198 JNIEXPORT jboolean JNICALL
199 Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl)
200 {
513 JNIEXPORT jint JNICALL
514 Java_sun_nio_ch_Net_joinOrDrop4(JNIEnv *env, jobject this, jboolean join, jobject fdo,
515 jint group, jint interf, jint source)
516 {
517 struct ip_mreq mreq;
518 struct my_ip_mreq_source mreq_source;
519 int opt, n, optlen;
520 void* optval;
521
522 if (source == 0) {
523 mreq.imr_multiaddr.s_addr = htonl(group);
524 mreq.imr_interface.s_addr = htonl(interf);
525 opt = (join) ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP;
526 optval = (void*)&mreq;
527 optlen = sizeof(mreq);
528 } else {
529 #ifdef MACOSX
530 /* no IPv4 include-mode filtering for now */
531 return IOS_UNAVAILABLE;
532 #else
533
534 #ifdef _AIX
535 /* check AIX for support of source filtering */
536 if (isSourceFilterSupported() != JNI_TRUE){
537 return IOS_UNAVAILABLE;
538 }
539 #endif
540
541 mreq_source.imr_multiaddr.s_addr = htonl(group);
542 mreq_source.imr_sourceaddr.s_addr = htonl(source);
543 mreq_source.imr_interface.s_addr = htonl(interf);
544 opt = (join) ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP;
545 optval = (void*)&mreq_source;
546 optlen = sizeof(mreq_source);
547 #endif
548 }
549
550 n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen);
551 if (n < 0) {
552 if (join && (errno == ENOPROTOOPT || errno == EOPNOTSUPP))
553 return IOS_UNAVAILABLE;
554 handleSocketError(env, errno);
555 }
556 return 0;
557 }
558
559 JNIEXPORT jint JNICALL
560 Java_sun_nio_ch_Net_blockOrUnblock4(JNIEnv *env, jobject this, jboolean block, jobject fdo,
561 jint group, jint interf, jint source)
562 {
563 #ifdef MACOSX
564 /* no IPv4 exclude-mode filtering for now */
565 return IOS_UNAVAILABLE;
566 #else
567 struct my_ip_mreq_source mreq_source;
568 int n;
569 int opt = (block) ? IP_BLOCK_SOURCE : IP_UNBLOCK_SOURCE;
570
571 #ifdef _AIX
572 /* check AIX for support of source filtering */
573 if (isSourceFilterSupported() != JNI_TRUE){
574 return IOS_UNAVAILABLE;
575 }
576 #endif
577
578 mreq_source.imr_multiaddr.s_addr = htonl(group);
579 mreq_source.imr_sourceaddr.s_addr = htonl(source);
580 mreq_source.imr_interface.s_addr = htonl(interf);
581
582 n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt,
583 (void*)&mreq_source, sizeof(mreq_source));
584 if (n < 0) {
585 if (block && (errno == ENOPROTOOPT || errno == EOPNOTSUPP))
586 return IOS_UNAVAILABLE;
587 handleSocketError(env, errno);
588 }
589 return 0;
590 #endif
591 }
592
593 JNIEXPORT jint JNICALL
594 Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobject fdo,
595 jbyteArray group, jint index, jbyteArray source)
596 {
597 #ifdef AF_INET6
598 struct ipv6_mreq mreq6;
599 struct my_group_source_req req;
600 int opt, n, optlen;
601 void* optval;
602
603 if (source == NULL) {
604 COPY_INET6_ADDRESS(env, group, (jbyte*)&(mreq6.ipv6mr_multiaddr));
605 mreq6.ipv6mr_interface = (int)index;
606 opt = (join) ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP;
607 optval = (void*)&mreq6;
608 optlen = sizeof(mreq6);
609 } else {
610 #ifdef MACOSX
611 /* no IPv6 include-mode filtering for now */
612 return IOS_UNAVAILABLE;
613 #else
614 initGroupSourceReq(env, group, index, source, &req);
615 opt = (join) ? MCAST_JOIN_SOURCE_GROUP : MCAST_LEAVE_SOURCE_GROUP;
616 optval = (void*)&req;
617 optlen = sizeof(req);
618 #endif
619 }
620
621 n = setsockopt(fdval(env,fdo), IPPROTO_IPV6, opt, optval, optlen);
622 if (n < 0) {
623 if (join && (errno == ENOPROTOOPT || errno == EOPNOTSUPP))
624 return IOS_UNAVAILABLE;
625 handleSocketError(env, errno);
626 }
627 return 0;
628 #else
629 JNU_ThrowInternalError(env, "Should not get here");
630 return IOS_THROWN;
631 #endif /* AF_INET6 */
632 }
633
634 JNIEXPORT jint JNICALL
635 Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, jobject fdo,
636 jbyteArray group, jint index, jbyteArray source)
637 {
638 #ifdef AF_INET6
639 #ifdef MACOSX
640 /* no IPv6 exclude-mode filtering for now */
641 return IOS_UNAVAILABLE;
642 #else
643 struct my_group_source_req req;
644 int n;
645 int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE;
646
647 initGroupSourceReq(env, group, index, source, &req);
648
649 n = setsockopt(fdval(env,fdo), IPPROTO_IPV6, opt,
650 (void*)&req, sizeof(req));
651 if (n < 0) {
652 if (block && (errno == ENOPROTOOPT || errno == EOPNOTSUPP))
653 return IOS_UNAVAILABLE;
654 handleSocketError(env, errno);
655 }
656 return 0;
657 #endif
658 #else
659 JNU_ThrowInternalError(env, "Should not get here");
660 return IOS_THROWN;
661 #endif
662 }
663
664 JNIEXPORT void JNICALL
665 Java_sun_nio_ch_Net_setInterface4(JNIEnv* env, jobject this, jobject fdo, jint interf)
666 {
667 struct in_addr in;
668 socklen_t arglen = sizeof(struct in_addr);
669 int n;
670
671 in.s_addr = htonl(interf);
672
|