From ce5ca860e98de63570df64f12daa81be7ae82a28 Mon Sep 17 00:00:00 2001 From: Omar Tariq <65053572+OmarTariq612@users.noreply.github.com> Date: Mon, 8 Aug 2022 03:13:40 +0200 Subject: [PATCH] using send() instead of sendto() chaning sendto() function call into send() as it's being used on a tcp socket. "If sendto() is used on a connection-mode (SOCK_STREAM, SOCK_SEQPACKET) socket, the arguments dest_addr and addrlen are ignored (and the error EISCONN may be returned when they are not NULL and 0)" from Linux Programmer's Manual. --- udptunnel.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/udptunnel.c b/udptunnel.c index 8dd9c17..f5b6b5b 100644 --- a/udptunnel.c +++ b/udptunnel.c @@ -379,9 +379,7 @@ static void tcp_to_udp(struct relay *relay) static void send_handshake(struct relay *relay) { - if (sendto(relay->tcp_sock, relay->handshake, sizeof(relay->handshake), 0, - (struct sockaddr *) &relay->remote_udpaddr, - sizeof(relay->remote_udpaddr)) < 0) + if (send(relay->tcp_sock, relay->handshake, sizeof(relay->handshake), 0) < 0) err_sys("sendto(tcp, handshake)"); }