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-Tag: release_3_0_24~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3ff91455948d76452d73cbea3ec1511c7839699;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 2d830168821..a97511db831 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 705b5699642..6bc90e54264 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -1445,7 +1445,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) { @@ -2832,6 +2832,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; } @@ -2932,7 +2933,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 d1d03ac771a..a32a934ce24 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -3478,7 +3478,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; }