<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 9/26/2014 7:50 AM, Espen Tallaksen
wrote:<br>
</div>
<blockquote
cite="mid:CACH2PFhyo8FkLRbAjNTt0gqu0YQb1T5NYcFwUPV5nOhtjHwqGg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi
<div>Regarding DHCPv6 i would like to do different things inside
'on commit' event braces based on what the server actually is
commiting (Non-temporary Address or Prefix-delegation).<br>
<div>Does anybody know if there's a way to know if an 'on
commit' event happened because of committing an IA-NA or
IA-PD?</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>This is what i try:</div>
<div><br>
</div>
<div>
<div>on commit {</div>
<div> if option dhcp6.ia-na = option dhcp6.ia-na{</div>
<div><span class="" style="white-space:pre"> </span>set iana
= binary-to-ascii(16,16,":",substring(suffix(option
dhcp6.ia-na,24),0,16));</div>
<div><span class="" style="white-space:pre"> </span>}<br>
</div>
<div><span class="" style="white-space:pre"> </span>if option
dhcp6.ia-pd = option dhcp6.ia-pd{</div>
<div><span class="" style="white-space:pre"> </span>
set iapd = binary-to-ascii(16,16,":", suffix(option
dhcp6.ia-pd,16));</div>
<div><span class="" style="white-space:pre"> </span>set
pdsize = binary-to-ascii(10,8,":",substring(suffix(option
dhcp6.ia-pd,17),0,1));</div>
<div><span class="" style="white-space:pre"> </span>set pdnet
= concat(iapd, "/", pdsize);</div>
<div><span class="" style="white-space:pre"> </span>}<br>
</div>
<div><br>
</div>
<div><span class="" style="white-space:pre"> </span>set cm =
v6relay(1, (binary-to-ascii(16, 8, ":", option
docsis.cm-mac-address)));<br>
</div>
<div><span class="" style="white-space:pre"> </span>set
ifname = v6relay(1, option dhcp6.interface-id);</div>
<div><span class="" style="white-space:pre"> </span>set lla =
(binary-to-ascii(16, 8, ":", suffix(option dhcp6.client-id,
6)));</div>
<div><br>
</div>
<div> if option dhcp6.ia-na = option dhcp6.ia-na{</div>
<div><span class="" style="white-space:pre"> </span>execute("something",
ARG-LIST...);<br>
</div>
<div><span class="" style="white-space:pre"> </span>}<br>
</div>
<div><span class="" style="white-space:pre"> </span>}</div>
<div><span class="" style="white-space:pre"> </span>if option
dhcp6.ia-pd = option dhcp6.ia-pd{</div>
<div><span class="" style="white-space:pre"> </span>
execute("something", ARG-LIST...);<br>
</div>
<div><span class="" style="white-space:pre"> </span>}<br>
</div>
<div><span class="" style="white-space:pre"> </span>}</div>
<div><span class="" style="white-space:pre"> </span></div>
<div> }<br>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>My problem is that if clients happens to request for both
IA Address and IA Prefix inside the same dhcpv6 request (which
i find quite usual), both execute statements will be executed
for both commit events (commit for IA-NA, and commit for
IA-PD). Result is that execute statements are blocking the
daemon more than nescesary.</div>
<div><br>
</div>
<div>Any thoughts?</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Best Regards</div>
<div>Espen Tallaksen</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org">dhcp-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users">https://lists.isc.org/mailman/listinfo/dhcp-users</a></pre>
</blockquote>
Won't these always be true:<br>
<font color="#993300">if option dhcp6.ia-na = option dhcp6.ia-na{</font><br>
<br>
<font color="#993300"><span class="" style="white-space:pre"></span>if
option dhcp6.ia-pd = option dhcp6.ia-pd{</font><br>
<br>
<br>
<br>
<tt><a class="moz-txt-link-freetext" href="http://linux.die.net/man/5/dhcp-eval">http://linux.die.net/man/5/dhcp-eval</a></tt><br>
Perhaps use an elsif for the 2nd test:<br>
<tt>if option dhcp6.ia-na = option dhcp6.ia-na{</tt>
<div><tt><big><span class="" style="white-space:pre"> </span>execute("something",
ARG-LIST...);<br>
</big></tt></div>
<tt><big><span class="" style="white-space:pre"> </span>}<br>
</big></tt><tt><br>
</tt><tt>} elsif option dhcp6.ia-pd = option dhcp6.ia-pd{</tt><tt><br>
</tt><tt><br>
</tt>
<div><tt><big><span class="" style="white-space:pre"> </span>
execute("something", ARG-LIST...);<br>
</big></tt></div>
<div><tt><big><span class="" style="white-space:pre"> </span>}<br>
</big></tt></div>
<tt>}</tt><tt><br>
</tt>
<div><br>
</div>
<pre class="code">Bill
</pre>
<br>
</body>
</html>