<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Hi Petr,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Thanks for the review.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
The patch adds a method that can be called through ubus "dnsmasq.leases()" which iterates the leases linked list and shows the available information on them. Then also extend the information in existing ubus events when a DHCP packet is processed. I will add
 more information on the patch commit commentary perhaps.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
You are right regarding the ACK options, perhaps I can derive the data in other way.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Regarding the location of the ubus_event_bcast calls I also thought of implementing as you propose, but currently it is called inside the log_packet call. Perhaps getting the ubus_event_bcast out will simplify the patch too.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
I was also wondering that the variable "extradata" may be used for the same purpose, and if so, maybe it would make sense to remake the patch using that variable instead.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
I will make these changes and submit a new patch based on master.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Eduardo.<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dnsmasq-discuss <dnsmasq-discuss-bounces@lists.thekelleys.org.uk> on behalf of Petr Menšík <pemensik@redhat.com><br>
<b>Sent:</b> Tuesday, June 15, 2021 4:26 PM<br>
<b>To:</b> dnsmasq-discuss@lists.thekelleys.org.uk <dnsmasq-discuss@lists.thekelleys.org.uk><br>
<b>Subject:</b> Re: [Dnsmasq-discuss] [PATCH] Expose more lease data through ubus</font>
<div> </div>
</div>
<div>
<p>Hi Eduardo,</p>
<p>can you rebase it to master branch?</p>
<p>Do you have any readme or summary, how that feature would be used?</p>
<p>My first note is it adds HAVE_UBUS define to lease structure, but it seems more or less unrelated to ubus itself. I could imagine similar mechanism might be interesting also for d-bus interface eventually.</p>
<p>Why does it log ACK options? Can they be different for known host? I think logging network tag would help, but otherwise sent options should be constant according to configuration. Should it store those flags again?<br>
</p>
<p>First problem is it always allocates extra info for the lease. I think it should try it only when --enable-ubus is used in configuration. I would move separate net member into ubus_extra_info structure. And move its defintion outside lease structure, use
 in struct lease {} just:<br>
</p>
<p>struct ubus_extra_info *ubus_extra_info;</p>
<p>I would use functions to free and reset ubus_extra_info inside ubus.c. It might not need to know structure definition of ubus_extra_info. Avoid complex ubus_delete_options() and free in lease.c, move it to function called ubus_free_extra_info(lease->ubus_extra_info);</p>
<p>Move implementation details to ubus, since those details are only used there. I don't like extending log_packet by lease, just because only 3 types are logged with details.</p>
<p>Why is used (string ? string : NULL) ?? use just string. It is either non-NULL or NULL anyway. I don't like assigning xid in packet_log function. It should only log, not change the records also. Is DHCPREQUEST handled by if's, but not supplied with lease
 intentional? I would expect options from request to be the most important to log.</p>
<p>I would use it like this, since it should not log every message:<br>
</p>
<p>log_packet("DHCPREQUEST", ...);<br>
#ifdef HAVE_UBUS<br>
      ubus_event_bcast("dhcp.request", daemon->namebuff, inet_ntoa(&mess->yiaddr), NULL, iface_name, lease);<br>
#endif</p>
<p>Just might thoughts after quick patch review.</p>
<p>Cheers,<br>
Petr<br>
</p>
<div class="x_moz-cite-prefix">On 6/11/21 11:59 AM, Eduardo AGUILAR wrote:<br>
</div>
<blockquote type="cite">
<pre class="x_moz-quote-pre">Hi everyone,

I tried emailing Simon directly but he seems absent.

I send a patch we are using at Soft at Home to retrieve more information about leases using ubus. We would like to have this upstreamed if possible.

We are maintaining these changes at <a class="x_moz-txt-link-freetext" href="https://fra01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fsoft.at.home%2Fforks%2Fdnsmasq%2F-%2Ftree%2Fv2.85_ubus_patch&data=04%7C01%7Ceduardo.aguilar_ext%40softathome.com%7Cc63606d7c9624651ad5208d9300eb508%7Caa10e044e4054c10835336b4d0cce511%7C0%7C0%7C637596061179056720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RWK3zcs7kkE6QZXmGRqZA5%2Fng15N11xgM6gykhbMQrY%3D&reserved=0" originalsrc="https://gitlab.com/soft.at.home/forks/dnsmasq/-/tree/v2.85_ubus_patch" shash="XRB4L6a2WhrGUzq5TdJ2qoyxBucmxg+Bd6lI+y+Ed6Gb2TA/Yg70daRpKxHhQHmKD7S0mVETDrA6PKYMlUZR76SnWAb72f+oefLR2VKDO+0F/KGBotdesAZdN9HPEvEqg2wl5wU4mTe720N/4qfojezOmNAaKfbH4BUV+n8cak0=">https://gitlab.com/soft.at.home/forks/dnsmasq/-/tree/v2.85_ubus_patch</a>

Please let me know about any feedback you may have.

Best Regards,
Eduardo.</pre>
<br>
<fieldset class="x_mimeAttachmentHeader"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
Dnsmasq-discuss mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.thekelleys.org.uk</a>
<a class="x_moz-txt-link-freetext" href="https://fra01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.thekelleys.org.uk%2Fcgi-bin%2Fmailman%2Flistinfo%2Fdnsmasq-discuss&data=04%7C01%7Ceduardo.aguilar_ext%40softathome.com%7Cc63606d7c9624651ad5208d9300eb508%7Caa10e044e4054c10835336b4d0cce511%7C0%7C0%7C637596061179056720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PLfw0Ypb51CjaNOXf%2F%2BNnif8N26MSU0AmYQgClRdcys%3D&reserved=0" originalsrc="https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss" shash="Xi4rvI+wImmxKAkqMuO/6qBDIWEzW4s2NOqHsMJswhTxfX0s48/gxLzs3ZA0BAJohntmdA/WLcJwvZcXeS6ByMgFTOYpnvwgk0iEXI4J+FEpXAQOqBv/W/sWyJOfNgy8JmtI/1AXXz/y6sdGhmMyw6jI6NN3tACrrJRFDwYnWJc=">https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss</a>
</pre>
</blockquote>
</div>
</body>
</html>