Score:1

What is the exact meaning of "On Commit" in ISC DHCP server configuration?

vu flag

I know there are three kinds of events we can use for scripting in ISC dhcpd -- commit, expire and lease. My problem is, I am having a little problem in understanding the "commit" event. I know "commit" event means when the server has made a commitment of a certain lease to a client. But it would be easier to understand this in DORA context.

That means, when the "commit" event will trigger in ISC DHCP server? Is it when the dhcpd is ready to offer a lease to a client? or after it has leased IP to a client?

For example, in the following configuration -

on commit {
    set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
    set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
    execute("/usr/sbin/test.py", "commit", ClientIP, ClientMac);
}

when exactly will the test.py script will execute? Before the DHCP ACK packet exits from DHCP server or after DHCP OFFER packet exits from DHCP server?

Thanks in advance. Cheers :)

anx avatar
fr flag
anx
Looks like `execute_statements(on_commit)` precedes `send_packet*` in `server/dhcp*.c`. You can probably prove it works the way you want by prefixing your test command with a `sleep()` and noting the delay on sending the packet.
Elon20 avatar
vu flag
Thanks for your comment @anx. I downloaded the dhcp-4.4.2b1, but couldn't find " _execute_statements(on_commit)_" or " _send_packet*_" string in **server/dhcp.c** or **server/dhcpd.c** . Can you mention which c file you are referring to in the server directory?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.