[Kea-users] Support for multiple flex options parameters?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Kea-users] Support for multiple flex options parameters?

Søren Andersen
Would it be possible to add support for multiple parameters?

Like this:

{
    "library": "/usr/lib64/kea/hooks/libdhcp_flex_option.so",
    "parameters": {
        "options": [
            {
                "add": "ifelse(member('cm'),concat('/docsis/', hexstring(pkt4.mac, '')),'' )",
                "add": "ifelse(member('voip'),concat('/voip/', hexstring(pkt4.mac, '')),'' )",
                "code": 67
            }
        ]
    }
},

/Søren

_______________________________________________
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
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Support for multiple flex options parameters?

Francis Dupont
Yes multiple actions are supported by the flex option hook.

Thanks

Francis Dupont <[hidden email]>
_______________________________________________
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
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Support for multiple flex options parameters?

Søren Andersen
Hello Francis,

Also for the same dhcp-option like this?

options:
- code: 67
  add: "ifelse(member('cm'),concat('/docsis/', hexstring(pkt4.mac, '')),'' )"
- code: 67
  add: "ifelse(member('voip'),concat('/', concat(hexstring(pkt4.mac, ''), '.bin')),'')"



From: Francis Dupont <[hidden email]>
Sent: 21 January 2021 14:42
To: Søren Andersen <[hidden email]>
Cc: [hidden email] <[hidden email]>
Subject: Re: [Kea-users] Support for multiple flex options parameters?
 
[EKSTERN MAIL]


Yes multiple actions are supported by the flex option hook.

Thanks

Francis Dupont <[hidden email]>

_______________________________________________
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
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Support for multiple flex options parameters?

Francis Dupont
S?ren Andersen writes:
> Also for the same dhcp-option like this?
>
> options:
> - code: 67
>   add: "ifelse(member('cm'),concat('/docsis/', hexstring(pkt4.mac, '')),'' =
> )"
> - code: 67
>   add: "ifelse(member('voip'),concat('/', concat(hexstring(pkt4.mac, ''), '=
> .bin')),'')"

=> I do not think this will work because the hook implementation uses
a per code std::map for the configuration so the second entry will
overwrite the first one.

Thanks

Francis Dupont <[hidden email]>

PS: it will silently overwrite the std::map entry. If you think it should
warn please open ticket (gitlab issue). BTW I think that in all cases
it is possible to merge entries for the same code but I agree it can
quickly become hard to do...
_______________________________________________
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
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Support for multiple flex options parameters?

Søren Andersen
Thanks for the answer. 

I managed to get it working with: 

{
"add": "ifelse(member('cm'),concat('/docsis/', hexstring(pkt4.mac, '')), ifelse(member('voip'),concat('/', concat(hexstring(pkt4.mac, ''), '.bin')),''))",
"code": 67
},

I agree with you.. The syntax is a bit hard to read. 

From: Francis Dupont <[hidden email]>
Sent: 22 January 2021 11:53
To: Søren Andersen <[hidden email]>
Cc: Francis Dupont <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: [Kea-users] Support for multiple flex options parameters?
 
[EKSTERN MAIL]


S?ren Andersen writes:
> Also for the same dhcp-option like this?
>
> options:
> - code: 67
>   add: "ifelse(member('cm'),concat('/docsis/', hexstring(pkt4.mac, '')),'' =
> )"
> - code: 67
>   add: "ifelse(member('voip'),concat('/', concat(hexstring(pkt4.mac, ''), '=
> .bin')),'')"

=> I do not think this will work because the hook implementation uses
a per code std::map for the configuration so the second entry will
overwrite the first one.

Thanks

Francis Dupont <[hidden email]>

PS: it will silently overwrite the std::map entry. If you think it should
warn please open ticket (gitlab issue). BTW I think that in all cases
it is possible to merge entries for the same code but I agree it can
quickly become hard to do...

_______________________________________________
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
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users