Skip to content

Fix regex parsing of lease file mixing up lease entries#90

Merged
Gerrit91 merged 3 commits intomasterfrom
remove-regex
Jan 14, 2026
Merged

Fix regex parsing of lease file mixing up lease entries#90
Gerrit91 merged 3 commits intomasterfrom
remove-regex

Conversation

@Gerrit91
Copy link
Contributor

@Gerrit91 Gerrit91 commented Jan 9, 2026

Description

The regex is erroneous and potentially dangerous. Sometimes the isc-dhcp-server can produce lease entries with a hardware ethernet line. For example:

lease 10.0.0.129 {
  starts 4 2026/01/08 14:43:55;
  ends 5 2026/01/09 14:43:55;
  cltt 4 2026/01/08 14:43:55;
  binding state abandoned;
  next binding state free;
  rewind binding state free;
}
lease 10.0.0.1 {
  starts 4 2026/01/08 14:44:02;
  ends 6 2026/01/10 14:44:02;
  cltt 4 2026/01/08 14:44:02;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:00:00:00:00:01;
  uid "\001<\354\357\202\006 ";
}

The regex then parses in a lease with IP 10.0.0.129 and mac address 00:00:00:00:00:01. Potential lease entries between are dropped. The association is broken.

@metal-robot metal-robot bot added this to Development Jan 9, 2026
@Gerrit91 Gerrit91 changed the title Replace lease file parser with something that is not using regex. Fix regex parsing of lease file dropping lease entries Jan 9, 2026
@Gerrit91 Gerrit91 changed the title Fix regex parsing of lease file dropping lease entries Fix regex parsing of lease file mixing up lease entries Jan 9, 2026
@majst01
Copy link
Contributor

majst01 commented Jan 10, 2026

Was done once in the past here #52 but closed with the hope of migrating to kea.

Another option would be IMHO to integrate a dhcp server into metal-bmc, for example with the help of https://github.com/coredhcp/coredhcp. With this approach we would not have to parse anything and deployment could be potentially easier.

@Gerrit91
Copy link
Contributor Author

I am not sure who should drive the kea migration. I would be better for sure but we have so many topics to work that I am not sure if we can do it.

Integrating the DHCP server into metal-bmc would mean that we cannot put the dhcp server and metal-bmc in different locations anymore, which might be an issue for some setups.

@majst01
Copy link
Contributor

majst01 commented Jan 12, 2026

I am not sure who should drive the kea migration. I would be better for sure but we have so many topics to work that I am not sure if we can do it.

Integrating the DHCP server into metal-bmc would mean that we cannot put the dhcp server and metal-bmc in different locations anymore, which might be an issue for some setups.

Agreed with both

@iljarotar iljarotar moved this to In Progress in Development Jan 12, 2026
@iljarotar iljarotar requested a review from majst01 January 12, 2026 13:18
@Gerrit91 Gerrit91 self-assigned this Jan 12, 2026
@Gerrit91 Gerrit91 marked this pull request as ready for review January 12, 2026 14:38
@Gerrit91 Gerrit91 requested a review from a team as a code owner January 12, 2026 14:38
@Gerrit91 Gerrit91 merged commit 5737f57 into master Jan 14, 2026
1 check passed
@Gerrit91 Gerrit91 deleted the remove-regex branch January 14, 2026 12:19
@github-project-automation github-project-automation bot moved this from In Progress to Done in Development Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants