Wanna modify DHCPD to fire an event when the ip inactive

Hi.

I'm looking for a solution to execute a script when wired dhcpd's ip inactive.
(Refer : How to detect DHCP assignment to send an email on OpenWrt)
But seem that none of built solution for now.

So,
I'd like to modify/revice OpenWrt source.
Which part or point should be the right point?

Please advice me.

You can't do that without ARP probing. It has nothing to do with DHCP.

I'm not sure if I correctly understand your problem but you can use "watchcat" script and modify recovery action - don't reboot but start server dhcp

Oh?

What does "when an IP is inactive" means to you, exactly? When the machine is unplugged from the network? When it is shut down? When it does not send any traffic for a certain amount of time? When the DHCP lease expires and is not renewed?

You can play with:

shutdown_now() {
local forcedelay="$1"

reboot &

[ "$forcedelay" -ge 1 ] && {
sleep "$forcedelay"

echo b > /proc/sysrq-trigger # Will immediately reboot the system without syncing or unmounting your disks.
}
}

You are correct that the meaning of the 'inactive'.
The what I expect situation for 'inactive' is that 'turn off the wired PC'. Traffic doesn't matter. Not the lease expiration.
So that what I want is that the OpenWrt detect turned of PC which use DHCP and send e-mail to Admin.

Is this code for OpenWrt self reboot, right?

It based on "ping" "icmp". And yes when something is not pingable than device reboot.

Erm....actually, I don't really understand the purpose of the code...
What I'm looking for is that...
when OpenWrt detect the wired PC power off(or no more active dhcp)
then OpenWrt should send a email to outside. OpenWrt don't need any reboot.
So, let me know how to utilize the watchcat to my situation. Need some insight,
since the code snippet only indicate shoutdown() event.

It would be way easier by editing Windows Group Policy to send e-mail on logoff.
Since IP is a stateless protocol (There's no such thing as "active IP/DHCP"), you can't do that without periodic ARP probing

Well....Windows Policy Group and task Scheduler not working when system go into hibernate. When go into shutdown always working both. This is the origin of my problem to detect any of hibernated system.

By the way, the conclusion is that,
I have choose(and already made) the way of 'arp -a -n' way with all the combination of command line tools(arp/grep/awk/sed/regex/pipe/variables/etc.) which running deamon script for every 20 second.