cannot be modified.
- <b>Next step action</b>: if any callout installed on the "pkt4_send" hook
- sets the next step action to SKIP or DROP, the server will not construct the raw
+ sets the next step action to SKIP, the server will not construct the raw
buffer. The expectation is that if the callout set skip flag, it is
responsible for constructing raw form on its own. Otherwise the output
- packet will be sent with zero length.
+ packet will be sent with zero length. If any callout set the next step action
+ to DROP, the server will drop the packet.
@subsection dhcpv4HooksBuffer4Send buffer4_send
-// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Thu Jan 23 2020 15:28
+// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Jan 31 2020 15:04
#include <cstddef>
#include <log/message_types.h>
extern const isc::log::MessageID DHCP4_HOOK_LEASES4_COMMITTED_DROP = "DHCP4_HOOK_LEASES4_COMMITTED_DROP";
extern const isc::log::MessageID DHCP4_HOOK_LEASES4_COMMITTED_PARK = "DHCP4_HOOK_LEASES4_COMMITTED_PARK";
extern const isc::log::MessageID DHCP4_HOOK_PACKET_RCVD_SKIP = "DHCP4_HOOK_PACKET_RCVD_SKIP";
+extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_DROP = "DHCP4_HOOK_PACKET_SEND_DROP";
extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_SKIP = "DHCP4_HOOK_PACKET_SEND_SKIP";
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_DROP = "DHCP4_HOOK_SUBNET4_SELECT_DROP";
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_SKIP = "DHCP4_HOOK_SUBNET4_SELECT_SKIP";
"DHCP4_HOOK_LEASES4_COMMITTED_DROP", "%1: packet is dropped, because a callout set the next step to DROP",
"DHCP4_HOOK_LEASES4_COMMITTED_PARK", "%1: packet is parked, because a callout set the next step to PARK",
"DHCP4_HOOK_PACKET_RCVD_SKIP", "%1: packet is dropped, because a callout set the next step to SKIP",
+ "DHCP4_HOOK_PACKET_SEND_DROP", "%1: prepared DHCPv4 response was not sent because a callout set the next ste to DROP",
"DHCP4_HOOK_PACKET_SEND_SKIP", "%1: prepared response is not sent, because a callout set the next stp to SKIP",
"DHCP4_HOOK_SUBNET4_SELECT_DROP", "%1: packet was dropped, because a callout set the next step to 'drop'",
"DHCP4_HOOK_SUBNET4_SELECT_SKIP", "%1: no subnet was selected, because a callout set the next skip flag",
-// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Thu Jan 23 2020 15:28
+// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Jan 31 2020 15:04
#ifndef DHCP4_MESSAGES_H
#define DHCP4_MESSAGES_H
extern const isc::log::MessageID DHCP4_HOOK_LEASES4_COMMITTED_DROP;
extern const isc::log::MessageID DHCP4_HOOK_LEASES4_COMMITTED_PARK;
extern const isc::log::MessageID DHCP4_HOOK_PACKET_RCVD_SKIP;
+extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_DROP;
extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_SKIP;
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_DROP;
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_SKIP;
hook point sets the next step to SKIP. For this particular hook point, the
value setting of the flag instructs the server to drop the packet.
+% DHCP4_HOOK_PACKET_SEND_DROP %1: prepared DHCPv4 response was not sent because a callout set the next ste to DROP
+This debug message is printed when a callout installed on the pkt4_send
+hook point set the next step to DROP. For this particular hook point, the setting
+of the value by a callout instructs the server to drop the packet. This
+effectively means that the client will not get any response, even though
+the server processed client's request and acted on it (e.g. possibly
+allocated a lease). The argument specifies the client and transaction
+identification information.
+
% DHCP4_HOOK_PACKET_SEND_SKIP %1: prepared response is not sent, because a callout set the next stp to SKIP
This debug message is printed when a callout installed on the pkt4_send
hook point sets the next step to SKIP. For this particular hook point, this
*callout_handle);
// Callouts decided to skip the next processing step. The next
- // processing step would to pack the packet, so skip at this
- // stage means "skip packing, the hook already did that".
- if ((callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) ||
- (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP)) {
- LOG_DEBUG(hooks_logger, DBG_DHCP4_HOOKS,
- DHCP4_HOOK_PACKET_SEND_SKIP)
+ // processing step would to pack the packet (create wire data).
+ // That step will be skipped if any callout sets skip flag.
+ // It essentially means that the callout already did packing,
+ // so the server does not have to do it again.
+ if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) {
+ LOG_DEBUG(hooks_logger, DBG_DHCP4_HOOKS, DHCP4_HOOK_PACKET_SEND_SKIP)
.arg(query->getLabel());
skip_pack = true;
}
+
+ /// Callouts decided to drop the packet.
+ if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
+ LOG_DEBUG(hooks_logger, DBG_DHCP4_HOOKS, DHCP4_HOOK_PACKET_SEND_DROP)
+ .arg(rsp->getLabel());
+ rsp.reset();
+ return;
+ }
+
}
if (!skip_pack) {
// In particular, it should call registered pkt4_send callback.
srv_->run();
- // Check that the server sent the message
- ASSERT_EQ(1, srv_->fake_sent_.size());
-
- // Get the first packet and check that it has zero length (i.e. the server
- // did not do packing on its own)
- Pkt4Ptr sent = srv_->fake_sent_.front();
- EXPECT_EQ(0, sent->getBuffer().getLength());
+ // Check that the server did not the message
+ ASSERT_EQ(0, srv_->fake_sent_.size());
// Check if the callout handle state was reset after the callout.
checkCalloutHandleReset(sol);