From: Alan T. DeKok Date: Wed, 31 Mar 2021 13:05:16 +0000 (-0400) Subject: add and use separate function for sending to a proxy listener X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cc4aee6e985ff00d3e5a6ab12461b80788ed11d;p=thirdparty%2Ffreeradius-server.git add and use separate function for sending to a proxy listener --- diff --git a/src/include/listen.h b/src/include/listen.h index 2d83016882..a97511db83 100644 --- a/src/include/listen.h +++ b/src/include/listen.h @@ -85,6 +85,16 @@ struct rad_listen { rad_listen_recv_t recv; rad_listen_send_t send; + + /* + * We don't need a proxy_recv, because the main loop in + * process.c calls listener->recv(), and we don't know + * what kind of packet we're receiving until we receive + * it. + */ + rad_listen_send_t proxy_send; + + rad_listen_encode_t encode; rad_listen_decode_t decode; rad_listen_encode_t proxy_encode; diff --git a/src/main/listen.c b/src/main/listen.c index ad9b8fe3d1..46864415dd 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -1408,7 +1408,7 @@ static int acct_socket_send(rad_listen_t *listener, REQUEST *request) static int proxy_socket_send(rad_listen_t *listener, REQUEST *request) { rad_assert(request->proxy_listener == listener); - rad_assert(listener->send == proxy_socket_send); + rad_assert(listener->proxy_send == proxy_socket_send); if (rad_send(request->proxy, NULL, request->home_server->secret) < 0) { @@ -2795,6 +2795,7 @@ static rad_listen_t *listen_alloc(TALLOC_CTX *ctx, RAD_LISTEN_TYPE type) this->encode = master_listen[this->type].encode; this->decode = master_listen[this->type].decode; } else { + this->proxy_send = master_listen[this->type].send; this->proxy_encode = master_listen[this->type].encode; this->proxy_decode = master_listen[this->type].decode; } @@ -2895,7 +2896,7 @@ rad_listen_t *proxy_new_listener(TALLOC_CTX *ctx, home_server_t *home, uint16_t } this->recv = proxy_tls_recv; - this->send = proxy_tls_send; + this->proxy_send = proxy_tls_send; } #endif #endif diff --git a/src/main/process.c b/src/main/process.c index 4e98b88a1f..1e5cb6acc2 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -3473,7 +3473,7 @@ static int request_proxy(REQUEST *request) /* * And send the packet. */ - request->proxy_listener->send(request->proxy_listener, request); + request->proxy_listener->proxy_send(request->proxy_listener, request); return 1; }