Conf question - how to print hardware address

Greg G ggersh at ctc.net
Wed Oct 18 16:16:56 UTC 2006


Jon Otterholm wrote:
> Staffan.Ungsgard at teliasonera.com wrote:
>   
>> In a log message statement I want to print the MAC address of the client making a dhcp request.
>> Using "log (info, substring(hardware, 1, 6));" I get the MAC address printed as 0:10:e:12:3:12 instead of 00:10:0e:12:03:12 which is the way it is logged by the dhcp server making it's standard log entries (logging DISCOVERs etc). 
>>     
> Try this:
>
> log(info, concat("commit", " ", binary-to-ascii(10, 8, ".", 
> leased-address), " ", concat (
> suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware, 1, 
> 1))),2),":",
> <snip>
> Got this from someone earlier when I had the same problem.
>
> /Jon
>
>   
   That's fairly ugly.  It  works, of course.  Is there any chance of a 
printf-like structure for logging in a future version?

-Greg G




More information about the dhcp-users mailing list