mirror of
https://gitlab.com/Monsterovich/lanemu.git
synced 2024-07-07 06:01:16 +02:00
More tuntap refactoring
This commit is contained in:
parent
4c2393d36a
commit
6967b8f80b
|
@ -103,7 +103,7 @@ JFUNC(jint, openTun) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ioctl(fd, TAPGIFNAME, (void*)&ifr) < 0) {
|
||||
if (ioctl(fd, TAPGIFNAME, &ifr) < 0) {
|
||||
close(fd);
|
||||
printf("error: ioctl(TAPGIFNAME)\n");
|
||||
return 1;
|
||||
|
@ -113,7 +113,7 @@ JFUNC(jint, openTun) {
|
|||
|
||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
||||
|
||||
if (ioctl(fd, TUNSETIFF, (void*)&ifr) < 0) {
|
||||
if (ioctl(fd, TUNSETIFF, &ifr) < 0) {
|
||||
close(fd);
|
||||
printf("error: ioctl(TUNSETIFF)\n");
|
||||
return 1;
|
||||
|
@ -136,6 +136,7 @@ JFUNC(void, write, jbyteArray jb, jint len) {
|
|||
fd = getFd(env, this);
|
||||
b = (*env)->GetByteArrayElements(env, jb, NULL);
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
||||
write(fd, b, len);
|
||||
|
||||
(*env)->ReleaseByteArrayElements(env, jb, b, JNI_ABORT);
|
||||
|
|
|
@ -91,7 +91,7 @@ int findTapDevice(char *deviceID, int deviceIDLen, char *deviceName, int deviceN
|
|||
status = RegQueryValueEx(key, "ComponentId", NULL, NULL, componentId, &len);
|
||||
if (status == ERROR_SUCCESS &&
|
||||
strncmp(componentId, TAP_COMPONENT_ID_PREFIX, strlen(TAP_COMPONENT_ID_PREFIX)) == 0) {
|
||||
if (skip<1) {
|
||||
if (skip < 1) {
|
||||
len = deviceIDLen;
|
||||
RegQueryValueEx(key, "NetCfgInstanceId", NULL, NULL, deviceID, &len);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue