1
0
Fork 0
mirror of https://github.com/yarrick/iodine.git synced 2025-04-07 11:07:03 +00:00

Iodine: Fixed network protocol version

This commit is contained in:
Julian Kranz 2012-01-07 02:38:47 +01:00 committed by Barak A. Pearlmutter
parent fc4e6929b1
commit 30fe7dbc06
3 changed files with 26 additions and 3 deletions

View file

@ -1473,7 +1473,12 @@ handshake_version(int dns_fd, int *seed)
for (i = 0; running && i < 5; i++) {
send_version(dns_fd, VERSION);
#ifdef LINUX
if(_v6)
send_version(dns_fd, VERSION_V6);
else
#endif
send_version(dns_fd, VERSION);
read = handshake_waitdns(dns_fd, in, sizeof(in), 'v', 'V', i+1);
@ -1493,7 +1498,15 @@ handshake_version(int dns_fd, int *seed)
fprintf(stderr, "Version ok, both using protocol v 0x%08x. You are user #%d\n", VERSION, userid);
return 0;
} else if (strncmp("VNAK", in, 4) == 0) {
warnx("You use protocol v 0x%08x, server uses v 0x%08x. Giving up",
#ifdef LINUX
if (_v6)
warnx(
"You use protocol v 0x%08x, server uses v 0x%08x. Giving up",
VERSION_V6, payload);
else
#endif
warnx(
"You use protocol v 0x%08x, server uses v 0x%08x. Giving up",
VERSION, payload);
return 1;
} else if (strncmp("VFUL", in, 4) == 0) {

View file

@ -726,7 +726,11 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
((unpacked[3] & 0xff)));
}
#ifdef LINUX
if (version == v6 ? VERSION_V6 : VERSION) {
#else
if (version == VERSION) {
#endif
userid = find_available_user();
if (userid >= 0) {
int i;
@ -787,7 +791,12 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
inet_ntoa(((struct sockaddr_in *) &q->from)->sin_addr));
}
} else {
send_version_response(dns_fd, VERSION_NACK, VERSION, 0, q);
#ifdef LINUX
if (v6)
send_version_response(dns_fd, VERSION_NACK, VERSION_V6, 0, q);
else
#endif
send_version_response(dns_fd, VERSION_NACK, VERSION, 0, q);
syslog(LOG_INFO, "dropped user from %s, sent bad version %08X",
inet_ntoa(((struct sockaddr_in *) &q->from)->sin_addr), version);
}

View file

@ -20,6 +20,7 @@
/* This is the version of the network protocol
It is usually equal to the latest iodine version number */
#define VERSION 0x00000502
#define VERSION_V6 0x00000503
#endif /* _VERSION_H_ */