"raw packet not available" when execute() on release

Nicolas C. dhcp at nryc.fr
Tue May 1 07:03:32 UTC 2012


On 01/05/2012 02:08, Glenn Satchell wrote:
> Hi Nicolas
>
> Can you post your dhcpd.conf? It depends when you call execute, if it's
> done during, for example, DHCPDISCOVER, then the packet does not contain
> an IP address yet.
>
> You can test the value of option dhcp-message-type (man dhcp-options).
> You probably only want to do a DNS update during state DHCPACK and
> DHCPRELEASE.
>
> if option dhcp-message-type = 5 {
> execute ( ..... )
> }

Hello,

This is a example of configuration, after a close look at the logs it 
seems that the "execute" works well when the client does an explicit 
DHCPRELEASE but when the client is down and the lease expires by itself, 
the mac address and the leased IPv4 address are unknown.

option domain-name "internal.domain.tld";
option domain-search "domain.tld", "internal.domain.tld";
option domain-name-servers ...;

default-lease-time 3600;
max-lease-time 7200;
authoritative;
log-facility local7;

ddns-update-style interim ;
ddns-domainname "internal.domain.tld";
deny client-updates;

failover peer "my_failover" {
         primary;
         address prim.domain.tld;
         port 647;
         peer address second.domain.tld;
         peer port 647;
         max-response-delay 30;
         max-unacked-updates 10;
         load balance max seconds 10 ;
         mclt 1800;
         split 128;
}

subnet 172.21.81.0 netmask 255.255.255.0 {
         option routers 172.21.81.72;
	set prefix = "2001:660:4407:2501";

	# See below
	include "/etc/dhcp/ddns-ipv6.conf";	

	pool {
                 range 172.21.81.73 172.21.81.253;
                 default-lease-time 3600;
                 failover peer "my_failover";
                 }
         }

zone 81.21.172.in-addr.arpa. {
  primary prim.domain.tld;
  key dhcp_update;
}


# This is the content of "/etc/dhcp/ddns-ipv6.conf

on commit {
	if (not static) {
		set new-ddns-fwd-name = pick-first-value(ddns-hostname, host-decl-name,
					concat("dhcp","-",binary-to-ascii(10,8,"-",leased-address)));
		if (exists host-name and option host-name ~~ "^[a-z0-9.-]+$") {
			set new-ddns-fwd-name = option host-name;
		} elsif (exists dhcp-client-identifier and option 
dhcp-client-identifier ~~ "^[a-z0-9.-]+$") {
			set new-ddns-fwd-name = substring(option dhcp-client-identifier, 1, 50);
		} elsif (new-ddns-fwd-name = "") {
		set new-ddns-fwd-name = binary-to-ascii (16, 8, "-",substring 
(hardware, 1, 6));
		}

		set ddns-hostname = new-ddns-fwd-name;
		execute ("/usr/local/bin/ddns-ipv6", prefix, ddns-hostname,
			ucase(binary-to-ascii(16, 8, ":", substring(hardware, 1, 6))),
			binary-to-ascii(10, 8, ".", leased-address));

		unset new-ddns-fwd-name;
		on expiry or release {
		execute ("/usr/local/bin/ddns-ipv6", prefix, "-d", ddns-hostname,
			ucase(binary-to-ascii(16, 8, ":", substring(hardware, 1, 6))),
			binary-to-ascii(10, 8, ".", leased-address));
		}
	}
}

Regards,

Nicolas


More information about the dhcp-users mailing list