<div dir="ltr">Hi Glenn<div><br></div><div>Haha :) It never occurred to me that this could be something "that simple" :)</div><div><br></div><div>Well in this case I have to do a litte bit more string processing with tr, od, cut and all that ugly built in shell commands</div><div><br></div><div>Thank you very much</div><div>/BR</div><div>Philippe</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 12 Oct 2021 at 02:28, Glenn Satchell <<a href="mailto:glenn.satchell@uniq.com.au">glenn.satchell@uniq.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif;color:black">Hi Philipp</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif;color:black">Nothing fishy going on, more a "feature" of the routine that prints out byte strings in omshell.</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif;color:black">For example the ip address is printed as 1f:19:7b:b7 - if you convert each of these hexadecimal values to a decimal integer you get 31 25 123 183. The print routine tries to be clever and if a byte value is in the range of an ascii character it prints the ascii character rather than the hexadecimal value.</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">So taking the ends value "adTf", each of these characters has an ascii value a=0x61, d=0x64, T=0x54, f=0x66. These represent the 4 bytes making up an integer. If the string was printed as hexadecimal values it would be 61:64:54:66. Converting 0x61645466 to a 32 bit integer using my trusty hex calculator we get 1633965158 which is the number of seconds since the epoch. Finally we convert this to a date in the UTC time zone</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">$ date -d @1633965158 -u</span><br><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">Mon 11 Oct 2021 15:12:38 UTC</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">which matches the value in the lease file.</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">Why does it work this way? Well, my guess is the function that prints out the values of the various lease parameters is not that smart and doesn't always know that a particular value represents a string of text, binary data, or a time, so it uses a fairly generic routine that (sort of) works some of the time. You can see another variation of this in the leases file where the uid is printed as a series of octal digits with the \ooo syntax for each byte.</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">regards,</span></p>
<p><span style="font-size:10pt;font-family:verdana,geneva,sans-serif">Glenn</span></p>
<p id="gmail-m_8606921547740104955reply-intro">On 2021-10-12 01:54, Philippe Maechler wrote:</p>
<blockquote type="cite" style="padding:0px 0.4em;border-left:2px solid rgb(16,16,255);margin:0px">
<div id="gmail-m_8606921547740104955replybody1">
<div dir="ltr">
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">Hello bind-users</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">Since a while I'm having troubles getting the right lease-time by omapi for some? maybe all leases...</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">pmaechler@stageing:/ % /usr/local/bin/omshell</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> server 10.20.0.251</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> port XXXX</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> key omapi_key XXXXXXXXXXXXXXXXXXXXXX</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> connect</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">obj: <null></span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> new lease</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">obj: lease</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> set ip-address = 31.25.123.183</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">obj: lease</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">ip-address = 1f:19:7b:b7</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> open</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">obj: lease</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">ip-address = 1f:19:7b:b7</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">state = 00:00:00:02</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">dhcp-client-identifier = 01:e0:91:f5:dc:a1:e1</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">subnet = 00:00:00:2e</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">pool = 00:00:00:2f</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">billing-class = 00:00:00:30</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">hardware-address = e0:91:f5:dc:a1:e1</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">hardware-type = 00:00:00:01</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">ends = "adTf"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">starts = "adFV"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">tstp = 00:00:00:00</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">tsfp = 00:00:00:00</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">atsfp = 00:00:00:00</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">cltt = "adFV"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">flags = 00</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">circuit = "some stupid string from our access devices"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">clhw = "e0:91:f5:dc:a1:e1"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">clip = "31.25.123.183"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">vendor-class-identifier = "udhcp 0.9.8"</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">What kinda bothers me is the lease-times ends, starts and cltt</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">Checking it directly in the leasefile results in</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">lease 31.25.123.183 {</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> starts 1 2021/10/11 14:12:38;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> ends 1 2021/10/11 15:12:38;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> cltt 1 2021/10/11 14:12:38;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> binding state active;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> next binding state free;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> rewind binding state free;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> billing subclass "XXXXX_XXXXXX_XXXXXX_CPE_DHCP" "another stupid string";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> </span><span style="font-size:10pt;font-family:"Courier New"">hardware ethernet e0:91:f5:dc:a1:e1;</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> </span><span style="font-size:10pt;font-family:"Courier New"">uid "\001\340\221\365\334\241\341";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> set remote = "";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> set circuit = "you can guess, again that thing";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> set clhw = "e0:91:f5:dc:a1:e1";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> set clip = "31.25.123.183";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> set vendor-class-identifier = "udhcp 0.9.8";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New""> option agent.circuit-id "again that stupid string";</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:"Courier New"">}</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm"><span style="font-family:Arial,sans-serif"><span style="font-size:13.3333px">we have 4 active servers all with their own pools, no failover and no overlapping pools.</span></span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">The dhcpd servers in use are running either ISC DHCP Server 4.4.1 or 4.4.2 </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">The client has 4.4.2-P1 installed, only for the omapi binaries</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">Without further debugging into the version mismatch, it feels like only "some" lease-times are strange, but not all. </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif">Could this be due to the different versions or is something else "fishy"?</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><a name="m_8606921547740104955__MailAutoSig"></a><span style="font-size:10pt;font-family:Arial,sans-serif;color:black">Best regards</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black">Philipp</span></p>
<p style="margin:0cm;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> </span></p>
</div>
</div>
<br>
<div style="margin:0px;padding:0px;font-family:monospace">_______________________________________________<br>ISC funds the development of this software with paid support subscriptions. Contact us at <a href="https://www.isc.org/contact/" rel="noopener noreferrer" target="_blank">https://www.isc.org/contact/</a> for more information.<br><br>dhcp-users mailing list<br><a href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a><br><a href="https://lists.isc.org/mailman/listinfo/dhcp-users" rel="noopener noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a></div>
</blockquote>
</div>
_______________________________________________<br>
ISC funds the development of this software with paid support subscriptions. Contact us at <a href="https://www.isc.org/contact/" rel="noreferrer" target="_blank">https://www.isc.org/contact/</a> for more information.<br>
<br>
dhcp-users mailing list<br>
<a href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a><br>
</blockquote></div>