1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-18 07:35:35 +02:00

util: Helper for formatting MAC addresses

There are a couple of places where we somewhat messily open code formatting
an Ethernet like MAC address for display.  Add an eth_ntop() helper for
this.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2024-08-21 14:19:58 +10:00 committed by Stefano Brivio
parent e6feb5a892
commit 066e69986b
4 changed files with 27 additions and 7 deletions

3
util.h
View file

@ -215,9 +215,12 @@ static inline const char *af_name(sa_family_t af)
#define SOCKADDR_STRLEN MAX(SOCKADDR_INET_STRLEN, SOCKADDR_INET6_STRLEN)
#define ETH_ADDRSTRLEN (sizeof("00:11:22:33:44:55"))
struct sock_extended_err;
const char *sockaddr_ntop(const void *sa, char *dst, socklen_t size);
const char *eth_ntop(const unsigned char *mac, char *dst, size_t size);
const char *str_ee_origin(const struct sock_extended_err *ee);
/**