<div dir="ltr">Btw - I have another problem with the 'blocking approach' I am doing above. Since the DHCP request gets blocked, the client tend to send another request, possibly thinking that Dnsmasq has probably not got the request. That leads to multiple iptables command being executed for the same client. This also lead to some discrepancies a few times & I have to write some extra code to keep it all sane. <div><br></div><div>I understand that the dhcp script would solve this problem as there would only be 1 execution of the script for a client. But then, the blocking thing would go for a toss.</div><div><br></div><div>Is there a middle path where I could get both the above features working ?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 30, 2016 at 10:01 AM, Ashish Sharma <span dir="ltr"><<a href="mailto:pocha.sharma@gmail.com" target="_blank">pocha.sharma@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Aug 30, 2016 at 9:30 AM, <a href="mailto:richardvoigt@gmail.com" target="_blank">richardvoigt@gmail.com</a> <span dir="ltr"><<a href="mailto:richardvoigt@gmail.com" target="_blank">richardvoigt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Not relevant to the issue you still face, but I just wanted to point out that triggering commands (such as iptables rule creation) based on leases being issued can be done using either the dhcp-script or DBus messaging, without having to hack the dnsmasq code itself. </div></blockquote><div> </div></span><div>Thanks for this. As a hacker-dev, I do have tendency to start looking into the code & not read the docs. I looked at the doc & this is what it says </div><div>---------</div><div><span style="color:rgb(0,0,0);font-family:Times;font-size:medium">The script is not invoked concurrently: at most one instance of the script is ever running (dnsmasq waits for an instance of script to exit before running the next)</span><br></div><div><span style="color:rgb(0,0,0);font-family:Times;font-size:medium">-------</span></div><div><span style="color:rgb(0,0,0);font-family:Times;font-size:medium">For my case - the DHCP process need to block till I have created the rules otherwise, the internet wont work for the right client post IP has been assigned to them. </span></div><span class=""><div><span style="color:rgb(0,0,0);font-family:Times;font-size:medium"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Actually, looking at the man page, some enhancements have been made to that functionality in newer versions. Quite possibly the arp-add action might have exactly the information you need for creating rules to match these pseudo-routed packets.</div></div></blockquote><div><br></div></span><div>Are you pointing to my original problem of figuring out the host IP address of a virtual machine here ? I am unable to find any such reference on the doc. Mind passing a small example. </div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Aug 29, 2016 at 10:41 AM, Ashish Sharma <span dir="ltr"><<a href="mailto:pocha.sharma@gmail.com" target="_blank">pocha.sharma@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr">Hi, <div><br></div><div> I have been running Dnsmasq on Openwrt (opensource router OS). It also acts as DHCP server. </div><div><br></div><div> Once a client connects, I need to whitelist his ip & mac through iptables depending on a few criteria. I am able to hack this part out by calling appropriate iptables command before the DHCP ACK packets are being sent in Dnsmasq code. </div><div><br></div><div> The issue with virtual machines in bridged mode connecting is - while Dnsmasq resolve their mac address as the true address, the packets that iptables see mac source of the packets as that of the host. </div><div><br></div><div> Now I have two options - either fiddle with Dnsmasq to see if it could figure out the host mac address & eventually use that with iptables command, or fiddle with iptables to see if it could identify the virtual machine packets . I figured, changing Dnsmasq would lead to lesser probability of breaking things as it would just happen while the client connects, while packets will keep on coming & going all the time. </div><div> </div><div> Can someone help me on this. Advance thanks.</div><span><font color="#888888"><div><br></div><div>Ashish</div></font></span><div><br></div><div>P.S. - if someone knows a better way of doing it, I am ready to discard my work so far & start from scratch. </div><div><br></div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
Dnsmasq-discuss mailing list<br>
<a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" target="_blank">Dnsmasq-discuss@lists.thekelle<wbr>ys.org.uk</a><br>
<a href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" rel="noreferrer" target="_blank">http://lists.thekelleys.org.uk<wbr>/mailman/listinfo/dnsmasq-disc<wbr>uss</a><br>
<br></blockquote></div><br></div>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div>