Unlang operations with IP addresses

Alan DeKok aland at deployingradius.com
Tue Dec 10 20:51:55 UTC 2024


On Dec 10, 2024, at 1:44 PM, Ľudovít Mikula <ludovit.mikula at mikori.sk> wrote:
> 
> Ok, I've got the question wrong.
> 
> What I want to do:  based on assigned IP address and subnet mask, compute first IP address from the range from which the IP address was assigned.
> 
> Example:
> 
> given:
>  DHCP-Your-IP-Address: 192.168.10.20
>  DHCP-Subnet-Mask: 255.255.255.0
> 
> would produce:
>  DHCP-Router-Address: 192.168.10.1

 Hmm... I'm not sure that's easy to do in v3.  In v4 it's easy:

ip-address thing = (DHCP-Your-IP-Address & ((uint32) DHCP-Subnet-Mask)) + 1

 In v3, I think this is about the only situation where you'd have to use something other than unlang.  :(

 Alan DeKok.


More information about the Freeradius-Users mailing list