[Kea-users] If statements in flex_id

Allan Tinker allan at m33access.com
Tue Oct 26 14:49:17 UTC 2021


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' or substring(option[60].hex,0,18) == 'HT802 dslforum.org' or substring(option[60].hex,0,18) == 'HT812 dslforum.org') {option[60].hex,0,18} else {relay4[1].hex}",
        "replace-client-id": true
        }
    },

Any help would be great

Thanks! 

- Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20211026/44edcd98/attachment.htm>


More information about the Kea-users mailing list