Skip to content

Instantly share code, notes, and snippets.

@n8fr8
Created January 31, 2022 15:01
Show Gist options
  • Save n8fr8/1c7b80f54408f7b1aad16fe56013510a to your computer and use it in GitHub Desktop.
Save n8fr8/1c7b80f54408f7b1aad16fe56013510a to your computer and use it in GitHub Desktop.
JNIEXPORT jint JNICALL Java_org_torproject_android_service_vpn_Tun2Socks_processDnsPacket(
jclass cls,
JNIEnv* env,
jbyteArray array,
jint dataLength)
{
jsize num_bytes = (*env)->GetArrayLength(env, array);
printf("Byte length : %d\n" , num_bytes);
unsigned char * buffer;
jbyte *lib ;
lib =(jbyte *) malloc( ( num_bytes +1 ) * sizeof(jbyte));
jbyte* dataPtr = (*env)->GetByteArrayElements(env, datapacket, NULL);
process_device_dns_packet ((uint8_t *)dataPtr, dataLength);
(*env)->ReleaseByteArrayElements(env, datapacket, JNI_ABORT);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment