Matching a prefix in huntgroups file

Brian Candler b.candler at
Fri Nov 11 15:37:17 CET 2016

On 11/11/2016 13:42, Alan DeKok wrote:
>    How do you know that a particular string is a host name,*before*  it's parsed?

You don't. That is: I don't think the *parser* needs to decide whether a 
string is a hostname or not!

A concrete example:

     Framed-IP-Address :=     # let's say this is 

     Framed-IP-Address := ""   # allowed. RHS has type 

The question is then not one of parsing, but of assignment semantics. If 
the LHS has type "ipaddr", and the RHS has type "string", then the 
string is converted into an ipaddr via hostname resolution. This is 
unconditional: you don't have to inspect the string to decide whether it 
looks like a hostname or not.

I personally don't mind the implicit cast from string to ipaddr (*), but 
you could instead require it to be explicit:

     Framed-IP-Address := <ipaddr>""

If the RHS is a constant string literal then this could still be 
resolved at parse/compile time. But the potential is also there to do 
late resolution: e.g.

     Framed-IP-Address := <ipaddr>"%{User-Name}"



(*) It's not really any different to the current FR behaviour, which 
allows these implicitly:

     Framed-IP-Address :=   # treated as hostname, 
resolved to IP
     Reply-Message :=   # treated as string
     Framed-IP-Address +=    # IP
     Reply-Message +=    # string

More information about the Freeradius-Users mailing list