-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libnet: ipv6_support: skip some checks to provide android ipv6 support (for android 10 and newer) #26
libnet: ipv6_support: skip some checks to provide android ipv6 support (for android 10 and newer) #26
Conversation
i waited it for 1 term |
you can check the test build at my fork's action if you know how to import runtime ;) |
yes |
yes it was working just now!! thank you very much. |
It isn't working on my Android 8.1 device With an address that link to an IPv6 address: Direct connect to an IPv6 address: edit: I have placed the images to the wrong place, so I fixed it. |
well, i've just tested on another device i have (android 13, kernel 4.19) with vanilla 1.12.2 installed, and it's working.
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define JNI_TRUE 1
#define JNI_FALSE 0
typedef union {
struct sockaddr sa;
struct sockaddr_in sa4;
struct sockaddr_in6 sa6;
} SOCKETADDRESS;
void ipv6_supported();
int main() {
ipv6_supported();
return 0;
}
void ipv6_supported()
{
int fd;
void *ipv6_fn;
SOCKETADDRESS sa;
socklen_t sa_len = sizeof(SOCKETADDRESS);
fd = socket(AF_INET6, SOCK_STREAM, 0) ;
if (fd < 0) {
/*
* TODO: We really cant tell since it may be an unrelated error
* for now we will assume that AF_INET6 is not available
*/
fprintf(stderr, "socket AF_INET6 failed!\n");
}
/*
* If fd 0 is a socket it means we may have been launched from inetd or
* xinetd. If it's a socket then check the family - if it's an
* IPv4 socket then we need to disable IPv6.
*/
if (getsockname(0, &sa.sa, &sa_len) == 0) {
if (sa.sa.sa_family == AF_INET) {
close(fd);
fprintf(stderr, "getsockname is not AF_INET6!\n");
}
}
/**
* Linux - check if any interface has an IPv6 address.
* Don't need to parse the line - we just need an indication.
*/
#ifdef __linux__
{
FILE *fP = fopen("/proc/net/if_inet6", "r");
char buf[255];
char *bufP;
if (fP == NULL) {
close(fd);
fprintf(stderr, "Cannot open /proc/net/if_inet6!\n");
fprintf(stderr, "Skip buffer check for ENOENT\n");
return;
}
bufP = fgets(buf, sizeof(buf), fP);
fclose(fP);
if (bufP == NULL) {
close(fd);
fprintf(stderr, "buffer of /proc/net/if_inet6 is NULL!\n");
}
}
#endif
/*
* OK we may have the stack available in the kernel,
* we should also check if the APIs are available.
*/
// ipv6_fn = JVM_FindLibraryEntry(RTLD_DEFAULT, "inet_pton");
// if (ipv6_fn == NULL ) {
// return JNI_FALSE;
// } else {
// return JNI_TRUE;
// }
close(fd);
printf("IPv6 is supported!\n");
} (you can get Termux app which should still be able to support android 8 to compile and run it, if you don't know how to use host ndk to cross-build it (me neither))
|
Others: the compile log of the test code
|
oh there are some mistakes in the code :( please include a new file at the head of file one more thing: try the jvm arg: |
Thank you for the Pull request @nexplorer-3e ! Side note: your PR only targets one java version here, java 17. chances are similar patches might be needed for 21 and 8 |
Oh thank you if your guy can just fix a tag in clone-jdk.sh that might be great |
I have tested again on Huawei DUB-AL00 device and export these informations:
the full logs is too long to show in there, so I created a gist to store them: <deleted> Anyway, working with different devices is hard. If you know how to make it work on my device, that would be very much appreciated! edit: the log has been deleted |
|
in your logcat:
this ioctlcmd points to
in the next few day i need to deal with my college homework so the progress may be slower another thing is i managed to get the kernel of your device via huawei open source website, but they didn't released the android device tree (aka android_device_huawei_xxx) so selinux policy is also unavailable to public. If you know how to rip the selinux policy that might be helpful (might) upd: wait i am hit by the memory of the comment in that issue, maybe there is no way but to comment |
@Silvigarabis hello can u test the new one at my repo? https://github.com/nexplorer-3e/android-openjdk-build-multiarch/actions/runs/9381245493 |
It's still not work for my device…with same error |
@nexplorer-3e The branch you're targeting via the PR got worked on a bit |
see https://android.googlesource.com/platform/libcore/+/ae218d9bdc8395ac0ed9278c86cff597915c2a7b%5E%21 this commit is subset of the changes mentioned above and should get further tests before merge into JDK.
By the way, you can split the diff into their own files. It allows you to comment the purpose of them as well |
Thank you for the PR, there was a small file called "" so I picked whatever was truly necessary. |
upd: this pr may only be able to fix read proc denied caused by selinux policy introduced around Android 10 (and affect all version newer) (ref:https://cs.android.com/android/_/android/platform/system/sepolicy/+/424517721cb71bc842cc37d82e8b61a6a4a6e00a)
THAT SAID IF U CAN RUN
cat /proc/net/if_inet6
WITHOUT ERROR BUT IPV6 STILL NOT WORKING, THAT PR MAY NOT WORK FOR YOU(for example PojavLauncherTeam/PojavLauncher#5125 (comment))
this PR should solve PojavLauncherTeam/PojavLauncher#5125 for Android version >= 10 and for those kernel doesn't restrict
socket(2)
call.(Though I don't know why just skip check without touch selinux policy would make ipv6 working, it just works on my machine and seems aosp is doing the same thing (see issue above for reference))
Maintainers may need to merge this commit to dev branch not a patch branch (or to say WIP branch).