<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal">When a DHCP release message is received that contains only a client h/w address and IP address (i.e., no Client ID provided) is there a reason why dnsmasq is not using the combination of MAC+IP to search the lease DB?   We have noticed
 that in cases where there are multiple leases against the same MAC address for different subnets that the release will fail with “unknown lease” when the search returns a lease other than the one for the client IP address.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For example, given these contents of the lease file:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">1473863856 90:e2:ba:a3:9b:d4 192.168.215.105 node0-vlan123 71:70:61:71:60:68:62:2d:30:3a:69:6e:66:72:61:90:e2:ba:a3:9b:d4<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">1473863844 90:e2:ba:a3:9b:d4 192.168.204.5 node0-vlan456 00:03:00:01:90:e2:ba:a3:9b:d4<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If the following DHCP release message is received from an invocation of “dhcp_release” without a CID:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">15:07:44.209079 00:00:00:00:00:00 > 00:00:00:00:00:00, ethertype IPv4 (0x0800), length 590: (tos 0x0, ttl 64, id 43166, offset 0, flags [DF], proto UDP (17),
 length 576) <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">    192.168.204.4.52869 > 192.168.204.4.67: [bad udp cksum 0x1b98 -> 0xf2bf!] BOOTP/DHCP, Request from 90:e2:ba:a3:9b:d4, length 548, Flags [none] (0x0000)
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">          Client-IP 192.168.204.5
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">          Client-Ethernet-Address 90:e2:ba:a3:9b:d4
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">          Vendor-rfc1048 Extensions
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">            Magic Cookie 0x63825363
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">            DHCP-Message Option 53, length 1: Release
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">            Server-ID Option 54, length 4: 192.168.204.4<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Then dnsmasq produces the following log and does not delete either of the leases. 
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:"Courier New"">2016-09-13T15:10:05.000 node1 dnsmasq-dhcp[164963]: info DHCPRELEASE(mgmt0) 192.168.204.5 90:e2:ba:a3:9b:d4 unknown lease<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My suspicion is that the search is returning the lease for the 192.168.215.105 address instead of the 192.168.204.5 address and then this code is rejecting the lease because of a mismatch between lease->addr and mess->ciaddr.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">      if (lease && lease->addr.s_addr == mess->ciaddr.s_addr)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">       lease_prune(lease, now);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">      else<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">       message = _("unknown lease");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is this a bug or intentional behavior to align with some subtlety of the DHCP/BOOTP protocol?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Allaiin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#333333">Allain Legacy</span></b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#333333">, Software Developer</span><br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#333333">direct 613.270.2279  fax
</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#333333">613.492.7870 skype allain.legacy</span><br>
 <br>
<a href="http://www.windriver.com/" title=""Innovators Start Here" "><span style="font-family:"Arial","sans-serif";color:#CC0000;text-decoration:none"><img border="0" width="160" height="92" id="Picture_x0020_1" src="cid:image001.png@01D20DBB.98C3A610" alt="WIND"></span></a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>