From dc55691ca7399bab28963f92e4c3dea9d6bf8eb1 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 5 Jul 2014 18:52:03 +0100 Subject: [PATCH] When printing MAC addresses, always use trailing zeroes. tinc currently prints MAC addresses without trailing zeroes, for example: 1:2:3:4:5:6 This looks weird and is inconsistent with how MAC addresses are displayed everywhere else. This commit adds trailing zeroes, so the above address will be printed as the following: 01:02:03:04:05:06 --- src/subnet_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subnet_parse.c b/src/subnet_parse.c index 35f078af..5fac415b 100644 --- a/src/subnet_parse.c +++ b/src/subnet_parse.c @@ -308,7 +308,7 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { switch (subnet->type) { case SUBNET_MAC: - snprintf(netstr, len, "%hx:%hx:%hx:%hx:%hx:%hx#%d", + snprintf(netstr, len, "%02hx:%02hx:%02hx:%02hx:%02hx:%02hx#%d", subnet->net.mac.address.x[0], subnet->net.mac.address.x[1], subnet->net.mac.address.x[2], -- 2.20.1