<div dir="ltr">Hi Heikki, <div><br></div><div>Thanks for checking that over. Yes, the regex was a quick thing I chucked together (forgetting that ^ would do the trick). I've created a ForwardHook (before sending things to our national roaming servers), and a PreProcessingHook in the Handler that handles the DNSROAM Auth (so anything our national roaming servers wouldn't handle, like the Cisco OpenRoaming, Samsung OpenRoaming and Android internal OpenRoaming client realms).</div><div><br></div><div>So far that seems to work now, thank you! :-)</div><div><br></div><div>With kind regards</div><div><br></div><div>Stefan</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 10 Mar 2023 at 14:33, Heikki Vatiainen via radiator <<a href="mailto:radiator@lists.open.com.au">radiator@lists.open.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10.3.2023 6.12, Stefan Paetow (OpenSource) via radiator wrote:<br>
<br>
> Currently, we get "1<domain>", which is the 'old' (or 'correct') format <br>
> for Wi-Fi networks, so I'm looking at a hook to replace the 1 with a 4 <br>
> as a first step. I assume I do that in the PreClientHook or the <br>
> PreProcessingHook?<br>
> <br>
> I was thinking that this code would work:<br>
> <br>
> sub {\<br>
> my $p = ${$_[0]}; my $oname=$p->get_attr('Operator-Name');\<br>
> $oname =~ s/1(.*)$/4\1/g; $p->change_attr('Operator-Name',$oname);\<br>
> &main::log($main::LOG_DEBUG,"Operator-Name:$oname, ");\<br>
> }<br>
> <br>
> Do I have that right?<br>
<br>
Looks good. See below for a slightly updated regexp.<br>
<br>
You can use that hook as global PreClientHook, global ClientHook, <br>
ClientHook within a <Client ...> clause and as a PreProcessingHook <br>
within a <Handler>. They all use reference to the current request as <br>
their first argument. PreProcessingHook also gets current reply which <br>
can be ignored in this case.<br>
<br>
I'd simplify the regexp a little if it only needs to swap a leading 1 to <br>
4. Here's an idea of a tester:<br>
<br>
<Client DEFAULT><br>
Secret mysecret<br>
</Client><br>
<br>
<Handler><br>
PreProcessingHook sub {\<br>
my $p = ${$_[0]}; my $oname=$p->get_attr('Operator-Name');\<br>
$oname =~ s/^1/4/s; $p->change_attr('Operator-Name',$oname);\<br>
main::log($main::LOG_DEBUG,"Operator-Name:$oname, ");\<br>
}<br>
<AuthBy INTERNAL><br>
DefaultResult REJECT<br>
</AuthBy><br>
AddToReply Reply-Message=%{Request:Operator-Name}<br>
</Handler><br>
<br>
<br>
<br>
Testing with radpwtst:<br>
% radpwtst -trace 4 -noacct Operator-Name=1operator:country<br>
<br>
Should return a reply with the default and additional Reply-Message:<br>
<br>
<br>
Fri Mar 10 16:28:31 2023: DEBUG: Packet dump:<br>
*** Received from 127.0.0.1 port 1645 ....<br>
Code: Access-Reject<br>
Identifier: 233<br>
Authentic: <243>2<235>H<17>!7<254>><15>W<0>_c}<185><br>
Attributes:<br>
Reply-Message = "Request Denied"<br>
Reply-Message = "4operator:country"<br>
<br>
Rejected: Request Denied<br>
<br>
<br>
Note that only PreClientHook runs before log level 4 packet dump. <br>
Therefore the updated Operator-Name is not visible in the log with the <br>
other hooks.<br>
<br>
Thanks,<br>
Heikki<br>
<br>
-- <br>
Heikki Vatiainen<br>
OSC, makers of Radiator<br>
Visit <a href="http://radiatorsoftware.com" rel="noreferrer" target="_blank">radiatorsoftware.com</a> for Radiator AAA server software<br>
_______________________________________________<br>
radiator mailing list<br>
<a href="mailto:radiator@lists.open.com.au" target="_blank">radiator@lists.open.com.au</a><br>
<a href="https://lists.open.com.au/mailman/listinfo/radiator" rel="noreferrer" target="_blank">https://lists.open.com.au/mailman/listinfo/radiator</a><br>
</blockquote></div>