Matching against the "hardware" String

Martin McCormick martin at dc.cis.okstate.edu
Thu Nov 18 14:12:24 UTC 2010


Simon Hobson writes:

> Your options are to either convert to a string and do a string match, or
> just do a binary match.
> 
> 
> 
> "aa:bb:cc" is a string of EIGHT characters. aa:bb:cc is a binary value of
> length THREE octets. So :
> 
> 
> substring (hardware,1,3) = aa:bb:cc
> 
> would match the manufacturer part (OUI) of the MAC address. Note that you
> start at position 1 (ie the second byte) as the hardware field contains a
> leading 1 for ethernet. You could also do :
> 
> substring (hardware,0,4) = 1:aa:bb:cc

Thanks greatly. Sometimes, I think I ask some pretty lame
questions on this list, but it is those little distinctions
between the binary representation and an ASCII match of a
representation of the binary data that could make the difference
between actually doing what one thinks one was doing and
possibly doing something that appears to be working one way but
is really not right.

Martin



More information about the dhcp-users mailing list