DHCPv6 request dropped with rfc7217 link-local addresses and too long flex-id
name: dhcpv6 request dropped with rfc7217 link-local address
about: DHCPv6 message dropped with rfc7217 link-local addresses and too long flex-id
Describe the bug
When flex-id is used for static host reservation in combination with replace-client-id set to true and the client has a link-local address that doesn't match the hardware address (actually the mac address), kea wil drop the message with the following message:
ERROR DHCP6_PACKET_PROCESS_STD_EXCEPTION exception occurred during packet processing: hwaddr length exceeds MAX_HWADDR_LEN
This only happens when the evaluated flex-id value exceeds MAX_HWADDR_LEN (which appears to be set to 20 in kea 2.0.0).
To Reproduce
Steps to reproduce the behavior:
- Run kea-dhcp6 with the following flex-id configuration:
{
"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_flex_id.so",
"parameters": {
// Obviously this can be anything, as long as the result exceeds the max of 20 chars
"identifier-expression": "substring(relay6[0].option[37].hex, 4, all)",
"replace-client-id": true
}
}
- Generate and send a DHCPv6 request which causes the flex-id to exceed MAX_HWADDR_LEN, with a client identifier option containing a duid which contains the proper hardware address (DUID-LLT or DUID-LL will do) from a link-local address based on rfc7217.
- The server receives the request, evaluates flex-id and replaces the duid with the evaluated flex-id value.
- It then breaks with the forementioned error message and the request is then dropped.
Expected behavior
The server is not supposed to break in this kind of a situation.
Environment:
- Kea version (from the ISC provided packages):
2.0.0
tarball
linked with:
log4cplus 1.1.2
OpenSSL 1.1.1d 10 Sep 2019
database:
MySQL backend 12.0, library 10.3.29
PostgreSQL backend 6.2, library 110012
Memfile backend 2.1
- OS: Debian 10.10 on x86_64.
- Features: See ISC provided packages.
- hooks: legal log, flex-id, host_cmds
Additional Information
Complete debug log message:
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCP6_BUFFER_RECEIVED received buffer from 2001:db8:1:8::23:547 to 2001:db8:3:117::117:1:0 over interface eth0
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCP6_BUFFER_UNPACK parsing buffer received from 2001:db8:1:8::23 to 2001:db8:3:117::117:1 over interface eth0
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCP6_PACKET_RECEIVED duid=[00:01:00:01:29:2e:5d:11:dc:a6:32:dd:8c:c3], tid=0x6df500: SOLICIT (type 1) received from 2001:db8:1:8::23 to 2001:db8:3:117::117:1 on interface eth0
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCP6_QUERY_DATA duid=[00:01:00:01:29:2e:5d:11:dc:a6:32:dd:8c:c3], tid=0x6df500, packet details: localAddr=[2001:db8:3:117::117:1]:0 remoteAddr=[2001:db8:1:8::23]:547
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: msgtype=1(SOLICIT), transid=0x6df500
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00001, len=00014: 00:01:00:01:29:2e:5d:11:dc:a6:32:dd:8c:c3
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00003(IA_NA), len=00012: iaid=1, t1=0, t2=0
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00006, len=00010: 23(uint16) 24(uint16) 39(uint16) 82(uint16) 83(uint16)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00008, len=00002: 49244 (uint16)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00014, len=00000:
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=16, len=4, enterprise id=0x9f08
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00020, len=00000:
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00025(IA_PD), len=00012: iaid=2, t1=0, t2=0
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00037, len=00026: 941806 (uint32) 616C722D6F66662D61737730323B323033343B302F36 (binary)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=39(CLIENT_FQDN), flags: (N=0, O=0, S=1), domain-name='pi-port-6' (partial)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: 1 relay(s):
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: relay[0]: msg-type=12(RELAY_FORWARD), hop-count=0,
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: link-address=2001:db8:1:8::23, peer-address=fe80::57a1:95ad:1fc4:13d1, 2 option(s)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00018, len=00008: 76:6c:61:6e:32:30:33:34
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: type=00037, len=00026: 941806 (uint32) 616C722D6F66662D61737730323B323033343B302F36 (binary)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG HOOKS_CALLOUTS_BEGIN begin all callouts for hook pkt6_receive
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG HOOKS_CALLOUT_CALLED hooks library with index 1 has called a callout on hook pkt6_receive that has address 0x7f0a5a0bc9a0 (callout duration: 0.048 ms)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG EVAL_DEBUG_OPTION Pushing option 37 with value 0x000E5EEE616C722D6F66662D61737730323B323033343B302F36
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG EVAL_DEBUG_STRING Pushing text string '4'
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG EVAL_DEBUG_STRING Pushing text string 'all'
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG EVAL_DEBUG_SUBSTRING Popping length all, start 4, string 0x000E5EEE616C722D6F66662D61737730323B323033343B302F36 pushing result 0x616C722D6F66662D61737730323B323033343B302F36
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG FLEX_ID_EXPRESSION_EVALUATED Expression evaluated for packet to "alr-off-asw02;2034;0/6" (size: 22)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG FLEX_ID_EXPRESSION_HEX evaluated expression in hexadecimal form "61:6c:72:2d:6f:66:66:2d:61:73:77:30:32:3b:32:30:33:34:3b:30:2f:36"
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG FLEX_ID_USED_AS_DUID using flexible identifier "00:00:61:6c:72:2d:6f:66:66:2d:61:73:77:30:32:3b:32:30:33:34:3b:30:2f:36" as DUID
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG HOOKS_CALLOUT_CALLED hooks library with index 2 has called a callout on hook pkt6_receive that has address 0x7f0a5a074700 (callout duration: 0.389 ms)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG HOOKS_CALLOUTS_COMPLETE completed callouts for hook pkt6_receive (total callouts duration: 0.437 ms)
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCPSRV_CFGMGR_SUBNET6_RELAY selected subnet 2001:db8:1:b::/64, because of matching relay addr 2001:db8:1:8::23
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCP6_SUBNET_SELECTED duid=[00:00:61:6c:72:2d:6f:66:66:2d:61:73:77:30:32:3b:32:30:33:34:3b:30:2f:36], tid=0x6df500: the subnet with ID 1 was selected for client assignments
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: DEBUG DHCP6_SUBNET_DATA duid [00:00:61:6c:72:2d:6f:66:66:2d:61:73:77:30:32:3b:32:30:33:34:3b:30:2f:36], tid=0x6df500: the selected subnet details: 2001:db8:1:b::/64
Nov 22 16:00:20 dhcpradius kea-dhcp6[18922]: ERROR DHCP6_PACKET_PROCESS_STD_EXCEPTION exception occurred during packet processing: hwaddr length exceeds MAX_HWADDR_LEN
The request in this case was relayed and received via unicast by kea. The mac address of the client can be derived from the duid and the link-local address can be found in the log above.
Contacting you
Sending a message on github or replying in this ticket is ok.