<div dir="ltr">Hi<div>Thanks for reply.<br><div>From my understanding, "if option dhcp6.ia-na = option dhcp6.ia-na" will return false if the option does not exist. However, it might be more convenient to use "if exist option dhcp6.ia-na".</div></div><div>Regarding suggestion for 2nd test by using elsif, in my theory i think i'll never hit that test if both IA-NA and IA-PD are inside the same dhcpv6-request. But i will give it a try, i'll let you know if it works.</div><div>Thanks again.</div><div><br></div><div>BR</div><div>Espen</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-29 14:49 GMT+02:00 Bill Shirley <span dir="ltr"><<a href="mailto:Bill@henagar.polymerindustries.biz" target="_blank">Bill@henagar.polymerindustries.biz</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <div>On 9/26/2014 7:50 AM, Espen Tallaksen
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <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 style="white-space:pre-wrap"> </span>set iana
            = binary-to-ascii(16,16,":",substring(suffix(option
            dhcp6.ia-na,24),0,16));</div>
          <div><span style="white-space:pre-wrap"> </span>}<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>if option
            dhcp6.ia-pd = option dhcp6.ia-pd{</div>
          <div><span style="white-space:pre-wrap"> </span>      
             set iapd = binary-to-ascii(16,16,":", suffix(option
            dhcp6.ia-pd,16));</div>
          <div><span style="white-space:pre-wrap"> </span>set
            pdsize = binary-to-ascii(10,8,":",substring(suffix(option
            dhcp6.ia-pd,17),0,1));</div>
          <div><span style="white-space:pre-wrap"> </span>set pdnet
            = concat(iapd, "/", pdsize);</div>
          <div><span style="white-space:pre-wrap"> </span>}<br>
          </div>
          <div><br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>set cm =
            v6relay(1, (binary-to-ascii(16, 8, ":", option
            docsis.cm-mac-address)));<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>set
            ifname = v6relay(1, option dhcp6.interface-id);</div>
          <div><span style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </span>execute("something",
            ARG-LIST...);<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>}<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </span>if option
            dhcp6.ia-pd = option dhcp6.ia-pd{</div>
          <div><span style="white-space:pre-wrap"> </span>        
            execute("something", ARG-LIST...);<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>}<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </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></fieldset>
      <br>
      </div></div><pre>_______________________________________________
dhcp-users mailing list
<a href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-users" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a></pre>
    </blockquote>
    Won't these always be true:<span class=""><br>
    <font color="#993300">if option dhcp6.ia-na = option dhcp6.ia-na{</font><br>
    <br>
    </span><span class=""><font color="#993300"><span style="white-space:pre-wrap"></span>if
      option dhcp6.ia-pd = option dhcp6.ia-pd{</font><br>
    <br>
    <br>
    <br>
    </span><tt><a href="http://linux.die.net/man/5/dhcp-eval" target="_blank">http://linux.die.net/man/5/dhcp-eval</a></tt><br>
    Perhaps use an elsif for the 2nd test:<span class=""><br>
    <tt>if option dhcp6.ia-na = option dhcp6.ia-na{</tt>
    <div><tt><big><span style="white-space:pre-wrap"> </span>execute("something",
          ARG-LIST...);<br>
        </big></tt></div>
    <tt><big><span style="white-space:pre-wrap"> </span>}<br>
      </big></tt><tt><br>
    </tt></span><tt>} elsif option dhcp6.ia-pd = option dhcp6.ia-pd{</tt><tt><br>
    </tt><tt><br>
    </tt>
    <div><tt><big><span style="white-space:pre-wrap"> </span>      
            execute("something", ARG-LIST...);<br>
        </big></tt></div>
    <div><tt><big><span style="white-space:pre-wrap"> </span>}<br>
        </big></tt></div>
    <tt>}</tt><span class="HOEnZb"><font color="#888888"><tt><br>
    </tt>
    <div><br>
    </div>
    <pre>Bill
</pre>
    <br>
  </font></span></div>

<br>_______________________________________________<br>
dhcp-users mailing list<br>
<a href="mailto:dhcp-users@lists.isc.org">dhcp-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-users" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a><br></blockquote></div><br></div>