Bug #23166

Case sensitive and MAC addresses

Added by Romke van Dijk almost 2 years ago. Updated almost 2 years ago.

Target version:
Bugzilla link:
Fixed in Releases:
Found in Releases:


Hi there,

Been running into a bug with Hyper-V, dhcp-isc and Foreman 1.16. (All running latest version on Debian 9 or Windows Server 2016). Creating a host from the Foreman interface works just as intended, the VM is created and the boots correctly and I am able to start the Debian preseed for the host. However, during the final step of the unattended installation, a finish script will run: calling the foreman api and telling it that the build has finished. During this step, foreman finishes the machine. One of the step that it does is delete the DCHP lease and recreate it removing the requirement for provising. This is where the bug occurs.

Hyper-V output the MAC in uppercase, while ISC-DHCP records the in lowercase. The Foreman Proxy API seems to be case sensitive when it comes to MAC addresses. So whenever you request Foreman for the lowcase MAC address, the tell you that the mac address does not exist:

$ curl -k --cert /etc/puppetlabs/puppet/ssl/certs/ --key /etc/puppetlabs/puppet/ssl/private_keys/
$ No DHCP record for MAC 

And if we request it with lower case:

curl -k --cert /etc/puppetlabs/puppet/ssl/certs/ --key /etc/puppetlabs/puppet/ssl/private_keys/

But what happens when you sent a delete for this record that 'does not exist'?

$ curl -k -XDELETE --cert /etc/puppetlabs/puppet/ssl/certs/ --key /etc/puppetlabs/puppet/ssl/private_keys/
$ echo $?
$ 0

Looking at the log file of the foreman proxy, you will see just a simple http 200 response for this call, but no communication has be done to the DHCP server. This is because Foreman 'thinks' that the record isn't there and thus not delete it. The next call after that is recreating the DHCP lease, but this time ISC-DHCP will tell you: 'no gonna happen, this lease already exist'. Resulting in the API returning an error and making the provision fail.

You can argue that the problem is with hyper-v, but mac addresses are not case sensitive and the foreman proxy API should not be case sensitive (for MAC addresses). How do you think about this?

Related issues

Related to Smart Proxy - Refactor #23187: Mac addresses passed to/returned from dhcp providers should be normalizedNew2018-04-09

Associated revisions

Revision 8a4bd9c1 (diff)
Added by Lukas Zapletal almost 2 years ago

Fixes #23166 - MAC DHCP CRUD not case sensitive


#1 Updated by Romke van Dijk almost 2 years ago

  • Description updated (diff)

#2 Updated by Lukas Zapletal almost 2 years ago

  • Category set to DHCP

Hello there, nice analysis. Valid bug, perhaps the best solution is change on proxy side to default case which is being returned by ISC DHCP which is our "defacto standard" DHCP plugin.

#3 Updated by The Foreman Bot almost 2 years ago

  • Assignee set to Lukas Zapletal
  • Status changed from New to Ready For Testing
  • Pull request added

#4 Updated by Anonymous almost 2 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#5 Updated by Dmitri Dolguikh almost 2 years ago

  • Related to Refactor #23187: Mac addresses passed to/returned from dhcp providers should be normalized added

Also available in: Atom PDF