From ba90706429356ef9970331915dc1f99f23c9a152 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Fri, 24 Jul 2020 20:38:45 +0200 Subject: [PATCH] Replace send_downenc_switch with send_handshake_query --- src/client.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/client.c b/src/client.c index c72846f..9e2a41d 100644 --- a/src/client.c +++ b/src/client.c @@ -1314,22 +1314,6 @@ send_downenctest(int fd, char downenc, int variant) send_handshake_query(fd, prefix); } -static void -send_downenc_switch(int fd, int userid) -{ - char buf[512] = "o_____."; - buf[1] = b32_5to8(userid); - buf[2] = tolower(downenc); - - buf[3] = b32_5to8((rand_seed >> 10) & 0x1f); - buf[4] = b32_5to8((rand_seed >> 5) & 0x1f); - buf[5] = b32_5to8((rand_seed) & 0x1f); - rand_seed++; - - strncat(buf, topdomain, 512 - strlen(buf)); - send_query(fd, buf); -} - static void send_lazy_switch(int fd, int userid) { @@ -2043,6 +2027,7 @@ codec_revert: static void handshake_switch_downenc(int dns_fd) { + char sw_downenc[] = { 'o', b32_5to8(userid), tolower(downenc), 0 }; char in[4096]; int i; int read; @@ -2061,7 +2046,7 @@ handshake_switch_downenc(int dns_fd) fprintf(stderr, "Switching downstream to codec %s\n", dname); for (i = 0; running && i < 5; i++) { - send_downenc_switch(dns_fd, userid); + send_handshake_query(dns_fd, sw_downenc); read = handshake_waitdns(dns_fd, in, sizeof(in), 'o', 'O', i+1);