diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-05-10 07:54:06 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-05-10 08:18:00 +0200 |
commit | b385ebaadfd8b7fe4ebba627c9714ceb689f38b0 (patch) | |
tree | e60b2884713b4d6de487842db13e0f08c73e996d /passt.c | |
parent | 3c8af4819e677e5ae5298604edbd544887cf964a (diff) | |
download | passt-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>
Diffstat (limited to 'passt.c')
-rw-r--r-- | passt.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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: |