<br>substring = substring fomr charcter x to character y (not y characters long).  So substring( ... 2,7) is 6 bytes long, substring( ..., 5,5) is 1 character long as expected.  I'm actually using the same substrings in my log statement (not included below) and it prints exactly the parts I want.<br>
<br>Why am I converting to ascii? Because that's what I found in an example. I tried without converting but then I didn't seem to get a match. :-).  I'm not so worried about performance as there will be about 100 clients max anyway.<br>
<br>As you can see at the bottom of my initial mail I'm actually reasonably sure the class definition is correct as I also have a log statement (not included below) which logs a message when the right client does a dhcp request. If a change anything in the class definition or remove the 'allow ...' from the pool or if another client tries to do dhcp it doesn't log.   So it seems the dhcp server does properly match the client's option 82 info and MAC address, it just doesn't seem to do anything with it.<br>
<br>Please do correct me if I'm wrong.<br><br>Nico<br><br><div class="gmail_quote">On Sun, Dec 16, 2012 at 2:47 PM, Sten Carlsen <span dir="ltr"><<a href="mailto:stenc@s-carlsen.dk" target="_blank">stenc@s-carlsen.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFCC" text="#000000"><div class="im">
    <br>
    <div>On 16/12/12 14:17, Nico De Ranter
      wrote:<br>
    </div>
    <blockquote type="cite"><br>
      Hi,<br>
      <br>
      <br>
      <br>
      I'm trying to use DHCP option 82 to assign a different address to
      a host depending on which network port it is connected to.<br>
      I'vve created the following section in my config:<br>
      <br>
      ############<br>
      stash-agent-options true;<br>
      ...<br>
      subnet 10.103.0.0 netmask 255.255.255.0<br>
      {<br>
              option routers 10.103.0.1;<br>
              class "OK1Endo" {<br>
                      match if  binary-to-ascii(16, 8, ":",
      substring(option agent.remote-id, 2, 7)) = "84:78:ac:84:e5:80"<br>
    </blockquote></div>
    How will a substring of length 7 match 6 hex values? Is there any
    reason to convert into ascii?<div class="im"><br>
    <blockquote type="cite">
                              and     binary-to-ascii (16, 8, ":",
      hardware) = "1:0:14:2d:40:f:15"<br>
    </blockquote></div>
    binary-to-ascii will, as far as I can see, return a string of the
    form xx:xx:xx:xx ....<br>
    How can that match x:x:xx:xx:xx:x:xx - note one or two digits.<div class="im"><br>
    <blockquote type="cite">                        and     binary-to-ascii (16,
      8, ":", substring(option agent.circuit-id, 5, 5)) = "e";<br>
    </blockquote></div>
    Substring of length 5 should match one letter?<br>
    <blockquote type="cite"><div class="im">
              }<br>
              pool {<br>
                      filename "pxelinux.0";<br>
                      next-server 10.103.0.202;<br>
                      option mobile-ip-home-agent 10.103.0.202;<br>
                      option log-servers 10.103.0.202;<br>
                      option tz "Europe/Brussels";<br>
                      use-host-decl-names on;<br>
                      allow members of "OK1Endo";<br>
                      range 10.103.0.220 10.103.0.220;<br>
              }<br>
        }<br>
      ###########<br>
      <br>
      I'm sure the class definition is correct and the pool matches as I
      also added a log statement which only seems to trigger if the
      client matches the pool (if I change the class definition or
      remove the 'allow members' I don't see the logs appearing in the
      log files anymore).<br>
      <br>
      However the dhcpd server doesn't seem to send any reply to the
      host: in tcpdump I see a bootp/dhcp request from the clients MAC
      but no replies from the server.  If I replace the 'pool' section
      with a simple 'host' definition the server responds immediately. 
      <br>
      <br>
      Any ideas what I'm doing wrong?<br>
      <br>
      Note: I'm using a very old version of dhcpd (3.1.1) which
      unfortunately I cannot upgrade at the moment.<br clear="all">
      <br>
      Thanks in advance,<br>
      <br>
      Nico<br>
      <br>
      -- <br>
      <span style="font-size:13px;font-family:arial,sans-serif"><span style="color:rgb(128,128,128)">Nico De Ranter</span>
        <div>
          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><font color="#808080">Operations Engineer</font></p>
          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><font color="#808080"><br>
            </font></p>
          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span><span><span style="color:gray" lang="EN-US">eSATURNUS</span></span></span><span style="color:gray" lang="EN-US"><span></span></span></p>

          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span style="color:gray" lang="EN-US">T. <a value="+3216401282" style="color:rgb(0,0,204)">+32 16 40 12 82</a></span></p>
          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span style="color:gray" lang="EN-US">M. <a value="+32478567829" style="color:rgb(0,0,204)">+32 497 91 53 78<br>
              </a></span></p>
          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span style="color:rgb(102,102,102)"><a href="http://www.esaturnus.com" target="_blank">www.esaturnus.com</a></span></p>
          <p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><img src=""><br>
            <span style="color:gray" lang="EN-US"></span></p>
          <span style="color:gray"><a href="http://www.esaturnus.com/" style="color:rgb(0,0,204)" target="_blank"><span lang="EN-US"></span></a></span><span style="color:gray" lang="EN-US"></span>
          <pre style="white-space:pre-wrap"><span style="color:gray" lang="EN-US"></span><span style="color:gray"><a href="http://vcard.esaturnus.com/" style="color:rgb(0,0,204)" target="_blank"><span lang="EN-US">

</span></a></span></pre>
        </div>
      </span><br>
      <br>
      <fieldset></fieldset>
      <br>
      </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><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <pre cols="72">-- 
Best regards

Sten Carlsen

No improvements come from shouting:
       "MALE BOVINE MANURE!!!"
</pre>
  </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><br clear="all"><br>-- <br><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="color:rgb(128,128,128)">Nico De Ranter</span><div>
<p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><font color="#808080">Operations Engineer</font></p><p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><font color="#808080"><br>
</font></p><p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span><span><span style="color:gray" lang="EN-US">eSATURNUS</span></span></span><span style="color:gray" lang="EN-US"><span></span></span></p>
<p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span style="color:gray" lang="EN-US">T. <a value="+3216401282" style="color:rgb(0,0,204)">+32 16 40 12 82</a></span></p><p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt">
<span style="color:gray" lang="EN-US">M. <a value="+32478567829" style="color:rgb(0,0,204)">+32 497 91 53 78<br></a></span></p><p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><span style="color:rgb(102,102,102)"><a href="http://www.esaturnus.com" target="_blank">www.esaturnus.com</a></span></p>
<p style="margin-top:0cm;margin-right:0cm;margin-left:0cm;margin-bottom:0.0001pt"><img src="https://www.google.com/a/esaturnus.com/images/logo.gif?alpha=1"><br><span style="color:gray" lang="EN-US"><a value="+32478567829" style="color:rgb(0,0,204)"></a></span></p>
<span style="color:gray"><a href="http://www.esaturnus.com/" style="color:rgb(0,0,204)" target="_blank"><span lang="EN-US"></span></a></span><span style="color:gray" lang="EN-US"></span><pre style="white-space:pre-wrap"><span style="color:gray" lang="EN-US"></span><span style="color:gray"><a href="http://vcard.esaturnus.com/" style="color:rgb(0,0,204)" target="_blank"><span lang="EN-US"><br>
</span></a></span></pre></div></span><br>