mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 14:17:20 +00:00
Merge pull request #8376 from mjstapp/fix_remove_inet6_ntoa
lib, ripngd: Remove inet6_ntoa
This commit is contained in:
commit
f243fd3d90
@ -1198,15 +1198,6 @@ int netmask_str2prefix_str(const char *net_str, const char *mask_str,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Utility function for making IPv6 address string. */
|
|
||||||
const char *inet6_ntoa(struct in6_addr addr)
|
|
||||||
{
|
|
||||||
static char buf[INET6_ADDRSTRLEN];
|
|
||||||
|
|
||||||
inet_ntop(AF_INET6, &addr, buf, INET6_ADDRSTRLEN);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* converts to internal representation of mac address
|
/* converts to internal representation of mac address
|
||||||
* returns 1 on success, 0 otherwise
|
* returns 1 on success, 0 otherwise
|
||||||
* format accepted: AA:BB:CC:DD:EE:FF
|
* format accepted: AA:BB:CC:DD:EE:FF
|
||||||
|
@ -504,8 +504,6 @@ extern void apply_mask_ipv6(struct prefix_ipv6 *);
|
|||||||
extern int ip6_masklen(struct in6_addr);
|
extern int ip6_masklen(struct in6_addr);
|
||||||
extern void masklen2ip6(const int, struct in6_addr *);
|
extern void masklen2ip6(const int, struct in6_addr *);
|
||||||
|
|
||||||
extern const char *inet6_ntoa(struct in6_addr);
|
|
||||||
|
|
||||||
extern int is_zero_mac(const struct ethaddr *mac);
|
extern int is_zero_mac(const struct ethaddr *mac);
|
||||||
extern bool is_mcast_mac(const struct ethaddr *mac);
|
extern bool is_mcast_mac(const struct ethaddr *mac);
|
||||||
extern bool is_bcast_mac(const struct ethaddr *mac);
|
extern bool is_bcast_mac(const struct ethaddr *mac);
|
||||||
|
@ -163,8 +163,8 @@ void ripng_peer_display(struct vty *vty, struct ripng *ripng)
|
|||||||
char timebuf[RIPNG_UPTIME_LEN];
|
char timebuf[RIPNG_UPTIME_LEN];
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(ripng->peer_list, node, nnode, peer)) {
|
for (ALL_LIST_ELEMENTS(ripng->peer_list, node, nnode, peer)) {
|
||||||
vty_out(vty, " %s \n%14s %10d %10d %10d %s\n",
|
vty_out(vty, " %pI6 \n%14s %10d %10d %10d %s\n",
|
||||||
inet6_ntoa(peer->addr), " ", peer->recv_badpackets,
|
&peer->addr, " ", peer->recv_badpackets,
|
||||||
peer->recv_badroutes, ZEBRA_RIPNG_DISTANCE_DEFAULT,
|
peer->recv_badroutes, ZEBRA_RIPNG_DISTANCE_DEFAULT,
|
||||||
ripng_peer_uptime(peer, timebuf, RIPNG_UPTIME_LEN));
|
ripng_peer_uptime(peer, timebuf, RIPNG_UPTIME_LEN));
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to,
|
|||||||
|
|
||||||
if (IS_RIPNG_DEBUG_SEND) {
|
if (IS_RIPNG_DEBUG_SEND) {
|
||||||
if (to)
|
if (to)
|
||||||
zlog_debug("send to %s", inet6_ntoa(to->sin6_addr));
|
zlog_debug("send to %pI6", &to->sin6_addr);
|
||||||
zlog_debug(" send interface %s", ifp->name);
|
zlog_debug(" send interface %s", ifp->name);
|
||||||
zlog_debug(" send packet size %d", bufsize);
|
zlog_debug(" send packet size %d", bufsize);
|
||||||
}
|
}
|
||||||
@ -237,8 +237,8 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (to)
|
if (to)
|
||||||
flog_err_sys(EC_LIB_SOCKET,
|
flog_err_sys(EC_LIB_SOCKET,
|
||||||
"RIPng send fail on %s to %s: %s",
|
"RIPng send fail on %s to %pI6: %s",
|
||||||
ifp->name, inet6_ntoa(to->sin6_addr),
|
ifp->name, &to->sin6_addr,
|
||||||
safe_strerror(errno));
|
safe_strerror(errno));
|
||||||
else
|
else
|
||||||
flog_err_sys(EC_LIB_SOCKET, "RIPng send fail on %s: %s",
|
flog_err_sys(EC_LIB_SOCKET, "RIPng send fail on %s: %s",
|
||||||
@ -338,11 +338,11 @@ void ripng_packet_dump(struct ripng_packet *packet, int size,
|
|||||||
|
|
||||||
for (lim = (caddr_t)packet + size; (caddr_t)rte < lim; rte++) {
|
for (lim = (caddr_t)packet + size; (caddr_t)rte < lim; rte++) {
|
||||||
if (rte->metric == RIPNG_METRIC_NEXTHOP)
|
if (rte->metric == RIPNG_METRIC_NEXTHOP)
|
||||||
zlog_debug(" nexthop %s/%d", inet6_ntoa(rte->addr),
|
zlog_debug(" nexthop %pI6/%d", &rte->addr,
|
||||||
rte->prefixlen);
|
rte->prefixlen);
|
||||||
else
|
else
|
||||||
zlog_debug(" %s/%d metric %d tag %" ROUTE_TAG_PRI,
|
zlog_debug(" %pI6/%d metric %d tag %" ROUTE_TAG_PRI,
|
||||||
inet6_ntoa(rte->addr), rte->prefixlen,
|
&rte->addr, rte->prefixlen,
|
||||||
rte->metric, (route_tag_t)ntohs(rte->tag));
|
rte->metric, (route_tag_t)ntohs(rte->tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,9 +353,9 @@ static void ripng_nexthop_rte(struct rte *rte, struct sockaddr_in6 *from,
|
|||||||
{
|
{
|
||||||
/* Logging before checking RTE. */
|
/* Logging before checking RTE. */
|
||||||
if (IS_RIPNG_DEBUG_RECV)
|
if (IS_RIPNG_DEBUG_RECV)
|
||||||
zlog_debug("RIPng nexthop RTE address %s tag %" ROUTE_TAG_PRI
|
zlog_debug("RIPng nexthop RTE address %pI6 tag %" ROUTE_TAG_PRI
|
||||||
" prefixlen %d",
|
" prefixlen %d",
|
||||||
inet6_ntoa(rte->addr), (route_tag_t)ntohs(rte->tag),
|
&rte->addr, (route_tag_t)ntohs(rte->tag),
|
||||||
rte->prefixlen);
|
rte->prefixlen);
|
||||||
|
|
||||||
/* RFC2080 2.1.1 Next Hop:
|
/* RFC2080 2.1.1 Next Hop:
|
||||||
@ -364,14 +364,13 @@ static void ripng_nexthop_rte(struct rte *rte, struct sockaddr_in6 *from,
|
|||||||
if (ntohs(rte->tag) != 0)
|
if (ntohs(rte->tag) != 0)
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"RIPng nexthop RTE with non zero tag value %" ROUTE_TAG_PRI
|
"RIPng nexthop RTE with non zero tag value %" ROUTE_TAG_PRI
|
||||||
" from %s",
|
" from %pI6",
|
||||||
(route_tag_t)ntohs(rte->tag),
|
(route_tag_t)ntohs(rte->tag), &from->sin6_addr);
|
||||||
inet6_ntoa(from->sin6_addr));
|
|
||||||
|
|
||||||
if (rte->prefixlen != 0)
|
if (rte->prefixlen != 0)
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"RIPng nexthop RTE with non zero prefixlen value %d from %s",
|
"RIPng nexthop RTE with non zero prefixlen value %d from %pI6",
|
||||||
rte->prefixlen, inet6_ntoa(from->sin6_addr));
|
rte->prefixlen, &from->sin6_addr);
|
||||||
|
|
||||||
/* Specifying a value of 0:0:0:0:0:0:0:0 in the prefix field of a
|
/* Specifying a value of 0:0:0:0:0:0:0:0 in the prefix field of a
|
||||||
next hop RTE indicates that the next hop address should be the
|
next hop RTE indicates that the next hop address should be the
|
||||||
@ -396,8 +395,8 @@ static void ripng_nexthop_rte(struct rte *rte, struct sockaddr_in6 *from,
|
|||||||
information is ignored, a possibly sub-optimal, but absolutely
|
information is ignored, a possibly sub-optimal, but absolutely
|
||||||
valid, route may be taken. If the received next hop address is not
|
valid, route may be taken. If the received next hop address is not
|
||||||
a link-local address, it should be treated as 0:0:0:0:0:0:0:0. */
|
a link-local address, it should be treated as 0:0:0:0:0:0:0:0. */
|
||||||
zlog_warn("RIPng nexthop RTE with non link-local address %s from %pI6",
|
zlog_warn("RIPng nexthop RTE with non link-local address %pI6 from %pI6",
|
||||||
inet6_ntoa(rte->addr), &from->sin6_addr);
|
&rte->addr, &from->sin6_addr);
|
||||||
|
|
||||||
nexthop->flag = RIPNG_NEXTHOP_UNSPEC;
|
nexthop->flag = RIPNG_NEXTHOP_UNSPEC;
|
||||||
memset(&nexthop->address, 0, sizeof(struct in6_addr));
|
memset(&nexthop->address, 0, sizeof(struct in6_addr));
|
||||||
@ -750,8 +749,8 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from,
|
|||||||
if (ret == RMAP_DENYMATCH) {
|
if (ret == RMAP_DENYMATCH) {
|
||||||
if (IS_RIPNG_DEBUG_PACKET)
|
if (IS_RIPNG_DEBUG_PACKET)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"RIPng %s/%d is filtered by route-map in",
|
"RIPng %pFX is filtered by route-map in",
|
||||||
inet6_ntoa(p.prefix), p.prefixlen);
|
&p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,8 +992,8 @@ void ripng_redistribute_add(struct ripng *ripng, int type, int sub_type,
|
|||||||
p, ifindex2ifname(ifindex, ripng->vrf->vrf_id));
|
p, ifindex2ifname(ifindex, ripng->vrf->vrf_id));
|
||||||
else
|
else
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"Redistribute new prefix %pFX with nexthop %s on the interface %s",
|
"Redistribute new prefix %pFX with nexthop %pI6 on the interface %s",
|
||||||
p, inet6_ntoa(*nexthop),
|
p, nexthop,
|
||||||
ifindex2ifname(ifindex, ripng->vrf->vrf_id));
|
ifindex2ifname(ifindex, ripng->vrf->vrf_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,8 +1105,8 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
|
|||||||
/* RFC2080 2.4.2 Response Messages:
|
/* RFC2080 2.4.2 Response Messages:
|
||||||
The Response must be ignored if it is not from the RIPng port. */
|
The Response must be ignored if it is not from the RIPng port. */
|
||||||
if (ntohs(from->sin6_port) != RIPNG_PORT_DEFAULT) {
|
if (ntohs(from->sin6_port) != RIPNG_PORT_DEFAULT) {
|
||||||
zlog_warn("RIPng packet comes from non RIPng port %d from %s",
|
zlog_warn("RIPng packet comes from non RIPng port %d from %pI6",
|
||||||
ntohs(from->sin6_port), inet6_ntoa(from->sin6_addr));
|
ntohs(from->sin6_port), &from->sin6_addr);
|
||||||
ripng_peer_bad_packet(ripng, from);
|
ripng_peer_bad_packet(ripng, from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1116,8 +1115,8 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
|
|||||||
whether the datagram is from a valid neighbor; the source of the
|
whether the datagram is from a valid neighbor; the source of the
|
||||||
datagram must be a link-local address. */
|
datagram must be a link-local address. */
|
||||||
if (!IN6_IS_ADDR_LINKLOCAL(&from->sin6_addr)) {
|
if (!IN6_IS_ADDR_LINKLOCAL(&from->sin6_addr)) {
|
||||||
zlog_warn("RIPng packet comes from non link local address %s",
|
zlog_warn("RIPng packet comes from non link local address %pI6",
|
||||||
inet6_ntoa(from->sin6_addr));
|
&from->sin6_addr);
|
||||||
ripng_peer_bad_packet(ripng, from);
|
ripng_peer_bad_packet(ripng, from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1129,8 +1128,8 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
|
|||||||
and such datagrams must be ignored. */
|
and such datagrams must be ignored. */
|
||||||
if (ripng_lladdr_check(ifp, &from->sin6_addr)) {
|
if (ripng_lladdr_check(ifp, &from->sin6_addr)) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"RIPng packet comes from my own link local address %s",
|
"RIPng packet comes from my own link local address %pI6",
|
||||||
inet6_ntoa(from->sin6_addr));
|
&from->sin6_addr);
|
||||||
ripng_peer_bad_packet(ripng, from);
|
ripng_peer_bad_packet(ripng, from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1141,8 +1140,8 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
|
|||||||
packets) must be examined to ensure that the hop count is 255. */
|
packets) must be examined to ensure that the hop count is 255. */
|
||||||
if (hoplimit >= 0 && hoplimit != 255) {
|
if (hoplimit >= 0 && hoplimit != 255) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"RIPng packet comes with non 255 hop count %d from %s",
|
"RIPng packet comes with non 255 hop count %d from %pI6",
|
||||||
hoplimit, inet6_ntoa(from->sin6_addr));
|
hoplimit, &from->sin6_addr);
|
||||||
ripng_peer_bad_packet(ripng, from);
|
ripng_peer_bad_packet(ripng, from);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1173,25 +1172,22 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
|
|||||||
should never be present in an RTE. */
|
should never be present in an RTE. */
|
||||||
if (IN6_IS_ADDR_MULTICAST(&rte->addr)) {
|
if (IN6_IS_ADDR_MULTICAST(&rte->addr)) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"Destination prefix is a multicast address %s/%d [%d]",
|
"Destination prefix is a multicast address %pI6/%d [%d]",
|
||||||
inet6_ntoa(rte->addr), rte->prefixlen,
|
&rte->addr, rte->prefixlen, rte->metric);
|
||||||
rte->metric);
|
|
||||||
ripng_peer_bad_route(ripng, from);
|
ripng_peer_bad_route(ripng, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (IN6_IS_ADDR_LINKLOCAL(&rte->addr)) {
|
if (IN6_IS_ADDR_LINKLOCAL(&rte->addr)) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"Destination prefix is a link-local address %s/%d [%d]",
|
"Destination prefix is a link-local address %pI6/%d [%d]",
|
||||||
inet6_ntoa(rte->addr), rte->prefixlen,
|
&rte->addr, rte->prefixlen, rte->metric);
|
||||||
rte->metric);
|
|
||||||
ripng_peer_bad_route(ripng, from);
|
ripng_peer_bad_route(ripng, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (IN6_IS_ADDR_LOOPBACK(&rte->addr)) {
|
if (IN6_IS_ADDR_LOOPBACK(&rte->addr)) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"Destination prefix is a loopback address %s/%d [%d]",
|
"Destination prefix is a loopback address %pI6/%d [%d]",
|
||||||
inet6_ntoa(rte->addr), rte->prefixlen,
|
&rte->addr, rte->prefixlen, rte->metric);
|
||||||
rte->metric);
|
|
||||||
ripng_peer_bad_route(ripng, from);
|
ripng_peer_bad_route(ripng, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1199,17 +1195,17 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
|
|||||||
/* - is the prefix length valid (i.e., between 0 and 128,
|
/* - is the prefix length valid (i.e., between 0 and 128,
|
||||||
inclusive) */
|
inclusive) */
|
||||||
if (rte->prefixlen > 128) {
|
if (rte->prefixlen > 128) {
|
||||||
zlog_warn("Invalid prefix length %s/%d from %s%%%s",
|
zlog_warn("Invalid prefix length %pI6/%d from %pI6%%%s",
|
||||||
inet6_ntoa(rte->addr), rte->prefixlen,
|
&rte->addr, rte->prefixlen,
|
||||||
inet6_ntoa(from->sin6_addr), ifp->name);
|
&from->sin6_addr, ifp->name);
|
||||||
ripng_peer_bad_route(ripng, from);
|
ripng_peer_bad_route(ripng, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* - is the metric valid (i.e., between 1 and 16, inclusive) */
|
/* - is the metric valid (i.e., between 1 and 16, inclusive) */
|
||||||
if (!(rte->metric >= 1 && rte->metric <= 16)) {
|
if (!(rte->metric >= 1 && rte->metric <= 16)) {
|
||||||
zlog_warn("Invalid metric %d from %s%%%s", rte->metric,
|
zlog_warn("Invalid metric %d from %pI6%%%s",
|
||||||
inet6_ntoa(from->sin6_addr), ifp->name);
|
rte->metric, &from->sin6_addr, ifp->name);
|
||||||
ripng_peer_bad_route(ripng, from);
|
ripng_peer_bad_route(ripng, from);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1342,8 +1338,8 @@ static int ripng_read(struct thread *thread)
|
|||||||
/* Check RTE boundary. RTE size (Packet length - RIPng header size
|
/* Check RTE boundary. RTE size (Packet length - RIPng header size
|
||||||
(4)) must be multiple size of one RTE size (20). */
|
(4)) must be multiple size of one RTE size (20). */
|
||||||
if (((len - 4) % 20) != 0) {
|
if (((len - 4) % 20) != 0) {
|
||||||
zlog_warn("RIPng invalid packet size %d from %s (VRF %s)", len,
|
zlog_warn("RIPng invalid packet size %d from %pI6 (VRF %s)",
|
||||||
inet6_ntoa(from.sin6_addr), ripng->vrf_name);
|
len, &from.sin6_addr, ripng->vrf_name);
|
||||||
ripng_peer_bad_packet(ripng, &from);
|
ripng_peer_bad_packet(ripng, &from);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1354,8 +1350,8 @@ static int ripng_read(struct thread *thread)
|
|||||||
/* RIPng packet received. */
|
/* RIPng packet received. */
|
||||||
if (IS_RIPNG_DEBUG_EVENT)
|
if (IS_RIPNG_DEBUG_EVENT)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"RIPng packet received from %s port %d on %s (VRF %s)",
|
"RIPng packet received from %pI6 port %d on %s (VRF %s)",
|
||||||
inet6_ntoa(from.sin6_addr), ntohs(from.sin6_port),
|
&from.sin6_addr, ntohs(from.sin6_port),
|
||||||
ifp ? ifp->name : "unknown", ripng->vrf_name);
|
ifp ? ifp->name : "unknown", ripng->vrf_name);
|
||||||
|
|
||||||
/* Logging before packet checking. */
|
/* Logging before packet checking. */
|
||||||
@ -1581,8 +1577,8 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
|
|||||||
|
|
||||||
if (IS_RIPNG_DEBUG_EVENT) {
|
if (IS_RIPNG_DEBUG_EVENT) {
|
||||||
if (to)
|
if (to)
|
||||||
zlog_debug("RIPng update routes to neighbor %s",
|
zlog_debug("RIPng update routes to neighbor %pI6",
|
||||||
inet6_ntoa(to->sin6_addr));
|
&to->sin6_addr);
|
||||||
else
|
else
|
||||||
zlog_debug("RIPng update routes on interface %s",
|
zlog_debug("RIPng update routes on interface %s",
|
||||||
ifp->name);
|
ifp->name);
|
||||||
@ -2089,8 +2085,8 @@ DEFUN (show_ipv6_ripng,
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
vty_out(vty, "%*s", 18, " ");
|
vty_out(vty, "%*s", 18, " ");
|
||||||
len = vty_out(vty, "%s",
|
len = vty_out(vty, "%pI6",
|
||||||
inet6_ntoa(rinfo->nexthop));
|
&rinfo->nexthop);
|
||||||
|
|
||||||
len = 28 - len;
|
len = 28 - len;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user