[kea-dev] [Potential Spoof] hook library question: parsing DHO_DHCP_AGENT_OPTIONS sub options in incoming packets
Angelo Failla
pallotron at fb.com
Thu Nov 3 11:38:09 UTC 2016
I forgot to mention that for various reasons we are still on 0.9.2 (so I am not sure if this works on 1.0)
--
Angelo Failla
Cluster Infrastructure - Dublin
Pallotron at fb.com
On 11/3/16, 11:34 AM, "kea-dev on behalf of Angelo Failla" <kea-dev-bounces at lists.isc.org on behalf of pallotron at fb.com> wrote:
Hi,
I have a question about retrieving DHO_DHCP_AGENT_OPTIONS from an incoming dhcpv4 DISCOVER packet.
I have this code in my hook library:
OptionPtr rai = query4_ptr->getOption(DHO_DHCP_AGENT_OPTIONS);
OptionPtr circuit_id_opt = rai->getOption(RAI_OPTION_AGENT_CIRCUIT_ID);
OptionPtr remote_id_opt = rai->getOption(RAI_OPTION_REMOTE_ID);
But both circuit_id_opt and remote_id_opt are empty.
What am I doing wrong?
Option 82 contains 2 suboptions in my case.
I am writing unit tests for my own hook library:
On the client side:
// Create a sample DHCPv4 option 82 with suboptions. Shamelessly copied from
// KEA test suit.
static OptionBuffer createAgentInformationOption() {
const uint8_t opt_data[] = {
0x52, 0x28, // Agent Information Option (length = 40)
// Suboptions start here...
0x01, 0x11, // Agent Circuit ID (length = 17)
// "Ethernet10:2026"
0x00, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x31, 0x30,
0x3a, 0x32, 0x30, 0x32, 0x36,
0x02, 0x13, // Agent Remote ID (length = 19)
// "00:1c:73:8c:d0:e5"
0x00, 0x11, 0x30, 0x30, 0x3a, 0x31, 0x63, 0x3a, 0x37, 0x33, 0x3a, 0x38,
0x63, 0x3a, 0x64, 0x30, 0x3a, 0x65, 0x35
};
// total length = 42
return (OptionBuffer(opt_data, opt_data + sizeof(opt_data)));
}
// add options 82 (both suboptions) to the request.
OptionBuffer agent_info_buf = createAgentInformationOption();
auto agent_info = boost::make_shared<Option>(
Option::V4, DHO_DHCP_AGENT_OPTIONS, agent_info_buf);
query->addOption(agent_info);
On the server side I am trying to get them but as I wrote before it’s not working.
I can write my own code to parse the buffer but before doing that I wanted to ask here ☺
Regards
--
Angelo Failla
Cluster Infrastructure - Dublin
Pallotron at fb.com
_______________________________________________
kea-dev mailing list
kea-dev at lists.isc.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.isc.org_mailman_listinfo_kea-2Ddev&d=DQIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=XQHjLQh2eTTW8a0c8kaZ9Q&m=2rtYEJ6Ai2r6t0rAfGX1ougjVkyNFkGDoplAUapvryk&s=kfmRQkfDpNpnDc1igpQMv2Z50vKNV89iFbv6E53GAZQ&e=
More information about the kea-dev
mailing list