From 1772ded7815f13a7361c895869bef23860e61a0a Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 18 Nov 2026 20:51:06 +0300 Subject: [PATCH] socks: a UDP association is not relayed direct when its parent fails --- src/udpsockmap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/udpsockmap.c b/src/udpsockmap.c index c5f28f8..e200cc4 100644 --- a/src/udpsockmap.c +++ b/src/udpsockmap.c @@ -158,8 +158,10 @@ static void udpreset(struct clientparam *param) /* * Authorize param->req and (re)build the server side of the association: * a parent proxy chain and/or an external address may be selected by the ACL. - * Returns the authorization result. param->remsock is INVALID_SOCKET if the - * socket can not be created, in this case the association can not continue. + * Returns the authorization result. param->remsock is INVALID_SOCKET when + * the authorization refused the association or the socket can not be + * created; the association can not continue then, so that a parent the + * rules demand is never quietly replaced by a direct relay. */ static int udpreconnect(struct clientparam *param) { @@ -185,9 +187,10 @@ static int udpreconnect(struct clientparam *param) param->remsock = INVALID_SOCKET; } udpreset(param); + return res; } - if (udpbind(param)) return res? res : 11; - return res; + if (udpbind(param)) return 11; + return 0; } int udpsockmap(struct clientparam *param, int timeo)