On 10/12/2024 21:29, Ľudovít Mikula wrote:
Ended up using sql since I already use it and the overhead is probably quite small.
Just for reference this is what I used: &DHCP-Router-Address = "%{sql: SELECT INET_NTOA((INET_ATON('%{DHCP-Your-IP-Address}') & INET_ATON('%{%{DHCP-Subnet-Mask}:-255.255.255.0}')) +1) AS ip;}"
I had to work out something similar recently - and you can do it in unlang by casting IP addresses to integers, doing the maths and then casting back to IP. For what you're doing the following would work: update { &Tmp-Integer-0 := &DHCP-Your-IP-Address &Tmp-Integer-1 := &DHCP-Subnet-Mask &Tmp-Integer-2 := "%{expr: (&Tmp-Integer-0 & &Tmp-Integer-1) + 1}" &DHCP-Router-Address := &Tmp-Integer-2 } It's not pretty, but it works - and avoids any external calls. Nick -- Nick Porter Porter Computing Ltd Registered in England No 12659380