comparison src/solaris/native/java/net/net_util_md.c @ 6685:95eeca6dc691

8015743: Address internet addresses Summary: moved Inet6Address fields to holder class Reviewed-by: chegar, alanb, skoivu, khazra
author michaelm
date Wed, 03 Jul 2013 17:54:38 +0100
parents eefd9678efbd
children b5326675e374 e935cd4139c6
comparison
equal deleted inserted replaced
21:dc34b43ac4c9 23:98d0dac8173b
821 family = getInetAddress_family(env, iaObj); 821 family = getInetAddress_family(env, iaObj);
822 #ifdef AF_INET6 822 #ifdef AF_INET6
823 /* needs work. 1. family 2. clean up him6 etc deallocate memory */ 823 /* needs work. 1. family 2. clean up him6 etc deallocate memory */
824 if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) { 824 if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) {
825 struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him; 825 struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
826 jbyteArray ipaddress;
827 jbyte caddr[16]; 826 jbyte caddr[16];
828 jint address; 827 jint address;
829 828
830 829
831 if (family == IPv4) { /* will convert to IPv4-mapped address */ 830 if (family == IPv4) { /* will convert to IPv4-mapped address */
842 caddr[13] = ((address >> 16) & 0xff); 841 caddr[13] = ((address >> 16) & 0xff);
843 caddr[14] = ((address >> 8) & 0xff); 842 caddr[14] = ((address >> 8) & 0xff);
844 caddr[15] = (address & 0xff); 843 caddr[15] = (address & 0xff);
845 } 844 }
846 } else { 845 } else {
847 ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); 846 getInet6Address_ipaddress(env, iaObj, (char *)caddr);
848 (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
849 } 847 }
850 memset((char *)him6, 0, sizeof(struct sockaddr_in6)); 848 memset((char *)him6, 0, sizeof(struct sockaddr_in6));
851 him6->sin6_port = htons(port); 849 him6->sin6_port = htons(port);
852 memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) ); 850 memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) );
853 him6->sin6_family = AF_INET6; 851 him6->sin6_family = AF_INET6;
880 /* if cached value exists then use it. Otherwise, check 878 /* if cached value exists then use it. Otherwise, check
881 * if scope is set in the address. 879 * if scope is set in the address.
882 */ 880 */
883 if (!cached_scope_id) { 881 if (!cached_scope_id) {
884 if (ia6_scopeidID) { 882 if (ia6_scopeidID) {
885 scope_id = (int)(*env)->GetIntField(env,iaObj,ia6_scopeidID); 883 scope_id = getInet6Address_scopeid(env, iaObj);
886 } 884 }
887 if (scope_id != 0) { 885 if (scope_id != 0) {
888 /* check user-specified value for loopback case 886 /* check user-specified value for loopback case
889 * that needs to be overridden 887 * that needs to be overridden
890 */ 888 */
926 #else 924 #else
927 /* handle scope_id for solaris */ 925 /* handle scope_id for solaris */
928 926
929 if (family != IPv4) { 927 if (family != IPv4) {
930 if (ia6_scopeidID) { 928 if (ia6_scopeidID) {
931 him6->sin6_scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_scopeidID); 929 him6->sin6_scope_id = getInet6Address_scopeid(env, iaObj);
932 } 930 }
933 } 931 }
934 #endif 932 #endif
935 } else 933 } else
936 #endif /* AF_INET6 */ 934 #endif /* AF_INET6 */