mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-27 12:05:15 +00:00
always send replys to P packets
This commit is contained in:
parent
08ecccc7fe
commit
92a791f430
@ -158,10 +158,10 @@ tunnel_dns(int tun_fd, int dns_fd)
|
|||||||
if (userid >= 0) {
|
if (userid >= 0) {
|
||||||
users[userid].seed = rand();
|
users[userid].seed = rand();
|
||||||
memcpy(&(users[userid].host), &(dummy.q.from), dummy.q.fromlen);
|
memcpy(&(users[userid].host), &(dummy.q.from), dummy.q.fromlen);
|
||||||
users[userid].addrlen = dummy.q.fromlen;
|
|
||||||
memcpy(&(users[userid].q), &(dummy.q), sizeof(struct query));
|
memcpy(&(users[userid].q), &(dummy.q), sizeof(struct query));
|
||||||
users[userid].q.id = 0;
|
users[userid].addrlen = dummy.q.fromlen;
|
||||||
send_version_response(dns_fd, VERSION_ACK, users[userid].seed, &users[userid]);
|
send_version_response(dns_fd, VERSION_ACK, users[userid].seed, &users[userid]);
|
||||||
|
users[userid].q.id = 0;
|
||||||
} else {
|
} else {
|
||||||
/* No space for another user */
|
/* No space for another user */
|
||||||
send_version_response(dns_fd, VERSION_FULL, USERS, &dummy);
|
send_version_response(dns_fd, VERSION_FULL, USERS, &dummy);
|
||||||
@ -180,8 +180,6 @@ tunnel_dns(int tun_fd, int dns_fd)
|
|||||||
return 0; /* illegal id */
|
return 0; /* illegal id */
|
||||||
}
|
}
|
||||||
users[userid].last_pkt = time(NULL);
|
users[userid].last_pkt = time(NULL);
|
||||||
memcpy(&(users[userid].q), &(dummy.q), sizeof(struct query));
|
|
||||||
users[userid].q.id = 0;
|
|
||||||
login_calculate(logindata, 16, password, users[userid].seed);
|
login_calculate(logindata, 16, password, users[userid].seed);
|
||||||
|
|
||||||
if (dummy.q.fromlen != users[userid].addrlen ||
|
if (dummy.q.fromlen != users[userid].addrlen ||
|
||||||
@ -215,6 +213,7 @@ tunnel_dns(int tun_fd, int dns_fd)
|
|||||||
write_dns(dns_fd, &(dummy.q), "BADIP", 5);
|
write_dns(dns_fd, &(dummy.q), "BADIP", 5);
|
||||||
return 0; /* illegal id */
|
return 0; /* illegal id */
|
||||||
}
|
}
|
||||||
|
memcpy(&(users[userid].q), &(dummy.q), sizeof(struct query));
|
||||||
users[userid].last_pkt = time(NULL);
|
users[userid].last_pkt = time(NULL);
|
||||||
} else if((in[0] >= '0' && in[0] <= '9')
|
} else if((in[0] >= '0' && in[0] <= '9')
|
||||||
|| (in[0] >= 'a' && in[0] <= 'f')
|
|| (in[0] >= 'a' && in[0] <= 'f')
|
||||||
@ -262,7 +261,7 @@ tunnel_dns(int tun_fd, int dns_fd)
|
|||||||
|
|
||||||
write_dns(dns_fd, &(dummy.q), users[userid].outpacket.data, users[userid].outpacket.len);
|
write_dns(dns_fd, &(dummy.q), users[userid].outpacket.data, users[userid].outpacket.len);
|
||||||
users[userid].outpacket.len = 0;
|
users[userid].outpacket.len = 0;
|
||||||
dummy.q.id = 0;
|
users[userid].q.id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -287,8 +286,9 @@ tunnel(int tun_fd, int dns_fd)
|
|||||||
|
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
/* TODO : use some kind of packet queue */
|
/* TODO : use some kind of packet queue */
|
||||||
if(!all_users_waiting_to_send())
|
if(!all_users_waiting_to_send()) {
|
||||||
FD_SET(tun_fd, &fds);
|
FD_SET(tun_fd, &fds);
|
||||||
|
}
|
||||||
FD_SET(dns_fd, &fds);
|
FD_SET(dns_fd, &fds);
|
||||||
|
|
||||||
i = select(MAX(tun_fd, dns_fd) + 1, &fds, NULL, NULL, &tv);
|
i = select(MAX(tun_fd, dns_fd) + 1, &fds, NULL, NULL, &tv);
|
||||||
|
Loading…
Reference in New Issue
Block a user