[EXT] Re: Why is dhcpd not matching the MAC address as it should

Sten Carlsen stenc at s-carlsen.dk
Wed Jan 17 21:39:10 UTC 2018


On 17 Jan 2018, at 22.27, 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");
>>>   log(info, "found a controller");
>>> }
>> Are you sure the “1:” is needed? I don’t think so.
> 
> This is actually an irritating hole in the documentation.  It isn't truly clear what "hardware" returns nor is it made clear which method is "better" than the other.  I've tried both
> 
> match if substring(hardware, 1,3) = 00:a0:45;
> 
> and 
> 
> match if (binary-to-ascii(16, 8, ":", substring(hardware, 0, 4)) = "1:00:a0:45");
> 
> The one thing I do know for sure, the hardware operator returns, in addition to the MAC, the "type" field which is part of the bootp/dhcp header.  In this case, because it is Ethernet, it is 1.  In the first match, I'm only looking for the MAC  so the address is from 1 - 3 of the hardware "data-string" (the docs name for it, it doesn't elaborate anywhere that I know what a *data-string* is, from the usage in the config file, it's a *string*).  I'm pretty sure the first form of usage could be re-written as
> 
> match if substring(hardware, 0, 3) = 1:00:a0:45;
> 
> but I truthfully haven't tested ti
I Suggest trying:
> match if substring(hardware, 0, 3) = 00:a0:45;
The 1: does not come on the wire.
> 
> Andy
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
-- 
Best regards

Sten Carlsen

No improvements come from shouting:

      "MALE BOVINE MANURE!!!"

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


More information about the dhcp-users mailing list