aboutgitcodebugslistschat
path: root/conf.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-08-21 14:19:58 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-08-21 11:59:51 +0200
commit066e69986b96bf83dfa2ec09f6b03b6a7ad6bbd6 (patch)
tree921198ec4d648439ff17dde83e07a963c6c3dbc1 /conf.c
parente6feb5a892b4efc2b149883f58915154d6eb349f (diff)
downloadpasst-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 'conf.c')
-rw-r--r--conf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/conf.c b/conf.c
index ed097bd..830f91a 100644
--- a/conf.c
+++ b/conf.c
@@ -921,7 +921,8 @@ pasta_opts:
*/
static void conf_print(const struct ctx *c)
{
- char buf4[INET_ADDRSTRLEN], buf6[INET6_ADDRSTRLEN], ifn[IFNAMSIZ];
+ char buf4[INET_ADDRSTRLEN], buf6[INET6_ADDRSTRLEN];
+ char bufmac[ETH_ADDRSTRLEN], ifn[IFNAMSIZ];
int i;
info("Template interface: %s%s%s%s%s",
@@ -955,9 +956,7 @@ static void conf_print(const struct ctx *c)
info("Namespace interface: %s", c->pasta_ifn);
info("MAC:");
- info(" host: %02x:%02x:%02x:%02x:%02x:%02x",
- c->mac[0], c->mac[1], c->mac[2],
- c->mac[3], c->mac[4], c->mac[5]);
+ info(" host: %s", eth_ntop(c->mac, bufmac, sizeof(bufmac)));
if (c->ifi4) {
if (!c->no_dhcp) {