diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-08-21 14:19:58 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-08-21 11:59:51 +0200 |
commit | 066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6 (patch) | |
tree | 921198ec4d648439ff17dde83e07a963c6c3dbc1 /util.h | |
parent | e6feb5a892b4efc2b149883f58915154d6eb349f (diff) | |
download | passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.tar passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.tar.gz passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.tar.bz2 passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.tar.lz passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.tar.xz passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.tar.zst passt-066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6.zip |
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>
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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); /** |