[HELP] hooks to log and parse received dhcp response messages by dhclient

Hi,
on freebsd, I need to parse custom option received in dhcp response. for the same i want to develop script to log and parse received message. As mentioned in document i've used below configuration in /etc/dhclient.conf. its triggering the script but no passing received dhcp messages as argument. How do i get it workig same?

Code:
cat /etc/dhclient.conf
#
#       This file is required by the ISC DHCP client.
#       See ``man 5 dhclient.conf'' for details.
#
#       In most cases an empty file is sufficient for most people as the
#       defaults are usually fine.
#
script "/usr/local/bin/dhcp-response-handler.sh";

**********************************************
#!/bin/sh
# dhcp-response-handler.sh

LOGFILE="/var/log/dhcp_response.log"

echo "Received DHCP response at $(date):" >> $LOGFILE
echo $# >> $LOGFILE
echo "  Raw message: $@" >> $LOGFILE
***************************************************************

Received DHCP response at Sat Sep 21 12:56:18 +06 2024:
0
  Raw message:
 
i looked into it but couldn't get it working. May be some thing additional configuration required on freebsd system. reference of working example will help to try out same.
 
on my BSD VM(14.1), i don't have /sbin/dhclient-script. I feel I'm missing some thing here. How do i correct it so that it'll invoke my scripts under /etc/dhclient-exit-hooks.d
execve (/sbin/dhclient-script, ...): No such file or directory
exiting.
 
You could read the man page. No such thing as /etc/dhclient-exit-hooks.d/.

Code:
       Before  taking  action according	to $reason, dhclient-script will check
       for the existence of /etc/dhclient-enter-hooks.	If found, it  will  be
       sourced	(see  sh(1)).	After  taking  action  according  to  $reason,
       dhclient-script	   will	    check     for     the     existence	    of
       /etc/dhclient-exit-hooks.   If  found,  it will be sourced (see sh(1)).
       These hooks scripts can be used to dynamically modify  the  environment
       at appropriate times during the DHCP negotiations.  For example,	if the
       administrator wishes to disable alias IP	numbers	on the DHCP interface,
       they might want to put the following in /etc/dhclient-enter-hooks:

	     [ ."$reason" = .PREINIT ] && ifconfig $interface 0.0.0.0

       The  usual  way to test a lease is to set up the	network	as with	REBIND
       (since this may be called to test more than one lease)  and  then  ping
       the  first  router defined in $routers.	If a response is received, the
       lease must be valid for the network to which the	interface is currently
       connected.  It would be more complete to	try to ping all	of the routers
       listed in $new_routers, as well as those	listed in  $new_static_routes,
       but current scripts do not do this.
 
Back
Top