3.71.20. NoReplyHook Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define a Perl function that is called if no reply is received from any RadSec server. A reference to the original request received from the NAS is passed as the first argument. A reference to the request that was forwarded to the remote RADIUS server is passed as the second argument. A reference to the reply packet being constructed for return to the NAS is passed as the third argument (note that the normal behaviour in case of no reply, is for no reply to be sent to the NAS).
The hook code is compiled by Perl when Radiator starts up. Compilation errors in your hook code are reported to the log file at start-up time. Runtime errors in your hook are also reported to the log file when your hook executes. Multiline hooks (with trailing backslashes (\)) are parsed by Radiator into one long line. Therefore do not use trailing comments in your hook.
NoReplyHook can be an arbitrarily complicated Perl function, that might run external processes, consult databases, change the contents of the current request or many other things. In particular, you can forward the request to another AuthBy RADSEC clause, allowing you to implement automatic failover of RadSec hosts.
# Call another AuthBy RADSEC if this one fails to respond
NoReplyHook sub { Radius::AuthGeneric::find('RADSEC2')\
      ->handle_request(${$_[0]}, ${$_[2]});}