* prefix.[hc]: Pass argument to the inet6_ntoa by value making it more
inet_ntoa alike.
* ripngd.[hc], ripng_interface.c, ripng_peer.c: inet6_ntoa() takes
argument now by value.
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 3473257..1d3d3e6 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-08 Hasso Tepper <hasso at quagga.net>
+
+ * prefix.[hc]: Pass argument to the inet6_ntoa by value making it more
+ inet_ntoa alike.
+
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* linklist.h: Add usage comments.
diff --git a/lib/prefix.c b/lib/prefix.c
index 56539fc..2e594aa 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -738,11 +738,11 @@
#ifdef HAVE_IPV6
/* Utility function for making IPv6 address string. */
const char *
-inet6_ntoa (struct in6_addr *addr)
+inet6_ntoa (struct in6_addr addr)
{
static char buf[INET6_ADDRSTRLEN];
- inet_ntop (AF_INET6, addr, buf, INET6_ADDRSTRLEN);
+ inet_ntop (AF_INET6, &addr, buf, INET6_ADDRSTRLEN);
return buf;
}
#endif /* HAVE_IPV6 */
diff --git a/lib/prefix.h b/lib/prefix.h
index 7ef5347..506d644 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -173,7 +173,7 @@
void masklen2ip6 (int, struct in6_addr *);
void str2in6_addr (const char *, struct in6_addr *);
-const char *inet6_ntoa (struct in6_addr *);
+const char *inet6_ntoa (struct in6_addr);
#endif /* HAVE_IPV6 */
diff --git a/ripngd/ChangeLog b/ripngd/ChangeLog
index 78e1107..ee13c92 100644
--- a/ripngd/ChangeLog
+++ b/ripngd/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-08 Hasso Tepper <hasso at quagga.net>
+
+ * ripngd.[hc], ripng_interface.c, ripng_peer.c: inet6_ntoa() takes
+ argument now by value.
+
2005-04-05 Hasso Tepper <hasso at quagga.net>
* ripngd.[hc]: Remove inet6_ntop() and any usage of it. inet6_ntoa()
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index d2fa3d6..52a1fe2 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -437,7 +437,7 @@
{
if (IS_RIPNG_DEBUG_ZEBRA)
zlog_debug ("RIPng connected address %s/%d add",
- inet6_ntoa(&p->u.prefix6),
+ inet6_ntoa(p->u.prefix6),
p->prefixlen);
/* Check is this prefix needs to be redistributed. */
diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c
index bfbade5..34f5ac6 100644
--- a/ripngd/ripng_peer.c
+++ b/ripngd/ripng_peer.c
@@ -197,7 +197,7 @@
for (ALL_LIST_ELEMENTS (peer_list, node, nnode, peer))
{
- vty_out (vty, " %s %s%14s %10d %10d %10d %s%s", inet6_ntoa (&peer->addr),
+ vty_out (vty, " %s %s%14s %10d %10d %10d %s%s", inet6_ntoa (peer->addr),
VTY_NEWLINE, " ",
peer->recv_badpackets, peer->recv_badroutes,
ZEBRA_RIPNG_DISTANCE_DEFAULT,
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index ec6c4d0..453637c 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -165,7 +165,7 @@
if (IS_RIPNG_DEBUG_SEND) {
if (to)
- zlog_debug ("send to %s", inet6_ntoa (&to->sin6_addr));
+ zlog_debug ("send to %s", inet6_ntoa (to->sin6_addr));
zlog_debug (" send interface %s", ifp->name);
zlog_debug (" send packet size %d", bufsize);
}
@@ -213,7 +213,7 @@
if (ret < 0) {
if (to)
zlog_err ("RIPng send fail on %s to %s: %s", ifp->name,
- inet6_ntoa (&to->sin6_addr), safe_strerror (errno));
+ inet6_ntoa (to->sin6_addr), safe_strerror (errno));
else
zlog_err ("RIPng send fail on %s: %s", ifp->name, safe_strerror (errno));
}
@@ -309,10 +309,10 @@
for (lim = (caddr_t) packet + size; (caddr_t) rte < lim; rte++)
{
if (rte->metric == RIPNG_METRIC_NEXTHOP)
- zlog_debug (" nexthop %s/%d", inet6_ntoa (&rte->addr), rte->prefixlen);
+ zlog_debug (" nexthop %s/%d", inet6_ntoa (rte->addr), rte->prefixlen);
else
zlog_debug (" %s/%d metric %d tag %d",
- inet6_ntoa (&rte->addr), rte->prefixlen,
+ inet6_ntoa (rte->addr), rte->prefixlen,
rte->metric, ntohs (rte->tag));
}
}
@@ -328,18 +328,18 @@
/* Logging before checking RTE. */
if (IS_RIPNG_DEBUG_RECV)
zlog_debug ("RIPng nexthop RTE address %s tag %d prefixlen %d",
- inet6_ntoa (&rte->addr), ntohs (rte->tag), rte->prefixlen);
+ inet6_ntoa (rte->addr), ntohs (rte->tag), rte->prefixlen);
/* RFC2080 2.1.1 Next Hop:
The route tag and prefix length in the next hop RTE must be
set to zero on sending and ignored on receiption. */
if (ntohs (rte->tag) != 0)
zlog_warn ("RIPng nexthop RTE with non zero tag value %d from %s",
- ntohs (rte->tag), inet6_ntoa (&from->sin6_addr));
+ ntohs (rte->tag), inet6_ntoa (from->sin6_addr));
if (rte->prefixlen != 0)
zlog_warn ("RIPng nexthop RTE with non zero prefixlen value %d from %s",
- rte->prefixlen, inet6_ntoa (&from->sin6_addr));
+ rte->prefixlen, inet6_ntoa (from->sin6_addr));
/* 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
@@ -367,7 +367,7 @@
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. */
zlog_warn ("RIPng nexthop RTE with non link-local address %s from %s",
- inet6_ntoa (&rte->addr),
+ inet6_ntoa (rte->addr),
inet_ntop (AF_INET6, &from->sin6_addr, buf, INET6_BUFSIZ));
nexthop->flag = RIPNG_NEXTHOP_UNSPEC;
@@ -485,7 +485,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d filtered by distribute in",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -496,7 +496,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d filtered by prefix-list in",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -516,7 +516,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d filtered by distribute in",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -532,7 +532,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d filtered by prefix-list in",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -555,7 +555,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d is filtered by distribute out",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -566,7 +566,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d is filtered by prefix-list out",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -586,7 +586,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d filtered by distribute out",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -602,7 +602,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("%s/%d filtered by prefix-list out",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
return -1;
}
}
@@ -671,7 +671,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("RIPng %s/%d is filtered by route-map in",
- inet6_ntoa (&p.prefix), p.prefixlen);
+ inet6_ntoa (p.prefix), p.prefixlen);
return;
}
@@ -993,11 +993,11 @@
if (IS_RIPNG_DEBUG_EVENT) {
if (!nexthop)
zlog_debug ("Redistribute new prefix %s/%d on the interface %s",
- inet6_ntoa(&p->prefix), p->prefixlen,
+ inet6_ntoa(p->prefix), p->prefixlen,
ifindex2ifname(ifindex));
else
zlog_debug ("Redistribute new prefix %s/%d with nexthop %s on the interface %s",
- inet6_ntoa(&p->prefix), p->prefixlen, inet6_ntoa(nexthop),
+ inet6_ntoa(p->prefix), p->prefixlen, inet6_ntoa(*nexthop),
ifindex2ifname(ifindex));
}
@@ -1050,7 +1050,7 @@
if (IS_RIPNG_DEBUG_EVENT)
zlog_debug ("Poisone %s/%d on the interface %s with an infinity metric [delete]",
- inet6_ntoa(&p->prefix), p->prefixlen,
+ inet6_ntoa(p->prefix), p->prefixlen,
ifindex2ifname(ifindex));
ripng_event (RIPNG_TRIGGERED_UPDATE, 0);
@@ -1089,7 +1089,7 @@
struct prefix_ipv6 *p = (struct prefix_ipv6 *) &rp->p;
zlog_debug ("Poisone %s/%d on the interface %s [withdraw]",
- inet6_ntoa(&p->prefix), p->prefixlen,
+ inet6_ntoa(p->prefix), p->prefixlen,
ifindex2ifname(rinfo->ifindex));
}
@@ -1113,7 +1113,7 @@
if (ntohs (from->sin6_port) != RIPNG_PORT_DEFAULT)
{
zlog_warn ("RIPng packet comes from non RIPng port %d from %s",
- ntohs (from->sin6_port), inet6_ntoa (&from->sin6_addr));
+ ntohs (from->sin6_port), inet6_ntoa (from->sin6_addr));
ripng_peer_bad_packet (from);
return;
}
@@ -1124,7 +1124,7 @@
if (! IN6_IS_ADDR_LINKLOCAL(&from->sin6_addr))
{
zlog_warn ("RIPng packet comes from non link local address %s",
- inet6_ntoa (&from->sin6_addr));
+ inet6_ntoa (from->sin6_addr));
ripng_peer_bad_packet (from);
return;
}
@@ -1137,7 +1137,7 @@
if (ripng_lladdr_check (ifp, &from->sin6_addr))
{
zlog_warn ("RIPng packet comes from my own link local address %s",
- inet6_ntoa (&from->sin6_addr));
+ inet6_ntoa (from->sin6_addr));
ripng_peer_bad_packet (from);
return;
}
@@ -1149,7 +1149,7 @@
if (hoplimit >= 0 && hoplimit != 255)
{
zlog_warn ("RIPng packet comes with non 255 hop count %d from %s",
- hoplimit, inet6_ntoa (&from->sin6_addr));
+ hoplimit, inet6_ntoa (from->sin6_addr));
ripng_peer_bad_packet (from);
return;
}
@@ -1183,21 +1183,21 @@
if (IN6_IS_ADDR_MULTICAST (&rte->addr))
{
zlog_warn ("Destination prefix is a multicast address %s/%d [%d]",
- inet6_ntoa (&rte->addr), rte->prefixlen, rte->metric);
+ inet6_ntoa (rte->addr), rte->prefixlen, rte->metric);
ripng_peer_bad_route (from);
continue;
}
if (IN6_IS_ADDR_LINKLOCAL (&rte->addr))
{
zlog_warn ("Destination prefix is a link-local address %s/%d [%d]",
- inet6_ntoa (&rte->addr), rte->prefixlen, rte->metric);
+ inet6_ntoa (rte->addr), rte->prefixlen, rte->metric);
ripng_peer_bad_route (from);
continue;
}
if (IN6_IS_ADDR_LOOPBACK (&rte->addr))
{
zlog_warn ("Destination prefix is a loopback address %s/%d [%d]",
- inet6_ntoa (&rte->addr), rte->prefixlen, rte->metric);
+ inet6_ntoa (rte->addr), rte->prefixlen, rte->metric);
ripng_peer_bad_route (from);
continue;
}
@@ -1207,8 +1207,8 @@
if (rte->prefixlen > 128)
{
zlog_warn ("Invalid prefix length %s/%d from %s%%%s",
- inet6_ntoa (&rte->addr), rte->prefixlen,
- inet6_ntoa (&from->sin6_addr), ifp->name);
+ inet6_ntoa (rte->addr), rte->prefixlen,
+ inet6_ntoa (from->sin6_addr), ifp->name);
ripng_peer_bad_route (from);
continue;
}
@@ -1217,7 +1217,7 @@
if (! (rte->metric >= 1 && rte->metric <= 16))
{
zlog_warn ("Invalid metric %d from %s%%%s", rte->metric,
- inet6_ntoa (&from->sin6_addr), ifp->name);
+ inet6_ntoa (from->sin6_addr), ifp->name);
ripng_peer_bad_route (from);
continue;
}
@@ -1357,7 +1357,7 @@
if (((len - 4) % 20) != 0)
{
zlog_warn ("RIPng invalid packet size %d from %s", len,
- inet6_ntoa (&from.sin6_addr));
+ inet6_ntoa (from.sin6_addr));
ripng_peer_bad_packet (&from);
return 0;
}
@@ -1368,7 +1368,7 @@
/* RIPng packet received. */
if (IS_RIPNG_DEBUG_EVENT)
zlog_debug ("RIPng packet received from %s port %d on %s",
- inet6_ntoa (&from.sin6_addr), ntohs (from.sin6_port),
+ inet6_ntoa (from.sin6_addr), ntohs (from.sin6_port),
ifp ? ifp->name : "unknown");
/* Logging before packet checking. */
@@ -1600,7 +1600,7 @@
if (IS_RIPNG_DEBUG_EVENT) {
if (to)
zlog_debug ("RIPng update routes to neighbor %s",
- inet6_ntoa(&to->sin6_addr));
+ inet6_ntoa(to->sin6_addr));
else
zlog_debug ("RIPng update routes on interface %s", ifp->name);
}
@@ -1669,7 +1669,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("RIPng %s/%d is filtered by route-map out",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
continue;
}
@@ -1688,7 +1688,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("RIPng %s/%d is filtered by route-map",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
continue;
}
}
@@ -1774,7 +1774,7 @@
{
if (IS_RIPNG_DEBUG_PACKET)
zlog_debug ("RIPng %s/%d is filtered by route-map out",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
continue;
}
@@ -2039,10 +2039,10 @@
#ifdef DEBUG
len = vty_out (vty, "R(a) %d/%d %s/%d ",
aggregate->count, aggregate->suppress,
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
#else
len = vty_out (vty, "R(a) %s/%d ",
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
#endif /* DEBUG */
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, "%*s", 18, " ");
@@ -2062,16 +2062,16 @@
route_info[rinfo->type].str,
ripng_route_subtype_print(rinfo),
rinfo->suppress,
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
#else
len = vty_out (vty, "%s(%s) %s/%d ",
route_info[rinfo->type].str,
ripng_route_subtype_print(rinfo),
- inet6_ntoa (&p->prefix), p->prefixlen);
+ inet6_ntoa (p->prefix), p->prefixlen);
#endif /* DEBUG */
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, "%*s", 18, " ");
- len = vty_out (vty, "%s", inet6_ntoa (&rinfo->nexthop));
+ len = vty_out (vty, "%s", inet6_ntoa (rinfo->nexthop));
len = 28 - len;
if (len > 0)
@@ -2673,7 +2673,7 @@
for (rp = route_top (ripng->aggregate); rp; rp = route_next (rp))
if (rp->info != NULL)
vty_out (vty, " aggregate-address %s/%d%s",
- inet6_ntoa (&rp->p.u.prefix6),
+ inet6_ntoa (rp->p.u.prefix6),
rp->p.prefixlen,
VTY_NEWLINE);
@@ -2681,7 +2681,7 @@
/* RIPng static routes. */
for (rp = route_top (ripng->route); rp; rp = route_next (rp))
if (rp->info != NULL)
- vty_out (vty, " route %s/%d%s", inet6_ntoa (&rp->p.u.prefix6),
+ vty_out (vty, " route %s/%d%s", inet6_ntoa (rp->p.u.prefix6),
rp->p.prefixlen,
VTY_NEWLINE);