mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-29 17:31:27 +00:00
#1 move saving of client ip
This commit is contained in:
parent
5733c68988
commit
8c7fb4d947
|
@ -135,9 +135,6 @@ tunnel(int tun_fd, int dns_fd)
|
||||||
strncpy(out, "VACK", sizeof(out));
|
strncpy(out, "VACK", sizeof(out));
|
||||||
memcpy(out+4, &nseed, 4);
|
memcpy(out+4, &nseed, 4);
|
||||||
dnsd_send(dns_fd, &q, out, 8);
|
dnsd_send(dns_fd, &q, out, 8);
|
||||||
|
|
||||||
memcpy(&(u.host), &(q.from), q.fromlen);
|
|
||||||
u.addrlen = q.fromlen;
|
|
||||||
} else {
|
} else {
|
||||||
version = htonl(VERSION);
|
version = htonl(VERSION);
|
||||||
strncpy(out, "VNAK", sizeof(out));
|
strncpy(out, "VNAK", sizeof(out));
|
||||||
|
@ -151,11 +148,6 @@ tunnel(int tun_fd, int dns_fd)
|
||||||
dnsd_send(dns_fd, &q, out, 8);
|
dnsd_send(dns_fd, &q, out, 8);
|
||||||
}
|
}
|
||||||
} else if(in[0] == 'L' || in[0] == 'l') {
|
} else if(in[0] == 'L' || in[0] == 'l') {
|
||||||
// Check sending ip number
|
|
||||||
if (q.fromlen != u.addrlen ||
|
|
||||||
memcmp(&(u.host), &(q.from), q.fromlen) != 0) {
|
|
||||||
dnsd_send(dns_fd, &q, "BADIP", 5);
|
|
||||||
} else {
|
|
||||||
// Login phase, handle auth
|
// Login phase, handle auth
|
||||||
login_calculate(logindata, 16, password, seed);
|
login_calculate(logindata, 16, password, seed);
|
||||||
if (read >= 17 && (memcmp(logindata, in+1, 16) == 0)) {
|
if (read >= 17 && (memcmp(logindata, in+1, 16) == 0)) {
|
||||||
|
@ -169,6 +161,10 @@ tunnel(int tun_fd, int dns_fd)
|
||||||
read = snprintf(out, sizeof(out), "%s-%s-%d",
|
read = snprintf(out, sizeof(out), "%s-%s-%d",
|
||||||
tmp[0], tmp[1], my_mtu);
|
tmp[0], tmp[1], my_mtu);
|
||||||
|
|
||||||
|
// Store user ip
|
||||||
|
memcpy(&(u.host), &(q.from), q.fromlen);
|
||||||
|
u.addrlen = q.fromlen;
|
||||||
|
|
||||||
dnsd_send(dns_fd, &q, out, read);
|
dnsd_send(dns_fd, &q, out, read);
|
||||||
q.id = 0;
|
q.id = 0;
|
||||||
|
|
||||||
|
@ -177,7 +173,6 @@ tunnel(int tun_fd, int dns_fd)
|
||||||
} else {
|
} else {
|
||||||
dnsd_send(dns_fd, &q, "LNAK", 4);
|
dnsd_send(dns_fd, &q, "LNAK", 4);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} 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')
|
||||||
|| (in[0] >= 'A' && in[0] <= 'F')) {
|
|| (in[0] >= 'A' && in[0] <= 'F')) {
|
||||||
|
|
Loading…
Reference in a new issue