X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=utils.c;h=14e966a49f8052dbe6a2727987aa54ff238fe80b;hb=67b225a9c0d38989028763de5c07164f0bfee504;hp=986cee96e147f062f24bb03a527716d71b57d8c3;hpb=1ada8cef980df7871b12ed230c789eb28f6cb047;p=project%2Fnetifd.git diff --git a/utils.c b/utils.c index 986cee9..14e966a 100644 --- a/utils.c +++ b/utils.c @@ -129,3 +129,14 @@ parse_ip_and_netmask(int af, const char *str, void *addr, unsigned int *netmask) return inet_pton(af, astr, addr); } + +char * +format_macaddr(uint8_t *mac) +{ + static char str[sizeof("ff:ff:ff:ff:ff:ff ")]; + + snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + + return str; +}