Clarification on odhcpd

I am trying to get the odhcpd file location which is allocating/assigning ip address to the client.
Can anyone pls point me the reference. Currently I'm using odhcpd-2015-05-21.
Thanks in advance.

Thanks for your response.
I am trying to add a new action to be carried out during assignment of IPv6 address to the client.
So, looking for the source file used for allocating the ip inside odhcpd-2015-05-21.

"During" (before) the assignment?
or "after the assignment"?

There is already a trigger defined for action after an address assignment, and that is used for triggering a dnsmasq reload after each ipv6 address allocation. /usr/sbin/odhcpd-update in a live router

https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/odhcpd/files/odhcpd-update;h=9bc7abcc1c3a85c77a3e8b791393768f7afec570;hb=HEAD

Although you are using a really ancient version of odhcpd, that trigger (or at least its early version) should already be there. Current odhcpd version in the stable 18.06.0 is v1.10 from 2018-07-26.

Or are you looking at the address database to set some values before the assignment for the assignment itself?

1 Like

Thanks hnyman.

My router having '/usr/sbin/odhcpd-update', but it doesnt seems to be executed when I am connecting a client. Verified this with echo inside odhcpd-update.

#!/bin/sh
# Make dnsmasq reread hostfile
pid=$(pidof dnsmasq)
[ "$(readlink /proc/$pid/exe)" = "/usr/sbin/dnsmasq" ] && kill -SIGHUP $pid

Actually, I need to get the client mac and its assigned IPv6 address as soon as the client connects to the router. Please advise.

I am trying to get the client MAC address which is getting IPv6 ip from odhcpd.
Is there any way to get it from dhcpv6.c or dhcpdv6-ia.c.

I can get only the link-layer address which i may not need for my purpose.
Thanks in advance.