<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Plus binary-to-ascii truncates leading zeros. The result would be<br>
"1:0:a0:45"<br>
<br>
You could also use subclasses:<br>
<font color="#993300"><tt>class "mobile_iPhone" {</tt><tt><br>
</tt><tt> match substring(option dhcp6.client-id, 8, 3);</tt><tt><br>
</tt><tt> set member_of = "mobile_iPhone";</tt><tt><br>
</tt><tt> if ((not exists server.ddns-hostname) or
(lcase(option fqdn.hostname) = "iphone")) {</tt><tt><br>
</tt><tt> ddns-hostname = concat("iPhone-",
binary-to-ascii(16, 8, "", suffix(option dhcp6.client-id, 3)));</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt>subclass "mobile_iPhone" 08:74:02;</tt><tt><br>
</tt><tt>subclass "mobile_iPhone" 10:41:7f;</tt><tt><br>
</tt><tt>subclass "mobile_iPhone" 24:a2:e1;</tt><tt><br>
</tt></font>dhcp6.client-id is like dhcp4 hardware.<br>
<br>
<br>
<font color="#993300"><tt>class "VoIP_phone" {</tt><tt><br>
</tt><tt> match hardware;</tt><tt><br>
</tt><tt> set member_of = "VoIP_phone";</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt>subclass "VoIP_phone" 1:00:30:4d:02:6d:26 {
ddns-hostname "Bob-VoIP"; }</tt><tt><br>
</tt><tt>subclass "VoIP_phone" 1:00:30:4d:02:6c:c7 {
ddns-hostname "whoRu-VoIP"; } # who are you?</tt><tt><br>
</tt></font><br>
<font color="#993300"><tt>class "Panasonic" {</tt><tt><br>
</tt><tt> match if (</tt><tt><br>
</tt><tt> substring(hardware, 1,3) = 08:00:23</tt><tt><br>
</tt><tt> or substring(hardware, 1,3) = 00:80:45</tt><tt><br>
</tt><tt> );</tt><tt><br>
</tt><tt> set member_of = "Panasonic";</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt></font><br>
Bill<br>
<br>
<div class="moz-cite-prefix">On 1/17/2018 4:34 PM, Simon Hobson
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:01544B5B-D180-4BB1-AF6D-B7EB4311ACB3@thehobsons.co.uk">
<pre wrap="">Andrew Falanga (afalanga) <a class="moz-txt-link-rfc2396E" href="mailto:afalanga@micron.com"><afalanga@micron.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">class "controller" {
# tried matching based on two different styles I've seen on the net
#match if substring(hardware, 1, 3) = 00:a0:45;
match if (binary-to-ascii(16, 8, ":", substring(hardware, 0, 4)) = "1:00:a0:45");
</pre>
</blockquote>
<pre wrap="">
This won't match, the string "1" (that you've used) will not match the string "01" (what binary-to-ascii will generate). Also you are comparing FIVE bytes from the MAC address to FOUR bytes in the string. What you should do is simply compare the binary values :
match if substring(hardware, 0, 3) = 1:00:a0:45;
or
match if substring(hardware, 1, 3) = 00:a0:45; (as you've shown as an alternative above)
Note: the leading "1" is the hardware type, 1 indicating Ethernet.
_______________________________________________
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>
<br>
</body>
</html>