The same hook library loaded multiple times potentially results in unintended behavior
Multiple loads of the same hook library is currently possible, but may result in unintended behavior.
For example, here is a case where a CB command gets the wrong response:
- Configure a Kea server with the same
libdhcp_class_cmds.so
loaded twice. - Configure a class with
remote-class4-set
. - Delete the class with
remote-class4-del
. The delete is successful as can be seen by packets not being classified with the deleted class. But the response to the delete command is:
{
"arguments": {
"count": 0
},
"result": 3,
"text": "0 DHCPv4 client class(es) deleted."
}
Logs show that one entry is deleted in the first callout, and no entry is deleted in the second callout. What probably happens is that the response to the first deletion gets discarded and the given response corresponds to the second deletion.
DEBUG HOOKS_CALLOUTS_BEGIN begin all callouts for hook $remote_class4_del
DEBUG MYSQL_CB_DELETE_CLIENT_CLASS4 delete client class: foo
DEBUG DATABASE_MYSQL_START_TRANSACTION starting new MySQL transaction
DEBUG DATABASE_MYSQL_COMMIT committing to MySQL database
DEBUG MYSQL_CB_DELETE_CLIENT_CLASS4_RESULT deleted: 1 entries
DEBUG HOOKS_CALLOUT_CALLED hooks library with index 1 has called a callout on hook $remote_class4_del that has address 0x7f875611843c (callout duration: 8.716 ms)
DEBUG MYSQL_CB_DELETE_CLIENT_CLASS4 delete client class: foo
DEBUG DATABASE_MYSQL_START_TRANSACTION starting new MySQL transaction
DEBUG DATABASE_MYSQL_COMMIT committing to MySQL database
DEBUG MYSQL_CB_DELETE_CLIENT_CLASS4_RESULT deleted: 0 entries
DEBUG HOOKS_CALLOUT_CALLED hooks library with index 8 has called a callout on hook $remote_class4_del that has address 0x7f875611843c (callout duration: 1.972 ms)
DEBUG HOOKS_CALLOUTS_COMPLETE completed callouts for hook $remote_class4_del (total calloutsduration: 10.688 ms)