Some MAC's are stored in database in wrong format. Not possible to dump and restore mysql database.
name: dhcp_identifier Bug
about: Not possible to dump and restore mysql database.
Describe the bug
Some MAC's are stored in wrong format. DHCP client can get an IP Address within LEASE. This is OK. But if we want to dump SQL database and restore database on different server then we can't because 'pOW!y'
is not varbinary(128)
Row from mysqldump:
INSERT INTO `hosts` (host_id, dhcp_identifier, dhcp_identifier_type, dhcp4_subnet_id, dhcp6_subnet_id, ipv4_address, hostname, dhcp4_client_classes, dhcp6_client_classes, dhcp4_next_server, dhcp4_server_hostname, dhcp4_boot_file_name, user_context, auth_key) VALUES
(807, 'pOW!y', 0, 967, NULL, 1681927831, 'cpe-l1wnx.example.com', NULL, NULL, NULL, 'dhcp.example.com', NULL, NULL, NULL),
To Reproduce
RUN
INSERT INTO `hosts` (host_id, dhcp_identifier, dhcp_identifier_type, dhcp4_subnet_id, dhcp6_subnet_id, ipv4_address, hostname, dhcp4_client_classes, dhcp6_client_classes, dhcp4_next_server, dhcp4_server_hostname, dhcp4_boot_file_name, user_context, auth_key) VALUES
(807, 0x704f57217f79, 0, 967, NULL, 1681927831, "cpe-l1wnx.example.com", NULL, NULL, NULL, "dhcp.example.com", NULL, NULL, NULL);
AFTER insert SELECT:
SELECT * FROM `hosts` WHERE hostname = 'cpe-l1wnx.example.com';
Result:
host_id,dhcp_identifier,dhcp_identifier_type,dhcp4_subnet_id,dhcp6_subnet_id,ipv4_address,hostname,dhcp4_client_classes,dhcp6_client_classes,dhcp4_next_server,dhcp4_server_hostname,dhcp4_boot_file_name,user_context,auth_key
807,pOW!y,0,967,NULL,1681927831,cpe-l1wnx.example.com,NULL,NULL,NULL,dhcp.example.com,NULL,NULL,NULL
Expected behavior
MAC 70:4F:57:21:7F:79
should be stored in dhcp_identifier as 0x704f57217f79
and not as 'pOW!y'. MacVendor is telling that it's TP-LINK TECHNOLOGIES CO.,LTD. so I believe that MAC is right.
Environment:
- Kea version: 1.9.11
- OS: Ubuntu 20.04
- SQL: MariaDB 10.5.9