2003-10-18 Lorenzo Colitti <lorenzo@ripe.net>
2003-10-18 Lorenzo Colitti <lorenzo@ripe.net>
* bgpd/bgp_attr.c: (bgp_dump_routes_attr) Dont dump IPv4 nexthop
for IP. Dump MP_NLRI attr with IPv6 next-hop for AF_INET6 address
family prefixes. Accept prefix as argument.
* bgpd/bgp_attr.c: modify bgp_dump_routes_attr declaration.
* bgpd/bgp_dump.c: (bgp_dump_routes_entry) Modify calls to
bgp_dump_routes_attr.
(bgp_dump_common) Go by the family of the peering socket, not
configured address family when dumping peering information.
Add HAVE_IPV6 conditionals, eg missing from previous bgp interval
patch.
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index 516e9b2..e3c6281 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -236,7 +236,7 @@
stream_putw (obuf, peer->as);
/* Dump attribute. */
- bgp_dump_routes_attr (obuf, attr);
+ bgp_dump_routes_attr (obuf, attr, NULL);
}
else
{
@@ -246,7 +246,7 @@
stream_putc (obuf, p->prefixlen);
plen = PSIZE (p->prefixlen);
stream_put (obuf, &p->u.prefix4, plen);
- bgp_dump_routes_attr (obuf, attr);
+ bgp_dump_routes_attr (obuf, attr, NULL);
}
}
#ifdef HAVE_IPV6
@@ -272,7 +272,7 @@
stream_putw (obuf, peer->as);
/* Dump attribute. */
- bgp_dump_routes_attr (obuf, attr);
+ bgp_dump_routes_attr (obuf, attr, p);
}
else
{
@@ -330,7 +330,9 @@
if (bgp_dump->type == BGP_DUMP_ROUTES)
{
bgp_dump_routes_func (AFI_IP);
+#ifdef HAVE_IPV6
bgp_dump_routes_func (AFI_IP6);
+#endif /* HAVE_IPV6 */
/* Close the file now. For a RIB dump there's no point in leaving
* it open until the next scheduled dump starts. */
fclose(bgp_dump->fp); bgp_dump->fp = NULL;
@@ -354,7 +356,7 @@
stream_putw (obuf, peer->as);
stream_putw (obuf, peer->local_as);
- if (peer->afc[AFI_IP][SAFI_UNICAST])
+ if (peer->su.sa.sa_family == AF_INET)
{
stream_putw (obuf, peer->ifindex);
stream_putw (obuf, AFI_IP);
@@ -367,7 +369,7 @@
stream_put (obuf, empty, IPV4_MAX_BYTELEN);
}
#ifdef HAVE_IPV6
- else if (peer->afc[AFI_IP6][SAFI_UNICAST])
+ else if (peer->su.sa.sa_family == AF_INET6)
{
/* Interface Index and Address family. */
stream_putw (obuf, peer->ifindex);