response sent after do_not_respond called

Geoffrey D. Bennett g at netcraft.com.au
Fri May 4 07:59:05 CEST 2018


On Thu, Apr 26, 2018 at 12:16:23PM +0930, Alan DeKok wrote:
> On Apr 25, 2018, at 10:09 PM, Geoffrey D. Bennett <g at netcraft.com.au> wrote:
> > My use case for this is that I have a database lookup in the post-auth
> > section, and if the database connection fails I need to return no
> > response so that the NAS will send its request to the other RADIUS
> > server which has the backup database.
> 
> That's useful, I must admin.
[...]
> > Could you point me in the appropriate direction to implement this if
> > you'd accept such a patch?
> 
> src/main/process.c.  Look for "Not responding to request".  And try
> to figure it out. :(

Thanks for the pointer. Please find attached a patch relative to
v3.0.x. Is this the right way to go about it?

Thanks,
Geoffrey.
-------------- next part --------------
diff --git a/src/main/process.c b/src/main/process.c
index bd813cd..fb00d33 100644
--- a/src/main/process.c
+++ b/src/main/process.c
@@ -1382,6 +1382,13 @@ static void request_finish(REQUEST *request, int action)
 	}
 #endif
 
+	/* Recheck response packet type for Do Not Respond policy */
+	vp = fr_pair_find_by_num(request->config, PW_RESPONSE_PACKET_TYPE, 0, TAG_ANY);
+	if (vp && vp->vp_integer == 256) {
+		RDEBUG2("Not responding to request");
+		request->reply->code = 0;
+	}
+
 	/*
 	 *	Ignore all "do not respond" packets.
 	 *	Except for the detail ones, which need to ping


More information about the Freeradius-Users mailing list