From 5de13805d8f637e5cd9431a0053483be952cc560 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Fri, 24 Jul 2020 20:24:19 +0200 Subject: [PATCH] Replace send_codec_switch with send_handshake_query --- src/client.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/client.c b/src/client.c index 0d7864b..1b4cee6 100644 --- a/src/client.c +++ b/src/client.c @@ -1329,23 +1329,6 @@ send_downenctest(int fd, char downenc, int variant) send_handshake_query(fd, prefix); } -static void -send_codec_switch(int fd, int userid, int bits) -{ - char buf[512] = "s_____."; - buf[1] = b32_5to8(userid); - buf[2] = b32_5to8(bits); - - 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_downenc_switch(int fd, int userid) { @@ -2019,6 +2002,7 @@ handshake_edns0_check(int dns_fd) static void handshake_switch_codec(int dns_fd, int bits) { + char sw_codec[] = { 's', b32_5to8(userid), b32_5to8(bits), 0 }; char in[4096]; int i; int read; @@ -2038,7 +2022,7 @@ handshake_switch_codec(int dns_fd, int bits) for (i = 0; running && i < 5; i++) { - send_codec_switch(dns_fd, userid, bits); + send_handshake_query(dns_fd, sw_codec); read = handshake_waitdns(dns_fd, in, sizeof(in), 's', 'S', i+1);