[Dnsmasq-discuss] old event to dhcp-script on lease expiry
Simon Kelley
simon at thekelleys.org.uk
Fri Jun 27 18:02:55 UTC 2014
On 27/06/14 08:27, Nehal J Wani wrote:
> Hi!
>
> I am trying to understand whether an 'old' event is generated or not
> when a lease expires. To experiment this, I used
> Dnsmasq version 2.72test3-5-gcdb755c
> I launch dnsmasq like this:
> sudo /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default6.conf
> --dhcp-script=/tmp/script.sh
>
> Contents of script:
> #!/bin/bash echo $@ >> /tmp/out
> env >> /tmp/out
> echo "--------------------------------------------" >> /tmp/out
>
> Contents of default6.conf:
> strict-order pid-file=/var/run/libvirt/network/default6.pid
> except-interface=lo bind-dynamic interface=virbr3
> dhcp-range=192.168.150.128,192.168.150.254,2m
> dhcp-no-override
> dhcp-range=2001:db8:ca2:2:1::10,2001:db8:ca2:2:1::ff,2m
> dhcp-leasefile=/var/lib/libvirt/dnsmasq/default6.leases
> dhcp-lease-max=367
> dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default6.hostsfile
> addn-hosts=/var/lib/libvirt/dnsmasq/default6.addnhosts enable-ra
>
> When I run 'service network restart' inside my guest machine, I see
> that the script is exec'ed with 'old' event. Now, I see that the lease
> file /var/lib/libvirt/dnsmasq/default6.leases keeps getting updated
> after every 2 minutes, since the lease expires, but the script
> /tmp/script.sh doesn't get invoked when the lease gets renewed. Is
> this expected? I don't see any 'old' event for the renewed lease.
>
> Regards,
> Nehal J Wani
>
An "old" event is not generated when a lease is _renewed_ (ie when the
only thing that changes is the expiration time) unless the option
leasefile-ro is set. Note that setting leasefile-ro has a bunch of other
effects too.
When a lease _expires_ (ie the end time of the lease is reached without
it being renewed) then a a "del" event is generated.
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list