Conf question - how to print hardware address

Jon Otterholm jon.otterholm at ide.resurscentrum.se
Wed Oct 18 09:26:33 UTC 2006


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).
> Can I change this behaviour ?
>
> Best Regards
>
> -- Staffan
>
>   
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),":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware, 2, 
1))),2),":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware, 3, 
1))),2),":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware, 4, 
1))),2),":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware, 5, 
1))),2),":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware, 6, 
1))),2)
)));

Got this from someone earlier when I had the same problem.

/Jon


More information about the dhcp-users mailing list