summaryrefslogtreecommitdiff
path: root/zebra
diff options
context:
space:
mode:
authorVincent Bernat <bernat@luffy.cx>2012-10-23 16:00:42 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-10-22 10:38:35 -0700
commitfed643f4093abc0ed5e796aab9047768f7036ed6 (patch)
treeffa07bd17a939b386813f5b08c8f92f302d8c505 /zebra
parentf3a1732eb3bb41c094ec558d2aeee2766878a91d (diff)
zebra: make rib_dump() compatible with IPv6 RIB
[DL: resolved conflicts in zebra_rib.c] [DL: fix usage with --disable-ipv6] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/rib.h2
-rw-r--r--zebra/zebra_rib.c31
2 files changed, 24 insertions, 9 deletions
diff --git a/zebra/rib.h b/zebra/rib.h
index 1c548795..97a20af3 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -386,7 +386,7 @@ extern struct nexthop *nexthop_ipv4_ifindex_add (struct rib *,
extern int nexthop_has_fib_child(struct nexthop *);
extern void rib_lookup_and_dump (struct prefix_ipv4 *);
extern void rib_lookup_and_pushup (struct prefix_ipv4 *);
-extern void rib_dump (const char *, const struct prefix_ipv4 *, const struct rib *);
+extern void rib_dump (const char *, const struct prefix *, const struct rib *);
extern int rib_lookup_ipv4_route (struct prefix_ipv4 *, union sockunion *);
#define ZEBRA_RIB_LOOKUP_ERROR -1
#define ZEBRA_RIB_FOUND_EXACT 0
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index ace69cac..77c0d8ca 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1912,13 +1912,13 @@ rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
* question are passed as 1st and 2nd arguments.
*/
-void rib_dump (const char * func, const struct prefix_ipv4 * p, const struct rib * rib)
+void rib_dump (const char * func, const struct prefix * p, const struct rib * rib)
{
- char straddr[INET_ADDRSTRLEN];
+ char straddr[INET6_ADDRSTRLEN];
struct nexthop *nexthop, *tnexthop;
int recursing;
- inet_ntop (AF_INET, &p->prefix, straddr, INET_ADDRSTRLEN);
+ inet_ntop (p->family, &p->u.prefix, straddr, INET6_ADDRSTRLEN);
zlog_debug ("%s: dumping RIB entry %p for %s/%d", func, rib, straddr, p->prefixlen);
zlog_debug
(
@@ -1946,9 +1946,10 @@ void rib_dump (const char * func, const struct prefix_ipv4 * p, const struct rib
rib->nexthop_active_num,
rib->nexthop_fib_num
);
+
for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
{
- inet_ntop (AF_INET, &nexthop->gate.ipv4.s_addr, straddr, INET_ADDRSTRLEN);
+ inet_ntop (p->family, &nexthop->gate, straddr, INET6_ADDRSTRLEN);
zlog_debug
(
"%s: %s %s with flags %s%s%s",
@@ -2008,7 +2009,7 @@ void rib_lookup_and_dump (struct prefix_ipv4 * p)
(CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED) ? "removed" : "NOT removed"),
(CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) ? "selected" : "NOT selected")
);
- rib_dump (__func__, p, rib);
+ rib_dump (__func__, (struct prefix *) p, rib);
}
}
@@ -2055,7 +2056,7 @@ void rib_lookup_and_pushup (struct prefix_ipv4 * p)
char buf[INET_ADDRSTRLEN];
inet_ntop (rn->p.family, &p->prefix, buf, INET_ADDRSTRLEN);
zlog_debug ("%s: freeing way for connected prefix %s/%d", __func__, buf, p->prefixlen);
- rib_dump (__func__, (struct prefix_ipv4 *)&rn->p, rib);
+ rib_dump (__func__, &rn->p, rib);
}
rib_uninstall (rn, rib);
}
@@ -2117,7 +2118,7 @@ rib_add_ipv4_multipath (struct prefix_ipv4 *p, struct rib *rib, safi_t safi)
{
zlog_debug ("%s: called rib_addnode (%p, %p) on new RIB entry",
__func__, rn, rib);
- rib_dump (__func__, p, rib);
+ rib_dump (__func__, (struct prefix *) p, rib);
}
/* Free implicit route.*/
@@ -2127,7 +2128,7 @@ rib_add_ipv4_multipath (struct prefix_ipv4 *p, struct rib *rib, safi_t safi)
{
zlog_debug ("%s: calling rib_delnode (%p, %p) on existing RIB entry",
__func__, rn, same);
- rib_dump (__func__, p, same);
+ rib_dump (__func__, (struct prefix *) p, same);
}
rib_delnode (rn, same);
}
@@ -2693,10 +2694,24 @@ rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
/* Link new rib to node.*/
rib_addnode (rn, rib);
+ if (IS_ZEBRA_DEBUG_RIB)
+ {
+ zlog_debug ("%s: called rib_addnode (%p, %p) on new RIB entry",
+ __func__, rn, rib);
+ rib_dump (__func__, (struct prefix *) p, rib);
+ }
/* Free implicit route.*/
if (same)
+ {
+ if (IS_ZEBRA_DEBUG_RIB)
+ {
+ zlog_debug ("%s: calling rib_delnode (%p, %p) on existing RIB entry",
+ __func__, rn, same);
+ rib_dump (__func__, (struct prefix *) p, same);
+ }
rib_delnode (rn, same);
+ }
route_unlock_node (rn);
return 0;