Skip to contentSkip to conversation

socks: use the right function when printing struct openvpn_sockaddr

PATCH In review Antonio Quartulli 3 participants 3 messages Nov 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 socks: use the right function when printing struct openvpn_sockaddr

57623b4e introduced a print_sockaddr() call in socks.c to print an openvpn_sockaddr object.

However, this is not correct because print_sockaddr() expects a sockaddr object as argument instead of openvpn_sockaddr.

This error did not lead to any issue because the two objects are very similar in regards to the data accessed by print_sockaddr().

Fix this by replacing print_sockaddr() with print_openvpn_sockaddr().

---
 src/openvpn/socks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/socks.c +1 -1
index ad3a70b2..57f0cee2 100644
@@ -416,7 +416,7 @@ recv_socks_reply(socket_descriptor_t sd,
         memcpy(&addr->addr.in4.sin_port, buf + 8, sizeof(addr->addr.in4.sin_port));
         struct gc_arena gc = gc_new();
         msg(M_INFO, "SOCKS proxy wants us to send UDP to %s",
-            print_sockaddr(addr, &gc));
+            print_openvpn_sockaddr(addr, &gc));
         gc_free(&gc);
     }
 
Signature · 1 line
2.24.0
Acked-by on v1 1/1
#1 lore raw

Am 09.11.19 um 17:37 schrieb Antonio Quartulli:

Quoted 11 lines

57623b4e introduced a print_sockaddr() call in socks.c to print an openvpn_sockaddr object.

However, this is not correct because print_sockaddr() expects a sockaddr object as argument instead of openvpn_sockaddr.

This error did not lead to any issue because the two objects are very similar in regards to the data accessed by print_sockaddr().

Fix this by replacing print_sockaddr() with print_openvpn_sockaddr().

Not compile tested but looks like the right fix to me.

Arne

Acked-by on v1 1/1
#2 lore raw
In reply to Antonio Quartulli

Thanks for fixing my oversight (amazing we both did not see the
warning in the first patch...). socks.c compiles without warning
now, and still prints the right address.

Your patch has been applied to the master and release/2.4 branch (bugfix).

commit 6c39b4dc4766594c6517043af59aeea53ea009d0 (master) commit 0ba4f91667b8931684e704d1836d71c893e3b9f6 (resolve/2.4)

Author: Antonio Quartulli
Date:   Sat Nov 9 17:37:14 2019 +0100
     socks: use the right function when printing struct openvpn_sockaddr

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19073.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering