DDNS execute statement on release

classic Classic list List threaded Threaded
3 messages Options
it
Reply | Threaded
Open this post in threaded view
|

DDNS execute statement on release

it
Setting up DDNS for Samba domain using internal dhcp-eval mechanism.

dhcpcd.conf contains next expressions:
===
...
on commit {
     set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
     set ClientName = pick-first-value(option host-name, host-decl-name,
"none");
     execute("/usr/local/bin/dhcp-update.sh", "add", ClientIP,
ClientName);
}

on release {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientName = pick-first-value(option host-name, host-decl-name,
"none");
execute("/usr/local/bin/dhcp-update.sh", "del", ClientIP, ClientName);
...
===

On commit everything is OK:
===
Feb 16 16:09:45 aura dhcpd: execute_statement argv[0] =
/usr/local/bin/dhcp-update.sh
Feb 16 16:09:45 aura dhcpd: execute_statement argv[1] = add
Feb 16 16:09:45 aura dhcpd: execute_statement argv[2] = 10.5.100.93
Feb 16 16:09:45 aura dhcpd: execute_statement argv[3] = user-7-pc-test
==

Script works, receives all needed arguments and adds records to DNS. But
on release same code doesn't work:
===
Feb 16 16:09:51 aura dhcpd: execute_statement argv[0] =
/usr/local/bin/dhcp-update.sh
Feb 16 16:09:51 aura dhcpd: execute_statement argv[1] = del
Feb 16 16:09:51 aura dhcpd: execute_statement argv[2] = 10.5.100.93
Feb 16 16:09:51 aura dhcpd: execute_statement argv[3] = none
===
dhcp-update.sh script doesn't receive argv[3] from DHCP (host name,
given to host by DHCP-server). But dhcp-lease-list (before releasing
address) shows lease about this machine, including hostname.

Why DHCP-server doesn't give hostname on release ?
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: DDNS execute statement on release

devnono
hi all,

i have the same problem whith latest dhcpd 4.3.5

the "on commit" is ok

but "on release" and  "on expiry" is bad

impossible to retrieve ipv6 address !!

somebody have a solution ?

best regards

=> devnono
Reply | Threaded
Open this post in threaded view
|

Re: DDNS execute statement on release

devnono
hi,

god is with me !

i found one solution

in "on commit" section add a expression :  
-> set dhcp6_IP = binary-to-ascii(16,16, ":", substring(suffix(option dhcp6.ia-na, 24),0,16));

this expression is stored globaly in commit event
and visible and evaluated in all other events section

        # ******************************************************
        on commit {
        # ******************************************************
                log(concat("\t",">>>>>>>>>>>>>[ START COMMIT ]>>>>>>>>>>>>>","dhcp6_IP= ",dhcp6_IP));

                set dhcp6_IP = binary-to-ascii(16,16, ":", substring(suffix(option dhcp6.ia-na, 24),0,16));
               
                log(concat("**** COMMIT IP ia_na=", dhcp6_IP));
               
                execute("notify.sh","commit",dhcp6_IP );
               
                log("\t <<<<<<<<<<<[ END COMMIT ]<<<<<<<<<<<");
        }  #on commit

        # ******************************************************
        on expiry {
        # ******************************************************
             log(concat("\t",">>>>>>>>>>>>>[ START EXPIRY ]>>>>>>>>>>>>>","dhcp6_IP= ",dhcp6_IP));
 
                execute("notify","expiry", dhcp6_IP );

                #log("\t <<<<<<<<<<<[ END expiry ]<<<<<<<<<<<");
        } # on expiry

        # ******************************************************
        on release {
        # ******************************************************
                log(concat("\t",">>>>>>>>>>>>>[ START RELEASE ]>>>>>>>>>>>>>","dhcp6_IP= ",dhcp6_IP));
                log(concat("***** RELEASE : dhcp6_IP= ", dhcp6_IP));

                execute("notify","release",dhcp6_IP );

          log("\t <<<<<<<<<<<[ END release ]<<<<<<<<<<<");
        } # on release

 this work for me !!!!!

==> devnono