Why is dhcpd not matching the MAC address as it should

Bill Shirley bill at c3po.polymerindustries.biz
Thu Jan 18 01:28:14 UTC 2018


Plus binary-to-ascii truncates leading zeros.  The result would be
"1:0:a0:45"

You could also use subclasses:
class "mobile_iPhone" {
     match substring(option dhcp6.client-id, 8, 3);
     set member_of = "mobile_iPhone";
     if ((not exists server.ddns-hostname) or (lcase(option fqdn.hostname) = "iphone")) {
         ddns-hostname = concat("iPhone-", binary-to-ascii(16, 8, "", suffix(option dhcp6.client-id, 3)));
     }
}
subclass "mobile_iPhone"    08:74:02;
subclass "mobile_iPhone"    10:41:7f;
subclass "mobile_iPhone"    24:a2:e1;
dhcp6.client-id is like dhcp4 hardware.


class "VoIP_phone" {
     match hardware;
     set member_of = "VoIP_phone";
}
subclass "VoIP_phone"    1:00:30:4d:02:6d:26    { ddns-hostname "Bob-VoIP"; }
subclass "VoIP_phone"    1:00:30:4d:02:6c:c7    { ddns-hostname "whoRu-VoIP"; }        # who are you?

class "Panasonic" {
     match if (
         substring(hardware, 1,3) = 08:00:23
         or substring(hardware, 1,3) = 00:80:45
     );
     set member_of = "Panasonic";
}

Bill

On 1/17/2018 4:34 PM, Simon Hobson wrote:
> Andrew Falanga (afalanga) <afalanga at micron.com> wrote:
>
>> 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");
> 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
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20180117/c6ff5be0/attachment-0001.html>


More information about the dhcp-users mailing list