<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>okay, thank you for checking.  </span></div><div class="yahoo_quoted" style="display: block;"> <br> <br> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Monday, December 16, 2013 3:27 PM, Simon Kelley <simon@thekelleys.org.uk> wrote:<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div class="y_msg_container">On 16/12/13 21:00, Maule Mark wrote:<br clear="none">> As an alternative to a fake tag to remove the empty field, would it work<br
 clear="none">> to declare a static dhcp-range in my configuration file to cover the<br clear="none">> addresses that are managed by the hostsfile?<br clear="none">><br clear="none"><br clear="none">No. As you'd expect, lease times configured for individual hosts <br clear="none">override those in dhcp-ranges.<br clear="none"><br clear="none">I looked at the code, and it looks like the problem is indeed the double <br clear="none">comma.<br clear="none"><br clear="none">,,<br clear="none"><br clear="none">gets treated that same as<br clear="none"><br clear="none">,0,<br clear="none"><br clear="none">ie a lease time of zero.<br clear="none"><br clear="none">That's a bug, but the easiest way for you to work around it is to avoid <br clear="none">the double comma.<br clear="none"><br clear="none">Cheers,<br clear="none"><br clear="none">Simon.<br clear="none"><br clear="none">><br clear="none">> On Monday, December 16, 2013 2:47 PM, Maule
 Mark <<a shape="rect" ymailto="mailto:mark_maule@yahoo.com" href="mailto:mark_maule@yahoo.com">mark_maule@yahoo.com</a>><br clear="none">> wrote:<br clear="none">><br clear="none">>     I don't think our client is asking for a lease time.  Or if it was,<br clear="none">>     I would also expect it to make the request on the very first<br clear="none">>     DHCPREQUEST, which gets the correct 1h lease.<br clear="none">><br clear="none">>     The double comma is to establish a placeholder field where we can<br clear="none">>     plug in an optional tag: field, which we do in certain situations to<br clear="none">>     influence the next dhcp exchange for this id.  The program we use to<br clear="none">>     manage this file rigidly expects each line to have the same number<br clear="none">>     of fields if this optional tag
 exists or not..  I'll try putting a<br clear="none">>     fake tag in that field and see if it solves the 2m lease time issue.<br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none">>     On Monday, December 16, 2013 2:28 PM, Simon Kelley<br clear="none">>     <<a shape="rect" ymailto="mailto:simon@thekelleys.org.uk" href="mailto:simon@thekelleys.org.uk">simon@thekelleys.org.uk</a>> wrote:<br clear="none">><br clear="none">>         On 16/12/13 19:36, Maule Mark wrote:<br clear="none">>          > I'm seeing an unexptected (to me) behavior when using a dnsmasq<br clear="none">>          > hostsfile and dhcp.  To start, my interface (pmi_if) is<br clear="none">>         configured with<br clear="none">>          > a
 lease time of 1h (the default), and I have a blank hostsfile.<br clear="none">>          ><br clear="none">>          > dhcp-leasefile=/var/lib/axiom/dnsmasq_pmi.leases<br clear="none">>          > dhcp-hostsfile=/var/lib/axiom/dnsmasq_pmi_hostsfile<br clear="none">>          > dhcp-range=172.30.80.0,static,255.255.255.0<br clear="none">>          > dhcp-range=172.30.80.200,172.30.80.240,255.255.255.0<br clear="none">>          > dhcp-lease-max=255<br clear="none">>          > dhcp-option=option:dns-server,172.30.80.1<br clear="none">>          > dhcp-option=option:router,172.30.80.1<br clear="none">>          > dhcp-option=option:ntp-server,172.30.80.1,172.30.80.2,172.30.80.3<br
 clear="none">>          > dhcp-option=option:default-ttl,50<br clear="none">>          > dhcp-option=option:all-subnets-local,1<br clear="none">>          > dhcp-script=/var/lib/axiom/dhcp-script-pmi.sh<br clear="none">>          > dhcp-boot=/pds/pxe/pxelinux.0,172.30.80.1<br clear="none">>          ><br clear="none">>          > Clients boot and are assigned dhcp addresses as expected.  We<br clear="none">>         have a<br clear="none">>          > program in our software stack that looks for heartbeat<br clear="none">>         messages on this<br clear="none">>          > pmi_if, and when detected, constructs a hostsfile entry for<br
 clear="none">>         the client<br clear="none">>          > that looks like this:<br clear="none">>          ><br clear="none">>          > [<a shape="rect" ymailto="mailto:root@pilot2" href="mailto:root@pilot2">root@pilot2</a> <mailto:<a shape="rect" ymailto="mailto:root@pilot2" href="mailto:root@pilot2">root@pilot2</a>> axiom]# cat<br clear="none">>         dnsmasq_pmi_hostsfile<br clear="none">>          ><br clear="none">>         00:21:28:A1:F3:F2,00:21:28:A1:F3:F3,,WN5080020001592690,172.30.80.128<br clear="none">>          ><br clear="none">>         00:21:28:A1:CA:3A,00:21:28:A1:CA:3B,,WN5080020001592691,172.30.80.129<br clear="none">>          ><br
 clear="none">>          > The clients are running udhcpc from busybox.<br clear="none">>          ><br clear="none">>          > Everything works as expected until the clients get toward the<br clear="none">>         end of<br clear="none">>          > their 1h lease period at which point the clients start sending<br clear="none">>          > DHCPREQUEST requests.  It seems at this point, that the<br clear="none">>         leases granted<br clear="none">>          > are now 120s.  Here's some syslog output showing the first<br clear="none">>         DHCPREQUEST<br clear="none">>          > being sent about 55 minutes into the 1h initial lease.  Why<br
 clear="none">>         did dnsmasq<br clear="none">>          > return a lease time of 12s in this case?<br clear="none">>          ><br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817<br clear="none">>          > DHCPREQUEST(pmi_if) 172.30.80.129 00:21:28:a1:ca:3a<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817<br clear="none">>          > tags: known, pmi_if<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817<br
 clear="none">>          > DHCPACK(pmi_if) 172.30.80.129 00:21:28:a1:ca:3a<br clear="none">>         WN5080020001592691<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817<br clear="none">>          > requested options: 1:netmask, 3:router, 6:dns-server,<br clear="none">>         12:hostname,<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817<br clear="none">>          > requested options: 15:domain-name, 28:broadcast, 42:ntp-server<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br
 clear="none">>         208328817<br clear="none">>          > bootfile name: /pds/pxe/pxelinux.0<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817<br clear="none">>          > server name: 172.30.80.1<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 next<br clear="none">>          > server: 172.30.80.3<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  1 option: 53 message-type  5<br
 clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option: 54 server-identifier  172.30.80.3<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option: 51 lease-time  2m<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option: 58 T1  56s<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2
 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option: 59 T2  1m41s<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option:  1 netmask  255.255.255.0<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option: 28 broadcast  172.30.80.255<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br
 clear="none">>          > size:  5 option: 15 domain-name  axiom<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size: 18 option: 12 hostname  WN5080020001592691<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size: 20 option:209  70:78:65:6c:69:6e:75:78:2e:63:66:67:2f:64...<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          >
 size:  4 option:208  f1:00:74:7e<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size: 12 option: 42 ntp-server  172.30.80.1, 172.30.80.2,<br clear="none">>         172.30.80.3<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4 option:  3 router  172.30.80.1<br clear="none">>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:<br clear="none">>         208328817 sent<br clear="none">>          > size:  4
 option:  6 dns-server  172.30.80.1<br clear="none">>          ><br clear="none">>          ><br clear="none">>          > Is there a default lease time of 120s for client requests whose<br clear="none">>          > addresses which match a hoststfile entry?.<br clear="none">><br clear="none">>         No, there's no 120s default, but there is a 120s floor (ie no<br clear="none">>         lease less<br clear="none">>         the 120s will be issued).<br clear="none">><br clear="none">>         Note that the DHCP _client_ can ask for a particular lease time, it<br clear="none">>         would be interesting to see if it's sending a lease-time option<br clear="none">>         for
 120s<br clear="none">>         or less in the DHCPREQUEST packet.<br clear="none">><br clear="none">>         Another potential issue is your hostfile:<br clear="none">><br clear="none">>         00:21:28:A1:CA:3A,00:21:28:A1:CA:3B,,WN5080020001592691,172.30.80.129<br clear="none">><br clear="none">>         I've not looked, but the double comma may concievably confuse<br clear="none">>         the parser<br clear="none">>         such that it looks like a zero, which then gets interpreted as a<br clear="none">>         lease<br clear="none">>         time, and transformed to 120s by the floor.<br clear="none">><br clear="none">>         I think that is the most likely explanation.<br clear="none">><br clear="none">>   
      Cheers,<br clear="none">><br clear="none">>         Simon.<br clear="none">><br clear="none">><br clear="none">>          ><br clear="none">>          > thanks<br clear="none">>          > Mark<br clear="none">><br clear="none">>          ><br clear="none">>          ><br clear="none">>          ><br clear="none">>          > _______________________________________________<br clear="none">>          > Dnsmasq-discuss mailing list<br clear="none">>          > <a shape="rect" ymailto="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a><br
 clear="none">>         <mailto:<a shape="rect" ymailto="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a>><br clear="none">>          > <a shape="rect" href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" target="_blank">http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss</a><br clear="none">>          ><br clear="none">><br clear="none">><br clear="none">>         _______________________________________________<br clear="none">>         Dnsmasq-discuss mailing list<br clear="none">>         <a shape="rect" ymailto="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a><br
 clear="none">>         <mailto:<a shape="rect" ymailto="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a>><br clear="none">>         <a shape="rect" href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" target="_blank">http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss</a><br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none">>     _______________________________________________<br clear="none">>     Dnsmasq-discuss mailing list<br clear="none">>     <a shape="rect" ymailto="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a><br clear="none">>     <mailto:<a shape="rect"
 ymailto="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a>><div class="yqt7755640248" id="yqtfd37803"><br clear="none">>     <a shape="rect" href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" target="_blank">http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss</a><br clear="none">><br clear="none">><br clear="none"><br clear="none"></div><br><br></div> </blockquote>  </div> </div>   </div> </div></body></html>