mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 22:45:18 +00:00
[898-add-a-new-hook-to-support-bootp] Checkpoint: reviewed change and addressed comment, to do import BOOTP class stuff from !522
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
.. _hooks-bootp:
|
.. _bootp-library:
|
||||||
|
|
||||||
BOOTP support
|
BOOTP support
|
||||||
=============
|
=============
|
||||||
@@ -37,9 +37,9 @@ It takes no parameter.
|
|||||||
|
|
||||||
.. _hooks-bootp-config:
|
.. _hooks-bootp-config:
|
||||||
|
|
||||||
Incoming BOOTP packets are added to the BOOTP class. Incoming packets that
|
Incoming BOOTP packets are added to the BOOTP class. This can be used
|
||||||
are DHCP packets are added to the DHCP class. This can be used to segregate
|
to segregate BOOTP clients to separate pool. For example you can do
|
||||||
BOOTP clients to separate pool. For example you can do the following:
|
the following:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
@@ -72,11 +72,13 @@ BOOTP Hooks Limitations
|
|||||||
|
|
||||||
Currently the BOOTP library has the following limitations:
|
Currently the BOOTP library has the following limitations:
|
||||||
|
|
||||||
- BOOTP protocol assumes all lease assignments are permanent. Kea does not support
|
- BOOTP protocol assumes all lease assignments are permanent. Kea does
|
||||||
infinite leases yet. You may configure arbitrarily long leases (e.g. a year), but
|
not support infinite leases yet. You may configure arbitrarily long
|
||||||
after the lease lifetime elapses, Kea will recycle the lease and may assign it
|
leases (e.g. a year), but after the lease lifetime elapses, Kea will
|
||||||
to some other device. This limitation will be removed in the near future.
|
recycle the lease and may assign it to some other device. This
|
||||||
|
limitation will be removed in the near future.
|
||||||
|
|
||||||
- A basic BOOTP as defined in `RFC 951 <https://tools.ietf.org/html/rfc951>`__ is
|
- A basic BOOTP as defined in `RFC 951
|
||||||
not supported. Kea only supports the BOOTP with vendor extensions. Depending on
|
<https://tools.ietf.org/html/rfc951>`__ is not supported. Kea only
|
||||||
|
supports the BOOTP with vendor information extensions. Depending on
|
||||||
the demand, this may or may not be implemented in the future.
|
the demand, this may or may not be implemented in the future.
|
||||||
|
@@ -74,6 +74,7 @@ language = None
|
|||||||
exclude_patterns = [
|
exclude_patterns = [
|
||||||
'_build', 'Thumbs.db', '.DS_Store',
|
'_build', 'Thumbs.db', '.DS_Store',
|
||||||
# included files need to be excluded to avoid duplicate labels
|
# included files need to be excluded to avoid duplicate labels
|
||||||
|
'arm/hooks-bootp.rst',
|
||||||
'arm/hooks-class-cmds.rst',
|
'arm/hooks-class-cmds.rst',
|
||||||
'arm/hooks-cb-cmds.rst',
|
'arm/hooks-cb-cmds.rst',
|
||||||
'arm/config-backend.rst',
|
'arm/config-backend.rst',
|
||||||
|
@@ -37,7 +37,6 @@ int pkt4_receive(CalloutHandle& handle) {
|
|||||||
try {
|
try {
|
||||||
if (query->getType() != DHCP_NOTYPE) {
|
if (query->getType() != DHCP_NOTYPE) {
|
||||||
// DHCP query.
|
// DHCP query.
|
||||||
query->addClass("DHCP");
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (query->getOp() == BOOTREPLY) {
|
if (query->getOp() == BOOTREPLY) {
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param pkt The packet to submit.
|
/// @param pkt The packet to submit.
|
||||||
/// @param processed True if the packet must be processed, false otherwise.
|
/// @param processed True if the packet must be processed, false otherwise.
|
||||||
void pkt4_receiveCall(Pkt4Ptr& pkt, bool processed, bool dhcp) {
|
void pkt4_receiveCall(Pkt4Ptr& pkt, bool processed) {
|
||||||
// Get callout handle.
|
// Get callout handle.
|
||||||
CalloutHandle handle(getCalloutManager());
|
CalloutHandle handle(getCalloutManager());
|
||||||
|
|
||||||
@@ -73,12 +73,6 @@ public:
|
|||||||
EXPECT_FALSE(pkt->inClass("BOOTP"));
|
EXPECT_FALSE(pkt->inClass("BOOTP"));
|
||||||
EXPECT_EQ(type, pkt->getType());
|
EXPECT_EQ(type, pkt->getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dhcp) {
|
|
||||||
EXPECT_TRUE(pkt->inClass("DHCP"));
|
|
||||||
} else {
|
|
||||||
EXPECT_FALSE(pkt->inClass("DHCP"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Callout manager accessed by this CalloutHandle.
|
/// @brief Callout manager accessed by this CalloutHandle.
|
||||||
@@ -88,39 +82,39 @@ public:
|
|||||||
// Verifies that DHCPDISCOVER goes through unmodified.
|
// Verifies that DHCPDISCOVER goes through unmodified.
|
||||||
TEST_F(BootpTest, dhcpDiscover) {
|
TEST_F(BootpTest, dhcpDiscover) {
|
||||||
Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 12345));
|
Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 12345));
|
||||||
pkt4_receiveCall(pkt, false, true);
|
pkt4_receiveCall(pkt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifies that DHCPREQUEST goes through unmodified.
|
// Verifies that DHCPREQUEST goes through unmodified.
|
||||||
TEST_F(BootpTest, dhcpRequest) {
|
TEST_F(BootpTest, dhcpRequest) {
|
||||||
Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 12345));
|
Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 12345));
|
||||||
pkt4_receiveCall(pkt, false, true);
|
pkt4_receiveCall(pkt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifies that DHCPOFFER goes through unmodified.
|
// Verifies that DHCPOFFER goes through unmodified.
|
||||||
TEST_F(BootpTest, dhcpOffer) {
|
TEST_F(BootpTest, dhcpOffer) {
|
||||||
Pkt4Ptr pkt(new Pkt4(DHCPOFFER, 12345));
|
Pkt4Ptr pkt(new Pkt4(DHCPOFFER, 12345));
|
||||||
pkt4_receiveCall(pkt, false, true);
|
pkt4_receiveCall(pkt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifies that BOOTREPLY goes through unmodified.
|
// Verifies that BOOTREPLY goes through unmodified.
|
||||||
TEST_F(BootpTest, bootReply) {
|
TEST_F(BootpTest, bootReply) {
|
||||||
// The constructor does not allow to directly create a BOOTREPLY packet.
|
// The constructor does not allow to directly create a BOOTREPLY packet.
|
||||||
Pkt4Ptr pkt(new Pkt4(DHCPOFFER, 12345));
|
Pkt4Ptr pkt(new Pkt4(DHCPOFFER, 12345));
|
||||||
//pkt->setType(DHCP_NOTYPE);
|
pkt->setType(DHCP_NOTYPE);
|
||||||
pkt->delOption(DHO_DHCP_MESSAGE_TYPE);
|
pkt->delOption(DHO_DHCP_MESSAGE_TYPE);
|
||||||
ASSERT_EQ(BOOTREPLY, pkt->getOp());
|
ASSERT_EQ(BOOTREPLY, pkt->getOp());
|
||||||
pkt4_receiveCall(pkt, false, false);
|
pkt4_receiveCall(pkt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifies that BOOTREQUEST is recognized and processed.
|
// Verifies that BOOTREQUEST is recognized and processed.
|
||||||
TEST_F(BootpTest, bootRequest) {
|
TEST_F(BootpTest, bootRequest) {
|
||||||
// The constructor does not allow to directly create a BOOTREQUEST packet.
|
// The constructor does not allow to directly create a BOOTREQUEST packet.
|
||||||
Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 12345));
|
Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 12345));
|
||||||
// pkt->setType(DHCP_NOTYPE);
|
pkt->setType(DHCP_NOTYPE);
|
||||||
pkt->delOption(DHO_DHCP_MESSAGE_TYPE);
|
pkt->delOption(DHO_DHCP_MESSAGE_TYPE);
|
||||||
ASSERT_EQ(BOOTREQUEST, pkt->getOp());
|
ASSERT_EQ(BOOTREQUEST, pkt->getOp());
|
||||||
pkt4_receiveCall(pkt, true, false);
|
pkt4_receiveCall(pkt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
Reference in New Issue
Block a user