From b385ebaadfd8b7fe4ebba627c9714ceb689f38b0 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 10 May 2021 07:54:06 +0200 Subject: passt: Keep just two arrays to print context IPv4 and IPv6 addresses Multiple arrays, one for each address, were needed with a single fprintf(). Now that it's replaced by info(), we can have just one for each protocol version. Signed-off-by: Stefano Brivio --- passt.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index 73f3a48..1fa9ce2 100644 --- a/passt.c +++ b/passt.c @@ -721,8 +721,8 @@ void usage(const char *name) int main(int argc, char **argv) { struct epoll_event events[EPOLL_EVENTS]; - char buf6[3][INET6_ADDRSTRLEN]; - char buf4[4][INET_ADDRSTRLEN]; + char buf6[INET6_ADDRSTRLEN]; + char buf4[INET_ADDRSTRLEN]; struct epoll_event ev = { 0 }; struct ctx c = { 0 }; int nfds, i, fd_unix; @@ -784,22 +784,22 @@ int main(int argc, char **argv) c.ifn); info("DHCP:"); info(" assign: %s", - inet_ntop(AF_INET, &c.addr4, buf4[0], sizeof(buf4[0]))); + inet_ntop(AF_INET, &c.addr4, buf4, sizeof(buf4))); info(" mask: %s", - inet_ntop(AF_INET, &c.mask4, buf4[0], sizeof(buf4[0]))); + inet_ntop(AF_INET, &c.mask4, buf4, sizeof(buf4))); info(" router: %s", - inet_ntop(AF_INET, &c.gw4, buf4[2], sizeof(buf4[2]))); + inet_ntop(AF_INET, &c.gw4, buf4, sizeof(buf4))); info(" DNS: %s", - inet_ntop(AF_INET, &c.dns4, buf4[3], sizeof(buf4[3]))); + inet_ntop(AF_INET, &c.dns4, buf4, sizeof(buf4))); } if (c.v6) { info("NDP/DHCPv6:"); info(" assign: %s", - inet_ntop(AF_INET6, &c.addr6, buf6[0], sizeof(buf6[0]))); + inet_ntop(AF_INET6, &c.addr6, buf6, sizeof(buf6))); info(" router: %s", - inet_ntop(AF_INET6, &c.gw6, buf6[1], sizeof(buf6[1]))); + inet_ntop(AF_INET6, &c.gw6, buf6, sizeof(buf6))); info(" DNS: %s", - inet_ntop(AF_INET6, &c.dns6, buf6[2], sizeof(buf6[2]))); + inet_ntop(AF_INET6, &c.dns6, buf6, sizeof(buf6))); } listen: -- cgit v1.2.3