Rename VERSION define

prep for autotools: autoconf defines VERSION so s/VERSION/PROTOCOL_VERSION/
This commit is contained in:
Barak A. Pearlmutter 2014-04-24 15:03:47 +01:00 committed by Erik Ekman
parent b9a1f14e86
commit 46532539c2
3 changed files with 7 additions and 6 deletions

View File

@ -1395,7 +1395,7 @@ handshake_version(int dns_fd, int *seed)
for (i = 0; running && i < 5; i++) { for (i = 0; running && i < 5; i++) {
send_version(dns_fd, VERSION); send_version(dns_fd, PROTOCOL_VERSION);
read = handshake_waitdns(dns_fd, in, sizeof(in), 'v', 'V', i+1); read = handshake_waitdns(dns_fd, in, sizeof(in), 'v', 'V', i+1);
@ -1411,11 +1411,12 @@ handshake_version(int dns_fd, int *seed)
userid_char = hex[userid & 15]; userid_char = hex[userid & 15];
userid_char2 = hex2[userid & 15]; userid_char2 = hex2[userid & 15];
fprintf(stderr, "Version ok, both using protocol v 0x%08x. You are user #%d\n", VERSION, userid); fprintf(stderr, "Version ok, both using protocol v 0x%08x. You are user #%d\n",
PROTOCOL_VERSION, userid);
return 0; return 0;
} else if (strncmp("VNAK", in, 4) == 0) { } else if (strncmp("VNAK", in, 4) == 0) {
warnx("You use protocol v 0x%08x, server uses v 0x%08x. Giving up", warnx("You use protocol v 0x%08x, server uses v 0x%08x. Giving up",
VERSION, payload); PROTOCOL_VERSION, payload);
return 1; return 1;
} else if (strncmp("VFUL", in, 4) == 0) { } else if (strncmp("VFUL", in, 4) == 0) {
warnx("Server full, all %d slots are taken. Try again later", payload); warnx("Server full, all %d slots are taken. Try again later", payload);

View File

@ -765,7 +765,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
((unpacked[3] & 0xff))); ((unpacked[3] & 0xff)));
} }
if (version == VERSION) { if (version == PROTOCOL_VERSION) {
userid = find_available_user(); userid = find_available_user();
if (userid >= 0) { if (userid >= 0) {
int i; int i;
@ -826,7 +826,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
format_addr(&q->from, q->fromlen)); format_addr(&q->from, q->fromlen));
} }
} else { } else {
send_version_response(dns_fd, VERSION_NACK, VERSION, 0, q); send_version_response(dns_fd, VERSION_NACK, PROTOCOL_VERSION, 0, q);
syslog(LOG_INFO, "dropped user from %s, sent bad version %08X", syslog(LOG_INFO, "dropped user from %s, sent bad version %08X",
format_addr(&q->from, q->fromlen), version); format_addr(&q->from, q->fromlen), version);
} }

View File

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