bootp, ha and lease_query use buffer_receive hook to set skip flag to bypass classification and do unpack anyway updating stats
There are several issues with this approach:
- all hooks need to update stats on DROP flag on buffer_receive hook
- core update of stats (proper fix for all hooks) would double increment stats for the ha, lease_query and bootp
- these hooks use SKIP flag to bypass classification, so the SKIP flag (which is also meant for unpack) has no meaning as the unpacking is already done explicitly by the book.
The fix would require:
- no stats update in hooks
- stats update on DROP flag in core
- ha, bootp and lease_query should use another hook point to skip classification which is triggered after unpacking
- buffer_receive
- internal core unpack
- classification_hook
- internal core classification
- pkt_receive
core code that need to update stats:
// Call callouts
HooksManager::callCallouts(Hooks.hook_index_buffer4_receive_,
*callout_handle);
// Callouts decided to drop the received packet.
// The response (rsp) is null so the caller (run_one) will
// immediately return too.
if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
LOG_DEBUG(hooks_logger, DBG_DHCP4_DETAIL,
DHCP4_HOOK_BUFFER_RCVD_DROP)
.arg(query->getRemoteAddr().toText())
.arg(query->getLocalAddr().toText())
.arg(query->getIface());
return;
}
in v6, the fix is already in core, but stats are still updated in hooks, which makes double increment on packet drop.