aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-05-10 07:54:06 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-05-10 08:18:00 +0200
commitb385ebaadfd8b7fe4ebba627c9714ceb689f38b0 (patch)
treee60b2884713b4d6de487842db13e0f08c73e996d
parent3c8af4819e677e5ae5298604edbd544887cf964a (diff)
downloadpasst-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.tar
passt-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.tar.gz
passt-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.tar.bz2
passt-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.tar.lz
passt-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.tar.xz
passt-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.tar.zst
passt-b385ebaadfd8b7fe4ebba627c9714ceb689f38b0.zip
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 <sbrivio@redhat.com>
-rw-r--r--passt.c18
1 files changed, 9 insertions, 9 deletions
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: