Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2403?usp=email
to review the following change.
Change subject: socket: print the SOCKS control socket's local address
......................................................................
socket: print the SOCKS control socket's local address
With SOCKS over UDP, --local binds the control socket to the proxy.
linksock_print_addr() looked for a bind address of the remote's family
instead, so an IPv6 proxy with an IPv4 remote and an IPv6 --local found
none and hit ASSERT(cur).
Use the control socket's family in that case, also for the protocol
shown in the log line.
Change-Id: I59b0fc44e924dd1390bb39cfcce5fa9172165472
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/socket.c
1 file changed, 15 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/03/2403/1
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index d3411d8..bbc6cf5 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -1189,7 +1189,7 @@
static void
-linksock_print_addr(struct link_socket *sock)
+linksock_print_addr(const struct link_socket *sock)
{
struct gc_arena gc = gc_new();
const msglvl_t msglevel = (sock->mode == LS_MODE_TCP_ACCEPT_FROM) ?
D_INIT_MEDIUM : M_INFO;
@@ -1198,6 +1198,18 @@
if (sock->bind_local)
{
sa_family_t ai_family = sock->info.lsa->actual.dest.addr.sa.sa_family;
+ sa_family_t bound_af = sock->info.af;
+ /* With SOCKS over UDP the bound socket is the control socket, which
+ * has the proxy's family, not the remote's */
+ if (sock->socks_proxy && sock->info.proto == PROTO_UDP)
+ {
+ struct openvpn_sockaddr ctrl;
+ socklen_t len = sizeof(ctrl.addr);
+ if (getsockname(sock->ctrl_sd, &ctrl.addr.sa, &len) == 0)
+ {
+ ai_family = bound_af = ctrl.addr.sa.sa_family;
+ }
+ }
/* Socket is always bound on the first matching address,
* For bound sockets with no remote addr this is the element of
* the list */
@@ -1210,8 +1222,8 @@
}
}
ASSERT(cur);
- msg(msglevel, "%s link local (bound): %s",
- proto2ascii(sock->info.proto, sock->info.af, true),
print_sockaddr(cur->ai_addr, &gc));
+ msg(msglevel, "%s link local (bound): %s",
proto2ascii(sock->info.proto, bound_af, true),
+ print_sockaddr(cur->ai_addr, &gc));
}
else
{
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2403?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59b0fc44e924dd1390bb39cfcce5fa9172165472
Gerrit-Change-Number: 2403
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel