summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_asbr.c
diff options
context:
space:
mode:
authorDinesh Dutt <ddutt@cumulusnetworks.com>2013-08-25 03:03:23 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-11-07 18:15:43 -0800
commite68a67672ccfabefadac36c66e88af997fb572b2 (patch)
tree7f5b3c1386121457cc5052fc2530018093d947ae /ospf6d/ospf6_asbr.c
parent931b1b8c9a612665391ed43653c970fcb38bbbf0 (diff)
downloadquagga-e68a67672ccfabefadac36c66e88af997fb572b2.tar.bz2
quagga-e68a67672ccfabefadac36c66e88af997fb572b2.tar.xz
ospf6d: add LSA payload to show summary output
Unlike OSPFv2, the LSID of an LSA isn't sufficient to know what the contents of the LSA are. Its useful for debugging and basic eyeball tests to see the contents of the LSA in the simple tabular format of "show ipv6 ospf6 database". This patch adds that output to the command. It replaces the existing fields of "duration, Chksum and Length" with a single field called Payload which is dependent on the LSA type. For Inter-Area Prefix, Intra-Area Prefix and AS-External LSAs, this will be the advertised prefix/prefix length, for Router LSAs, it is RtrID/IfID etc. Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com> [DL: rebase fix, line disappeared in ospf6_abr_originate_summary_to_area] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_asbr.c')
-rw-r--r--ospf6d/ospf6_asbr.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 1a0634ed..27726c67 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -1161,12 +1161,44 @@ ospf6_routemap_init (void)
/* Display functions */
+static char *
+ospf6_as_external_lsa_get_prefix_str (struct ospf6_lsa *lsa, char *buf,
+ int buflen, int pos)
+{
+ struct ospf6_as_external_lsa *external;
+ struct in6_addr in6;
+ int prefix_length = 0;
+
+ if (lsa)
+ {
+ external = (struct ospf6_as_external_lsa *)
+ OSPF6_LSA_HEADER_END (lsa->header);
+
+ if (pos == 0)
+ {
+ ospf6_prefix_in6_addr (&in6, &external->prefix);
+ prefix_length = external->prefix.prefix_length;
+ }
+ else {
+ in6 = *((struct in6_addr *)
+ ((caddr_t) external + sizeof (struct ospf6_as_external_lsa) +
+ OSPF6_PREFIX_SPACE (external->prefix.prefix_length)));
+ }
+ if (buf)
+ {
+ inet_ntop (AF_INET6, &in6, buf, buflen);
+ if (prefix_length)
+ sprintf (&buf[strlen(buf)], "/%d", prefix_length);
+ }
+ }
+ return (buf);
+}
+
static int
ospf6_as_external_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
{
struct ospf6_as_external_lsa *external;
char buf[64];
- struct in6_addr in6, *forwarding;
assert (lsa->header);
external = (struct ospf6_as_external_lsa *)
@@ -1191,19 +1223,15 @@ ospf6_as_external_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
ntohs (external->prefix.prefix_refer_lstype),
VNL);
- ospf6_prefix_in6_addr (&in6, &external->prefix);
- inet_ntop (AF_INET6, &in6, buf, sizeof (buf));
- vty_out (vty, " Prefix: %s/%d%s", buf,
- external->prefix.prefix_length, VNL);
+ vty_out (vty, " Prefix: %s%s",
+ ospf6_as_external_lsa_get_prefix_str (lsa, buf, sizeof(buf), 0), VNL);
/* Forwarding-Address */
if (CHECK_FLAG (external->bits_metric, OSPF6_ASBR_BIT_F))
{
- forwarding = (struct in6_addr *)
- ((caddr_t) external + sizeof (struct ospf6_as_external_lsa) +
- OSPF6_PREFIX_SPACE (external->prefix.prefix_length));
- inet_ntop (AF_INET6, forwarding, buf, sizeof (buf));
- vty_out (vty, " Forwarding-Address: %s%s", buf, VNL);
+ vty_out (vty, " Forwarding-Address: %s%s",
+ ospf6_as_external_lsa_get_prefix_str (lsa, buf, sizeof(buf), 1),
+ VNL);
}
return 0;
@@ -1257,7 +1285,9 @@ struct ospf6_lsa_handler as_external_handler =
{
OSPF6_LSTYPE_AS_EXTERNAL,
"AS-External",
- ospf6_as_external_lsa_show
+ "ASE",
+ ospf6_as_external_lsa_show,
+ ospf6_as_external_lsa_get_prefix_str
};
void