diff options
author | Mark Stapp <mjs@voltanet.io> | 2020-10-22 20:27:38 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2020-10-22 22:25:41 +0200 |
commit | 2bd8bc157d0368c28ed312c6ab7e76d67921115b (patch) | |
tree | 28c3a264e6d91afa6544c6fb7763020e3e5a18ba /babeld | |
parent | staticd: replace inet_ntoa (diff) | |
download | frr-2bd8bc157d0368c28ed312c6ab7e76d67921115b.tar.xz frr-2bd8bc157d0368c28ed312c6ab7e76d67921115b.zip |
babeld: replace inet_ntoa
Replace use of inet_ntoa, using pI4, pFX, or inet_pton.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'babeld')
-rw-r--r-- | babeld/babel_filter.c | 32 | ||||
-rw-r--r-- | babeld/babel_interface.c | 4 |
2 files changed, 11 insertions, 25 deletions
diff --git a/babeld/babel_filter.c b/babeld/babel_filter.c index 28ba8e16a..731ad1ba8 100644 --- a/babeld/babel_filter.c +++ b/babeld/babel_filter.c @@ -59,24 +59,16 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen, if (access_list_apply (babel_ifp->list[distribute], &p) == FILTER_DENY) { debugf(BABEL_DEBUG_FILTER, - "%s/%d filtered by distribute %s", - p.family == AF_INET ? - inet_ntoa(p.u.prefix4) : - inet6_ntoa (p.u.prefix6), - p.prefixlen, - output ? "out" : "in"); + "%pFX filtered by distribute %s", + &p, output ? "out" : "in"); return INFINITY; } } if (babel_ifp != NULL && babel_ifp->prefix[distribute]) { if (prefix_list_apply (babel_ifp->prefix[distribute], &p) == PREFIX_DENY) { - debugf(BABEL_DEBUG_FILTER, "%s/%d filtered by distribute %s", - p.family == AF_INET ? - inet_ntoa(p.u.prefix4) : - inet6_ntoa (p.u.prefix6), - p.prefixlen, - output ? "out" : "in"); + debugf(BABEL_DEBUG_FILTER, "%pFX filtered by distribute %s", + &p, output ? "out" : "in"); return INFINITY; } } @@ -91,12 +83,8 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen, if (alist) { if (access_list_apply (alist, &p) == FILTER_DENY) { - debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s", - p.family == AF_INET ? - inet_ntoa(p.u.prefix4) : - inet6_ntoa (p.u.prefix6), - p.prefixlen, - output ? "out" : "in"); + debugf(BABEL_DEBUG_FILTER,"%pFX filtered by distribute %s", + &p, output ? "out" : "in"); return INFINITY; } } @@ -105,12 +93,8 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen, plist = prefix_list_lookup (p.family, dist->prefix[distribute]); if (plist) { if (prefix_list_apply (plist, &p) == PREFIX_DENY) { - debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s", - p.family == AF_INET ? - inet_ntoa(p.u.prefix4) : - inet6_ntoa (p.u.prefix6), - p.prefixlen, - output ? "out" : "in"); + debugf(BABEL_DEBUG_FILTER,"%pFX filtered by distribute %s", + &p, output ? "out" : "in"); return INFINITY; } } diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 1702d9277..ae8b161b0 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -1106,6 +1106,7 @@ DEFUN (show_babel_route_addr, { struct in_addr addr; char buf[INET_ADDRSTRLEN + 8]; + char buf1[INET_ADDRSTRLEN + 8]; struct route_stream *routes = NULL; struct xroute_stream *xroutes = NULL; struct prefix prefix; @@ -1118,7 +1119,8 @@ DEFUN (show_babel_route_addr, } /* Quagga has no convenient prefix constructors. */ - snprintf(buf, sizeof(buf), "%s/%d", inet_ntoa(addr), 32); + snprintf(buf, sizeof(buf), "%s/%d", + inet_ntop(AF_INET, &addr, buf1, sizeof(buf1)), 32); ret = str2prefix(buf, &prefix); if (ret == 0) { |