This ended up doing the trick.

Turns out I needed to just do an ifelse() statement.

I append “GrandStream” in front of the devices MAC address. 
If it's not a Grandsream that I use, then I use the circuit ID. 

"identifier-expression": "ifelse(substring(option[60].hex,0,18) == 'HT8XX 
dslforum.org' or substring(option[60].hex,0,18) == 'HT802 dslforum.org' or 
substring(option[60].hex,0,18) == 'HT812 dslforum.org','GrandStream ' + 
relay4[2].hex,relay4[1].hex)”,

Thanks! 

- Allan

> On Oct 26, 2021, at 10:49 AM, Allan Tinker <[email protected]> wrote:
> 
> In IPv4 Im trying to use the circuit ID as the identifier to restrict IPv4 
> leases to one IP address at bridged clients. 
> 
> However, some clients have phone service and we put a GrandStream ATA as a 
> bridge after their ONU but before the router. 
> The ATA does pull from its own shared pool for IP leases, but it grabs that 
> circuit ID and stores it in the lease table, not allowing anything else past 
> it to obtain an IP address
> 
> Im trying to do an if statement in the “identifier-expression” under the 
> flex_id hook to swap it out. 
> 
> This is what I have.. Im sure it's a syntax issue or something along those 
> lines. But Im hoping that it's possible to do something like this:
> 
>     {
>     "library": "/usr/local/lib/kea/hooks/libdhcp_flex_id.so",
>         "parameters": { 
>     //  "identifier-expression": "relay4[1].hex",
>         "identifier-expression": "if (substring(option[60].hex,0,18) == 
> 'HT8XX dslforum.org <http://dslforum.org/>' or substring(option[60].hex,0,18) 
> == 'HT802 dslforum.org <http://dslforum.org/>' or 
> substring(option[60].hex,0,18) == 'HT812 dslforum.org 
> <http://dslforum.org/>') {option[60].hex,0,18} else {relay4[1].hex}",
>         "replace-client-id": true
>         }
>     },
> 
> Any help would be great
> 
> Thanks! 
> 
> - Allan
> _______________________________________________
> ISC funds the development of this software with paid support subscriptions. 
> Contact us at https://www.isc.org/contact/ for more information.
> 
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
> 
> Kea-users mailing list
> [email protected]
> https://lists.isc.org/mailman/listinfo/kea-users

_______________________________________________
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-users

Reply via email to