From 222aaffdbd5fbadf6b1f1462c7468e8e7db1607e Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Tue, 28 Sep 2021 15:42:03 -0400 Subject: [PATCH] use the VP key for proxying, instead of proxy_listener->key and don't break out of the loop with the mutex unlocked. :( --- src/main/process.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/process.c b/src/main/process.c index bf806d8074..6d9ed31a5b 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -2367,12 +2367,26 @@ static int insert_into_proxy_hash(REQUEST *request) * listener by key. */ if (reverse_coa) { - rad_assert(request->proxy_listener != NULL); + int rcode; + VALUE_PAIR *vp; + /* + * Find the Originating-Realm key, which + * might not be the same as + * proxy_listener->key. + */ + vp = fr_pair_find_by_num(request->config, PW_PROXY_TO_ORIGINATING_REALM, 0, TAG_ANY); + if (!vp) break; + + /* + * We don't want to hold multiple mutexes + * at the same time. + */ PTHREAD_MUTEX_UNLOCK(&proxy_mutex); - if (listen_coa_find(request, request->proxy_listener->key) < 0) break; + rcode = listen_coa_find(request, vp->vp_strvalue); PTHREAD_MUTEX_LOCK(&proxy_mutex); - continue; + if (rcode < 0) continue; + break; } #endif -- 2.47.3