From 76e95d4300faa4ec0da970345e0043d6811896c5 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sat, 18 Apr 2020 19:40:28 -0400 Subject: [PATCH] allow request_will_proxy() to return an error and check it in request_running() --- src/main/process.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/process.c b/src/main/process.c index 1a48517d43..fcd0a0ad06 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -1598,6 +1598,8 @@ static void request_finish(REQUEST *request, int action) */ static void request_running(REQUEST *request, int action) { + int rcode; + VERIFY_REQUEST(request); TRACE_STATE_MACHINE; @@ -1631,7 +1633,8 @@ static void request_running(REQUEST *request, int action) /* * We may need to send a proxied request. */ - if (request_will_proxy(request)) { + rcode = request_will_proxy(request); + if (rcode == 1) { #ifdef DEBUG_STATE_MACHINE if (rad_debug_lvl) printf("(%u) ********\tWill Proxy\t********\n", request->number); #endif @@ -1648,6 +1651,14 @@ static void request_running(REQUEST *request, int action) process_proxy_reply(request, NULL); goto req_finished; } + + } else if (rcode < 0) { + /* + * No live home servers, run Post-Proxy-Type Fail. + */ + (void) setup_post_proxy_fail(request); + process_proxy_reply(request, NULL); + goto req_finished; } else #endif { @@ -3082,7 +3093,7 @@ static int request_will_proxy(REQUEST *request) if (!home) { REDEBUG2("Failed to find live home server: Cancelling proxy"); - return 1; + return -1; } do_home: