mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:37:29 +00:00
Merge pull request #7372 from mjstapp/fix_ntoa_ripd
ripd, staticd, isisd, babeld: replace inet_ntoa
This commit is contained in:
commit
a927c1556d
@ -59,24 +59,16 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen,
|
|||||||
if (access_list_apply (babel_ifp->list[distribute], &p)
|
if (access_list_apply (babel_ifp->list[distribute], &p)
|
||||||
== FILTER_DENY) {
|
== FILTER_DENY) {
|
||||||
debugf(BABEL_DEBUG_FILTER,
|
debugf(BABEL_DEBUG_FILTER,
|
||||||
"%s/%d filtered by distribute %s",
|
"%pFX filtered by distribute %s",
|
||||||
p.family == AF_INET ?
|
&p, output ? "out" : "in");
|
||||||
inet_ntoa(p.u.prefix4) :
|
|
||||||
inet6_ntoa (p.u.prefix6),
|
|
||||||
p.prefixlen,
|
|
||||||
output ? "out" : "in");
|
|
||||||
return INFINITY;
|
return INFINITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (babel_ifp != NULL && babel_ifp->prefix[distribute]) {
|
if (babel_ifp != NULL && babel_ifp->prefix[distribute]) {
|
||||||
if (prefix_list_apply (babel_ifp->prefix[distribute], &p)
|
if (prefix_list_apply (babel_ifp->prefix[distribute], &p)
|
||||||
== PREFIX_DENY) {
|
== PREFIX_DENY) {
|
||||||
debugf(BABEL_DEBUG_FILTER, "%s/%d filtered by distribute %s",
|
debugf(BABEL_DEBUG_FILTER, "%pFX filtered by distribute %s",
|
||||||
p.family == AF_INET ?
|
&p, output ? "out" : "in");
|
||||||
inet_ntoa(p.u.prefix4) :
|
|
||||||
inet6_ntoa (p.u.prefix6),
|
|
||||||
p.prefixlen,
|
|
||||||
output ? "out" : "in");
|
|
||||||
return INFINITY;
|
return INFINITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,12 +83,8 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen,
|
|||||||
|
|
||||||
if (alist) {
|
if (alist) {
|
||||||
if (access_list_apply (alist, &p) == FILTER_DENY) {
|
if (access_list_apply (alist, &p) == FILTER_DENY) {
|
||||||
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
|
debugf(BABEL_DEBUG_FILTER,"%pFX filtered by distribute %s",
|
||||||
p.family == AF_INET ?
|
&p, output ? "out" : "in");
|
||||||
inet_ntoa(p.u.prefix4) :
|
|
||||||
inet6_ntoa (p.u.prefix6),
|
|
||||||
p.prefixlen,
|
|
||||||
output ? "out" : "in");
|
|
||||||
return INFINITY;
|
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]);
|
plist = prefix_list_lookup (p.family, dist->prefix[distribute]);
|
||||||
if (plist) {
|
if (plist) {
|
||||||
if (prefix_list_apply (plist, &p) == PREFIX_DENY) {
|
if (prefix_list_apply (plist, &p) == PREFIX_DENY) {
|
||||||
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
|
debugf(BABEL_DEBUG_FILTER,"%pFX filtered by distribute %s",
|
||||||
p.family == AF_INET ?
|
&p, output ? "out" : "in");
|
||||||
inet_ntoa(p.u.prefix4) :
|
|
||||||
inet6_ntoa (p.u.prefix6),
|
|
||||||
p.prefixlen,
|
|
||||||
output ? "out" : "in");
|
|
||||||
return INFINITY;
|
return INFINITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1106,6 +1106,7 @@ DEFUN (show_babel_route_addr,
|
|||||||
{
|
{
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
char buf[INET_ADDRSTRLEN + 8];
|
char buf[INET_ADDRSTRLEN + 8];
|
||||||
|
char buf1[INET_ADDRSTRLEN + 8];
|
||||||
struct route_stream *routes = NULL;
|
struct route_stream *routes = NULL;
|
||||||
struct xroute_stream *xroutes = NULL;
|
struct xroute_stream *xroutes = NULL;
|
||||||
struct prefix prefix;
|
struct prefix prefix;
|
||||||
@ -1118,7 +1119,8 @@ DEFUN (show_babel_route_addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Quagga has no convenient prefix constructors. */
|
/* 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);
|
ret = str2prefix(buf, &prefix);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
@ -393,7 +393,7 @@ void isis_adj_print(struct isis_adjacency *adj)
|
|||||||
if (adj->ipv4_address_count) {
|
if (adj->ipv4_address_count) {
|
||||||
zlog_debug("IPv4 Address(es):");
|
zlog_debug("IPv4 Address(es):");
|
||||||
for (unsigned int i = 0; i < adj->ipv4_address_count; i++)
|
for (unsigned int i = 0; i < adj->ipv4_address_count; i++)
|
||||||
zlog_debug("%s", inet_ntoa(adj->ipv4_addresses[i]));
|
zlog_debug("%pI4", &adj->ipv4_addresses[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adj->ipv6_address_count) {
|
if (adj->ipv6_address_count) {
|
||||||
@ -562,8 +562,8 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
|
|||||||
vty_out(vty, " IPv4 Address(es):\n");
|
vty_out(vty, " IPv4 Address(es):\n");
|
||||||
for (unsigned int i = 0; i < adj->ipv4_address_count;
|
for (unsigned int i = 0; i < adj->ipv4_address_count;
|
||||||
i++)
|
i++)
|
||||||
vty_out(vty, " %s\n",
|
vty_out(vty, " %pI4\n",
|
||||||
inet_ntoa(adj->ipv4_addresses[i]));
|
&adj->ipv4_addresses[i]);
|
||||||
}
|
}
|
||||||
if (adj->ipv6_address_count) {
|
if (adj->ipv6_address_count) {
|
||||||
vty_out(vty, " IPv6 Address(es):\n");
|
vty_out(vty, " IPv6 Address(es):\n");
|
||||||
|
@ -336,10 +336,8 @@ DEFUN(show_isis_mpls_te_router,
|
|||||||
if (ntohs(area->mta->router_id.s_addr)
|
if (ntohs(area->mta->router_id.s_addr)
|
||||||
!= 0)
|
!= 0)
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
" MPLS-TE Router-Address: %s\n",
|
" MPLS-TE Router-Address: %pI4\n",
|
||||||
inet_ntoa(
|
&area->mta->router_id);
|
||||||
area->mta
|
|
||||||
->router_id));
|
|
||||||
else
|
else
|
||||||
vty_out(vty, " N/A\n");
|
vty_out(vty, " N/A\n");
|
||||||
}
|
}
|
||||||
@ -357,9 +355,8 @@ DEFUN(show_isis_mpls_te_router,
|
|||||||
vty_out(vty, "Area %s:\n", area->area_tag);
|
vty_out(vty, "Area %s:\n", area->area_tag);
|
||||||
if (ntohs(area->mta->router_id.s_addr) != 0)
|
if (ntohs(area->mta->router_id.s_addr) != 0)
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
" MPLS-TE Router-Address: %s\n",
|
" MPLS-TE Router-Address: %pI4\n",
|
||||||
inet_ntoa(
|
&area->mta->router_id);
|
||||||
area->mta->router_id));
|
|
||||||
else
|
else
|
||||||
vty_out(vty, " N/A\n");
|
vty_out(vty, " N/A\n");
|
||||||
}
|
}
|
||||||
@ -394,11 +391,11 @@ static void show_ext_sub(struct vty *vty, char *name,
|
|||||||
ext->remote_llri);
|
ext->remote_llri);
|
||||||
}
|
}
|
||||||
if (IS_SUBTLV(ext, EXT_LOCAL_ADDR))
|
if (IS_SUBTLV(ext, EXT_LOCAL_ADDR))
|
||||||
sbuf_push(&buf, 4, "Local Interface IP Address(es): %s\n",
|
sbuf_push(&buf, 4, "Local Interface IP Address(es): %pI4\n",
|
||||||
inet_ntoa(ext->local_addr));
|
&ext->local_addr);
|
||||||
if (IS_SUBTLV(ext, EXT_NEIGH_ADDR))
|
if (IS_SUBTLV(ext, EXT_NEIGH_ADDR))
|
||||||
sbuf_push(&buf, 4, "Remote Interface IP Address(es): %s\n",
|
sbuf_push(&buf, 4, "Remote Interface IP Address(es): %pI4\n",
|
||||||
inet_ntoa(ext->neigh_addr));
|
&ext->neigh_addr);
|
||||||
if (IS_SUBTLV(ext, EXT_LOCAL_ADDR6))
|
if (IS_SUBTLV(ext, EXT_LOCAL_ADDR6))
|
||||||
sbuf_push(&buf, 4, "Local Interface IPv6 Address(es): %s\n",
|
sbuf_push(&buf, 4, "Local Interface IPv6 Address(es): %s\n",
|
||||||
inet_ntop(AF_INET6, &ext->local_addr6, ibuf,
|
inet_ntop(AF_INET6, &ext->local_addr6, ibuf,
|
||||||
@ -432,8 +429,8 @@ static void show_ext_sub(struct vty *vty, char *name,
|
|||||||
ext->remote_as);
|
ext->remote_as);
|
||||||
if (IS_SUBTLV(ext, EXT_RMT_IP))
|
if (IS_SUBTLV(ext, EXT_RMT_IP))
|
||||||
sbuf_push(&buf, 4,
|
sbuf_push(&buf, 4,
|
||||||
"Inter-AS TE Remote ASBR IP address: %s\n",
|
"Inter-AS TE Remote ASBR IP address: %pI4\n",
|
||||||
inet_ntoa(ext->remote_ip));
|
&ext->remote_ip);
|
||||||
if (IS_SUBTLV(ext, EXT_DELAY))
|
if (IS_SUBTLV(ext, EXT_DELAY))
|
||||||
sbuf_push(&buf, 4,
|
sbuf_push(&buf, 4,
|
||||||
"%s Average Link Delay: %u (micro-sec)\n",
|
"%s Average Link Delay: %u (micro-sec)\n",
|
||||||
|
@ -209,11 +209,11 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
|
|||||||
exts->remote_llri);
|
exts->remote_llri);
|
||||||
}
|
}
|
||||||
if (IS_SUBTLV(exts, EXT_LOCAL_ADDR))
|
if (IS_SUBTLV(exts, EXT_LOCAL_ADDR))
|
||||||
sbuf_push(buf, indent, "Local Interface IP Address(es): %s\n",
|
sbuf_push(buf, indent, "Local Interface IP Address(es): %pI4\n",
|
||||||
inet_ntoa(exts->local_addr));
|
&exts->local_addr);
|
||||||
if (IS_SUBTLV(exts, EXT_NEIGH_ADDR))
|
if (IS_SUBTLV(exts, EXT_NEIGH_ADDR))
|
||||||
sbuf_push(buf, indent, "Remote Interface IP Address(es): %s\n",
|
sbuf_push(buf, indent, "Remote Interface IP Address(es): %pI4\n",
|
||||||
inet_ntoa(exts->neigh_addr));
|
&exts->neigh_addr);
|
||||||
if (IS_SUBTLV(exts, EXT_LOCAL_ADDR6))
|
if (IS_SUBTLV(exts, EXT_LOCAL_ADDR6))
|
||||||
sbuf_push(buf, indent, "Local Interface IPv6 Address(es): %s\n",
|
sbuf_push(buf, indent, "Local Interface IPv6 Address(es): %s\n",
|
||||||
inet_ntop(AF_INET6, &exts->local_addr6, ibuf,
|
inet_ntop(AF_INET6, &exts->local_addr6, ibuf,
|
||||||
@ -247,8 +247,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
|
|||||||
exts->remote_as);
|
exts->remote_as);
|
||||||
if (IS_SUBTLV(exts, EXT_RMT_IP))
|
if (IS_SUBTLV(exts, EXT_RMT_IP))
|
||||||
sbuf_push(buf, indent,
|
sbuf_push(buf, indent,
|
||||||
"Inter-AS TE Remote ASBR IP address: %s\n",
|
"Inter-AS TE Remote ASBR IP address: %pI4\n",
|
||||||
inet_ntoa(exts->remote_ip));
|
&exts->remote_ip);
|
||||||
/* Extended metrics */
|
/* Extended metrics */
|
||||||
if (IS_SUBTLV(exts, EXT_DELAY))
|
if (IS_SUBTLV(exts, EXT_DELAY))
|
||||||
sbuf_push(buf, indent,
|
sbuf_push(buf, indent,
|
||||||
|
@ -172,8 +172,8 @@ static void rip_request_interface_send(struct interface *ifp, uint8_t version)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("SEND request to %s",
|
zlog_debug("SEND request to %pI4",
|
||||||
inet_ntoa(to.sin_addr));
|
&to.sin_addr);
|
||||||
|
|
||||||
rip_request_send(&to, ifp, version, connected);
|
rip_request_send(&to, ifp, version, connected);
|
||||||
}
|
}
|
||||||
@ -1174,9 +1174,7 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)
|
|||||||
for (node = route_top(rip->enable_network); node;
|
for (node = route_top(rip->enable_network); node;
|
||||||
node = route_next(node))
|
node = route_next(node))
|
||||||
if (node->info)
|
if (node->info)
|
||||||
vty_out(vty, " %s/%u\n",
|
vty_out(vty, " %pFX\n", &node->p);
|
||||||
inet_ntoa(node->p.u.prefix4),
|
|
||||||
node->p.prefixlen);
|
|
||||||
|
|
||||||
/* Interface name RIP enable statement. */
|
/* Interface name RIP enable statement. */
|
||||||
for (i = 0; i < vector_active(rip->enable_interface); i++)
|
for (i = 0; i < vector_active(rip->enable_interface); i++)
|
||||||
@ -1186,7 +1184,7 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)
|
|||||||
/* RIP neighbors listing. */
|
/* RIP neighbors listing. */
|
||||||
for (node = route_top(rip->neighbor); node; node = route_next(node))
|
for (node = route_top(rip->neighbor); node; node = route_next(node))
|
||||||
if (node->info)
|
if (node->info)
|
||||||
vty_out(vty, " %s\n", inet_ntoa(node->p.u.prefix4));
|
vty_out(vty, " %pI4\n", &node->p.u.prefix4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,8 @@ void rip_peer_display(struct vty *vty, struct rip *rip)
|
|||||||
char timebuf[RIP_UPTIME_LEN];
|
char timebuf[RIP_UPTIME_LEN];
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(rip->peer_list, node, nnode, peer)) {
|
for (ALL_LIST_ELEMENTS(rip->peer_list, node, nnode, peer)) {
|
||||||
vty_out(vty, " %-16s %9d %9d %9d %s\n",
|
vty_out(vty, " %-16pI4 %9d %9d %9d %s\n",
|
||||||
inet_ntoa(peer->addr), peer->recv_badpackets,
|
&peer->addr, peer->recv_badpackets,
|
||||||
peer->recv_badroutes, ZEBRA_RIP_DISTANCE_DEFAULT,
|
peer->recv_badroutes, ZEBRA_RIP_DISTANCE_DEFAULT,
|
||||||
rip_peer_uptime(peer, timebuf, RIP_UPTIME_LEN));
|
rip_peer_uptime(peer, timebuf, RIP_UPTIME_LEN));
|
||||||
}
|
}
|
||||||
|
@ -88,18 +88,16 @@ static void rip_zebra_ipv4_send(struct rip *rip, struct route_node *rp,
|
|||||||
|
|
||||||
if (IS_RIP_DEBUG_ZEBRA) {
|
if (IS_RIP_DEBUG_ZEBRA) {
|
||||||
if (rip->ecmp)
|
if (rip->ecmp)
|
||||||
zlog_debug("%s: %s/%d nexthops %d",
|
zlog_debug("%s: %pFX nexthops %d",
|
||||||
(cmd == ZEBRA_ROUTE_ADD)
|
(cmd == ZEBRA_ROUTE_ADD)
|
||||||
? "Install into zebra"
|
? "Install into zebra"
|
||||||
: "Delete from zebra",
|
: "Delete from zebra",
|
||||||
inet_ntoa(rp->p.u.prefix4), rp->p.prefixlen,
|
&rp->p, count);
|
||||||
count);
|
|
||||||
else
|
else
|
||||||
zlog_debug("%s: %s/%d",
|
zlog_debug("%s: %pFX",
|
||||||
(cmd == ZEBRA_ROUTE_ADD)
|
(cmd == ZEBRA_ROUTE_ADD)
|
||||||
? "Install into zebra"
|
? "Install into zebra"
|
||||||
: "Delete from zebra",
|
: "Delete from zebra", &rp->p);
|
||||||
inet_ntoa(rp->p.u.prefix4), rp->p.prefixlen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rip->counters.route_changes++;
|
rip->counters.route_changes++;
|
||||||
|
128
ripd/ripd.c
128
ripd/ripd.c
@ -45,6 +45,7 @@
|
|||||||
#include "lib_errors.h"
|
#include "lib_errors.h"
|
||||||
#include "northbound_cli.h"
|
#include "northbound_cli.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
#include "lib/printfrr.h"
|
||||||
|
|
||||||
#include "ripd/ripd.h"
|
#include "ripd/ripd.h"
|
||||||
#include "ripd/rip_nb.h"
|
#include "ripd/rip_nb.h"
|
||||||
@ -466,8 +467,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
|
|||||||
if (ret == RMAP_DENYMATCH) {
|
if (ret == RMAP_DENYMATCH) {
|
||||||
if (IS_RIP_DEBUG_PACKET)
|
if (IS_RIP_DEBUG_PACKET)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"RIP %s/%d is filtered by route-map in",
|
"RIP %pFX is filtered by route-map in",
|
||||||
inet_ntoa(p.prefix), p.prefixlen);
|
&p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,8 +503,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
|
|||||||
/* Check if nexthop address is myself, then do nothing. */
|
/* Check if nexthop address is myself, then do nothing. */
|
||||||
if (rip_nexthop_check(rip, nexthop) < 0) {
|
if (rip_nexthop_check(rip, nexthop) < 0) {
|
||||||
if (IS_RIP_DEBUG_PACKET)
|
if (IS_RIP_DEBUG_PACKET)
|
||||||
zlog_debug("Nexthop address %s is myself",
|
zlog_debug("Nexthop address %pI4 is myself",
|
||||||
inet_ntoa(*nexthop));
|
nexthop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,8 +831,8 @@ static int rip_auth_simple_password(struct rte *rte, struct sockaddr_in *from,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("RIPv2 simple password authentication from %s",
|
zlog_debug("RIPv2 simple password authentication from %pI4",
|
||||||
inet_ntoa(from->sin_addr));
|
&from->sin_addr);
|
||||||
|
|
||||||
ri = ifp->info;
|
ri = ifp->info;
|
||||||
|
|
||||||
@ -878,8 +879,8 @@ static int rip_auth_md5(struct rip_packet *packet, struct sockaddr_in *from,
|
|||||||
char auth_str[RIP_AUTH_MD5_SIZE] = {};
|
char auth_str[RIP_AUTH_MD5_SIZE] = {};
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("RIPv2 MD5 authentication from %s",
|
zlog_debug("RIPv2 MD5 authentication from %pI4",
|
||||||
inet_ntoa(from->sin_addr));
|
&from->sin_addr);
|
||||||
|
|
||||||
ri = ifp->info;
|
ri = ifp->info;
|
||||||
md5 = (struct rip_md5_info *)&packet->rte;
|
md5 = (struct rip_md5_info *)&packet->rte;
|
||||||
@ -1160,8 +1161,8 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
rip->vrf->vrf_id)
|
rip->vrf->vrf_id)
|
||||||
== NULL) {
|
== NULL) {
|
||||||
zlog_info(
|
zlog_info(
|
||||||
"This datagram doesn't came from a valid neighbor: %s",
|
"This datagram doesn't come from a valid neighbor: %pI4",
|
||||||
inet_ntoa(from->sin_addr));
|
&from->sin_addr);
|
||||||
rip_peer_bad_packet(rip, from);
|
rip_peer_bad_packet(rip, from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1190,9 +1191,9 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
|
|
||||||
if (rte->family != htons(AF_INET)) {
|
if (rte->family != htons(AF_INET)) {
|
||||||
/* Address family check. RIP only supports AF_INET. */
|
/* Address family check. RIP only supports AF_INET. */
|
||||||
zlog_info("Unsupported family %d from %s.",
|
zlog_info("Unsupported family %d from %pI4",
|
||||||
ntohs(rte->family),
|
ntohs(rte->family),
|
||||||
inet_ntoa(from->sin_addr));
|
&from->sin_addr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,8 +1219,8 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
/* RIPv1 does not have nexthop value. */
|
/* RIPv1 does not have nexthop value. */
|
||||||
if (packet->version == RIPv1
|
if (packet->version == RIPv1
|
||||||
&& rte->nexthop.s_addr != INADDR_ANY) {
|
&& rte->nexthop.s_addr != INADDR_ANY) {
|
||||||
zlog_info("RIPv1 packet with nexthop value %s",
|
zlog_info("RIPv1 packet with nexthop value %pI4",
|
||||||
inet_ntoa(rte->nexthop));
|
&rte->nexthop);
|
||||||
rip_peer_bad_route(rip, from);
|
rip_peer_bad_route(rip, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1236,8 +1237,8 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
addrval = ntohl(rte->nexthop.s_addr);
|
addrval = ntohl(rte->nexthop.s_addr);
|
||||||
if (IN_CLASSD(addrval)) {
|
if (IN_CLASSD(addrval)) {
|
||||||
zlog_info(
|
zlog_info(
|
||||||
"Nexthop %s is multicast address, skip this rte",
|
"Nexthop %pI4 is multicast address, skip this rte",
|
||||||
inet_ntoa(rte->nexthop));
|
&rte->nexthop);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,16 +1258,14 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
== RIP_ROUTE_RTE) {
|
== RIP_ROUTE_RTE) {
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"Next hop %s is on RIP network. Set nexthop to the packet's originator",
|
"Next hop %pI4 is on RIP network. Set nexthop to the packet's originator",
|
||||||
inet_ntoa(
|
&rte->nexthop);
|
||||||
rte->nexthop));
|
|
||||||
rte->nexthop = rinfo->from;
|
rte->nexthop = rinfo->from;
|
||||||
} else {
|
} else {
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"Next hop %s is not directly reachable. Treat it as 0.0.0.0",
|
"Next hop %pI4 is not directly reachable. Treat it as 0.0.0.0",
|
||||||
inet_ntoa(
|
&rte->nexthop);
|
||||||
rte->nexthop));
|
|
||||||
rte->nexthop.s_addr =
|
rte->nexthop.s_addr =
|
||||||
INADDR_ANY;
|
INADDR_ANY;
|
||||||
}
|
}
|
||||||
@ -1275,9 +1274,8 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
} else {
|
} else {
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"Next hop %s is not directly reachable. Treat it as 0.0.0.0",
|
"Next hop %pI4 is not directly reachable. Treat it as 0.0.0.0",
|
||||||
inet_ntoa(
|
&rte->nexthop);
|
||||||
rte->nexthop));
|
|
||||||
rte->nexthop.s_addr = INADDR_ANY;
|
rte->nexthop.s_addr = INADDR_ANY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1331,8 +1329,8 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
!= rte->prefix.s_addr)
|
!= rte->prefix.s_addr)
|
||||||
masklen2ip(32, &rte->mask);
|
masklen2ip(32, &rte->mask);
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("Subnetted route %s",
|
zlog_debug("Subnetted route %pI4",
|
||||||
inet_ntoa(rte->prefix));
|
&rte->prefix);
|
||||||
} else {
|
} else {
|
||||||
if ((rte->prefix.s_addr & rte->mask.s_addr)
|
if ((rte->prefix.s_addr & rte->mask.s_addr)
|
||||||
!= rte->prefix.s_addr)
|
!= rte->prefix.s_addr)
|
||||||
@ -1340,10 +1338,10 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT) {
|
if (IS_RIP_DEBUG_EVENT) {
|
||||||
zlog_debug("Resultant route %s",
|
zlog_debug("Resultant route %pI4",
|
||||||
inet_ntoa(rte->prefix));
|
&rte->prefix);
|
||||||
zlog_debug("Resultant mask %s",
|
zlog_debug("Resultant mask %pI4",
|
||||||
inet_ntoa(rte->mask));
|
&rte->mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1354,8 +1352,8 @@ static void rip_response_process(struct rip_packet *packet, int size,
|
|||||||
&& ((rte->prefix.s_addr & rte->mask.s_addr)
|
&& ((rte->prefix.s_addr & rte->mask.s_addr)
|
||||||
!= rte->prefix.s_addr)) {
|
!= rte->prefix.s_addr)) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"RIPv2 address %s is not mask /%d applied one",
|
"RIPv2 address %pI4 is not mask /%d applied one",
|
||||||
inet_ntoa(rte->prefix), ip_masklen(rte->mask));
|
&rte->prefix, ip_masklen(rte->mask));
|
||||||
rip_peer_bad_route(rip, from);
|
rip_peer_bad_route(rip, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1418,8 +1416,8 @@ int rip_create_socket(struct vrf *vrf)
|
|||||||
frr_with_privs(&ripd_privs) {
|
frr_with_privs(&ripd_privs) {
|
||||||
if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr)))
|
if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr)))
|
||||||
< 0) {
|
< 0) {
|
||||||
zlog_err("%s: Can't bind socket %d to %s port %d: %s",
|
zlog_err("%s: Can't bind socket %d to %pI4 port %d: %s",
|
||||||
__func__, sock, inet_ntoa(addr.sin_addr),
|
__func__, sock, &addr.sin_addr,
|
||||||
(int)ntohs(addr.sin_port),
|
(int)ntohs(addr.sin_port),
|
||||||
safe_strerror(errno));
|
safe_strerror(errno));
|
||||||
|
|
||||||
@ -1459,14 +1457,14 @@ static int rip_send_packet(uint8_t *buf, int size, struct sockaddr_in *to,
|
|||||||
char dst[ADDRESS_SIZE];
|
char dst[ADDRESS_SIZE];
|
||||||
|
|
||||||
if (to) {
|
if (to) {
|
||||||
strlcpy(dst, inet_ntoa(to->sin_addr), sizeof(dst));
|
inet_ntop(AF_INET, &to->sin_addr, dst, sizeof(dst));
|
||||||
} else {
|
} else {
|
||||||
sin.sin_addr.s_addr = htonl(INADDR_RIP_GROUP);
|
sin.sin_addr.s_addr = htonl(INADDR_RIP_GROUP);
|
||||||
strlcpy(dst, inet_ntoa(sin.sin_addr), sizeof(dst));
|
inet_ntop(AF_INET, &sin.sin_addr, dst, sizeof(dst));
|
||||||
}
|
}
|
||||||
#undef ADDRESS_SIZE
|
#undef ADDRESS_SIZE
|
||||||
zlog_debug("rip_send_packet %s > %s (%s)",
|
zlog_debug("rip_send_packet %pI4 > %s (%s)",
|
||||||
inet_ntoa(ifc->address->u.prefix4), dst,
|
&ifc->address->u.prefix4, dst,
|
||||||
ifc->ifp->name);
|
ifc->ifp->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1533,7 +1531,7 @@ static int rip_send_packet(uint8_t *buf, int size, struct sockaddr_in *to,
|
|||||||
ret = sendmsg(rip->sock, &msg, 0);
|
ret = sendmsg(rip->sock, &msg, 0);
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("SEND to %s.%d", inet_ntoa(sin.sin_addr),
|
zlog_debug("SEND to %pI4%d", &sin.sin_addr,
|
||||||
ntohs(sin.sin_port));
|
ntohs(sin.sin_port));
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -1782,15 +1780,15 @@ static int rip_read(struct thread *t)
|
|||||||
|
|
||||||
/* RIP packet received */
|
/* RIP packet received */
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("RECV packet from %s port %d on %s (VRF %s)",
|
zlog_debug("RECV packet from %pI4 port %d on %s (VRF %s)",
|
||||||
inet_ntoa(from.sin_addr), ntohs(from.sin_port),
|
&from.sin_addr, ntohs(from.sin_port),
|
||||||
ifp ? ifp->name : "unknown", rip->vrf_name);
|
ifp ? ifp->name : "unknown", rip->vrf_name);
|
||||||
|
|
||||||
/* If this packet come from unknown interface, ignore it. */
|
/* If this packet come from unknown interface, ignore it. */
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
zlog_info(
|
zlog_info(
|
||||||
"rip_read: cannot find interface for packet from %s port %d (VRF %s)",
|
"rip_read: cannot find interface for packet from %pI4 port %d (VRF %s)",
|
||||||
inet_ntoa(from.sin_addr), ntohs(from.sin_port),
|
&from.sin_addr, ntohs(from.sin_port),
|
||||||
rip->vrf_name);
|
rip->vrf_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1803,8 +1801,8 @@ static int rip_read(struct thread *t)
|
|||||||
|
|
||||||
if (ifc == NULL) {
|
if (ifc == NULL) {
|
||||||
zlog_info(
|
zlog_info(
|
||||||
"rip_read: cannot find connected address for packet from %s port %d on interface %s (VRF %s)",
|
"rip_read: cannot find connected address for packet from %pI4 port %d on interface %s (VRF %s)",
|
||||||
inet_ntoa(from.sin_addr), ntohs(from.sin_port),
|
&from.sin_addr, ntohs(from.sin_port),
|
||||||
ifp->name, rip->vrf_name);
|
ifp->name, rip->vrf_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2077,8 +2075,8 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
|
|||||||
/* Logging output event. */
|
/* Logging output event. */
|
||||||
if (IS_RIP_DEBUG_EVENT) {
|
if (IS_RIP_DEBUG_EVENT) {
|
||||||
if (to)
|
if (to)
|
||||||
zlog_debug("update routes to neighbor %s",
|
zlog_debug("update routes to neighbor %pI4",
|
||||||
inet_ntoa(to->sin_addr));
|
&to->sin_addr);
|
||||||
else
|
else
|
||||||
zlog_debug("update routes on interface %s ifindex %d",
|
zlog_debug("update routes on interface %s ifindex %d",
|
||||||
ifc->ifp->name, ifc->ifp->ifindex);
|
ifc->ifp->name, ifc->ifp->ifindex);
|
||||||
@ -2143,9 +2141,8 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
|
|||||||
|
|
||||||
if (IS_RIP_DEBUG_PACKET)
|
if (IS_RIP_DEBUG_PACKET)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"RIPv1 mask check, %s/%d considered for output",
|
"RIPv1 mask check, %pFX considered for output",
|
||||||
inet_ntoa(rp->p.u.prefix4),
|
&rp->p);
|
||||||
rp->p.prefixlen);
|
|
||||||
|
|
||||||
if (subnetted
|
if (subnetted
|
||||||
&& prefix_match(
|
&& prefix_match(
|
||||||
@ -2166,9 +2163,8 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
|
|||||||
}
|
}
|
||||||
if (IS_RIP_DEBUG_PACKET)
|
if (IS_RIP_DEBUG_PACKET)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"RIPv1 mask check, %s/%d made it through",
|
"RIPv1 mask check, %pFX made it through",
|
||||||
inet_ntoa(rp->p.u.prefix4),
|
&rp->p);
|
||||||
rp->p.prefixlen);
|
|
||||||
} else
|
} else
|
||||||
p = (struct prefix_ipv4 *)&rp->p;
|
p = (struct prefix_ipv4 *)&rp->p;
|
||||||
|
|
||||||
@ -2452,10 +2448,10 @@ static void rip_update_interface(struct connected *ifc, uint8_t version,
|
|||||||
to.sin_port = htons(RIP_PORT_DEFAULT);
|
to.sin_port = htons(RIP_PORT_DEFAULT);
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
zlog_debug("%s announce to %s on %s",
|
zlog_debug("%s announce to %pI4 on %s",
|
||||||
CONNECTED_PEER(ifc) ? "unicast"
|
CONNECTED_PEER(ifc) ? "unicast"
|
||||||
: "broadcast",
|
: "broadcast",
|
||||||
inet_ntoa(to.sin_addr), ifp->name);
|
&to.sin_addr, ifp->name);
|
||||||
|
|
||||||
rip_output_process(ifc, &to, route_type, version);
|
rip_output_process(ifc, &to, route_type, version);
|
||||||
}
|
}
|
||||||
@ -2530,8 +2526,8 @@ static void rip_update_process(struct rip *rip, int route_type)
|
|||||||
rip->vrf->vrf_id);
|
rip->vrf->vrf_id);
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"Neighbor %s doesn't have connected interface!",
|
"Neighbor %pI4 doesn't have connected interface!",
|
||||||
inet_ntoa(p->u.prefix4));
|
&p->u.prefix4);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2957,8 +2953,7 @@ static void rip_distance_show(struct vty *vty, struct rip *rip)
|
|||||||
" Address Distance List\n");
|
" Address Distance List\n");
|
||||||
header = 0;
|
header = 0;
|
||||||
}
|
}
|
||||||
snprintf(buf, sizeof(buf), "%s/%d",
|
snprintfrr(buf, sizeof(buf), "%pFX", &rn->p);
|
||||||
inet_ntoa(rn->p.u.prefix4), rn->p.prefixlen);
|
|
||||||
vty_out(vty, " %-20s %4d %s\n", buf,
|
vty_out(vty, " %-20s %4d %s\n", buf,
|
||||||
rdistance->distance,
|
rdistance->distance,
|
||||||
rdistance->access_list ? rdistance->access_list
|
rdistance->access_list ? rdistance->access_list
|
||||||
@ -3085,12 +3080,11 @@ DEFUN (show_ip_rip,
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = vty_out(
|
len = vty_out(
|
||||||
vty, "%c(%s) %s/%d",
|
vty, "%c(%s) %pFX",
|
||||||
/* np->lock, For debugging. */
|
/* np->lock, For debugging. */
|
||||||
zebra_route_char(rinfo->type),
|
zebra_route_char(rinfo->type),
|
||||||
rip_route_type_print(rinfo->sub_type),
|
rip_route_type_print(rinfo->sub_type),
|
||||||
inet_ntoa(np->p.u.prefix4),
|
&np->p);
|
||||||
np->p.prefixlen);
|
|
||||||
|
|
||||||
len = 24 - len;
|
len = 24 - len;
|
||||||
|
|
||||||
@ -3100,8 +3094,8 @@ DEFUN (show_ip_rip,
|
|||||||
switch (rinfo->nh.type) {
|
switch (rinfo->nh.type) {
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||||
vty_out(vty, "%-20s %2d ",
|
vty_out(vty, "%-20pI4 %2d ",
|
||||||
inet_ntoa(rinfo->nh.gate.ipv4),
|
&rinfo->nh.gate.ipv4,
|
||||||
rinfo->metric);
|
rinfo->metric);
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_IFINDEX:
|
case NEXTHOP_TYPE_IFINDEX:
|
||||||
@ -3125,8 +3119,8 @@ DEFUN (show_ip_rip,
|
|||||||
/* Route which exist in kernel routing table. */
|
/* Route which exist in kernel routing table. */
|
||||||
if ((rinfo->type == ZEBRA_ROUTE_RIP)
|
if ((rinfo->type == ZEBRA_ROUTE_RIP)
|
||||||
&& (rinfo->sub_type == RIP_ROUTE_RTE)) {
|
&& (rinfo->sub_type == RIP_ROUTE_RTE)) {
|
||||||
vty_out(vty, "%-15s ",
|
vty_out(vty, "%-15pI4 ",
|
||||||
inet_ntoa(rinfo->from));
|
&rinfo->from);
|
||||||
vty_out(vty, "%3" ROUTE_TAG_PRI " ",
|
vty_out(vty, "%3" ROUTE_TAG_PRI " ",
|
||||||
(route_tag_t)rinfo->tag);
|
(route_tag_t)rinfo->tag);
|
||||||
rip_vty_out_uptime(vty, rinfo);
|
rip_vty_out_uptime(vty, rinfo);
|
||||||
|
@ -365,8 +365,7 @@ int static_config(struct vty *vty, struct static_vrf *svrf, afi_t afi,
|
|||||||
|
|
||||||
switch (nh->type) {
|
switch (nh->type) {
|
||||||
case STATIC_IPV4_GATEWAY:
|
case STATIC_IPV4_GATEWAY:
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %pI4", &nh->addr.ipv4);
|
||||||
inet_ntoa(nh->addr.ipv4));
|
|
||||||
break;
|
break;
|
||||||
case STATIC_IPV6_GATEWAY:
|
case STATIC_IPV6_GATEWAY:
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user