summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_abr.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_abr.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_abr.c')
-rw-r--r--ospf6d/ospf6_abr.c61
1 files changed, 53 insertions, 8 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 3277e7d8..379a62ed 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -764,12 +764,34 @@ ospf6_abr_reimport (struct ospf6_area *oa)
/* Display functions */
+static char *
+ospf6_inter_area_prefix_lsa_get_prefix_str (struct ospf6_lsa *lsa, char *buf,
+ int buflen, int pos)
+{
+ struct ospf6_inter_prefix_lsa *prefix_lsa;
+ struct in6_addr in6;
+
+ if (lsa != NULL)
+ {
+ prefix_lsa = (struct ospf6_inter_prefix_lsa *)
+ OSPF6_LSA_HEADER_END (lsa->header);
+
+ ospf6_prefix_in6_addr (&in6, &prefix_lsa->prefix);
+ if (buf)
+ {
+ inet_ntop (AF_INET6, &in6, buf, buflen);
+ sprintf (&buf[strlen(buf)], "/%d", prefix_lsa->prefix.prefix_length);
+ }
+ }
+
+ return (buf);
+}
+
static int
ospf6_inter_area_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
{
struct ospf6_inter_prefix_lsa *prefix_lsa;
- struct in6_addr in6;
- char buf[64];
+ char buf[INET6_ADDRSTRLEN];
prefix_lsa = (struct ospf6_inter_prefix_lsa *)
OSPF6_LSA_HEADER_END (lsa->header);
@@ -781,14 +803,32 @@ ospf6_inter_area_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
buf, sizeof (buf));
vty_out (vty, " Prefix Options: %s%s", buf, VNL);
- ospf6_prefix_in6_addr (&in6, &prefix_lsa->prefix);
- inet_ntop (AF_INET6, &in6, buf, sizeof (buf));
- vty_out (vty, " Prefix: %s/%d%s", buf,
- prefix_lsa->prefix.prefix_length, VNL);
+ vty_out (vty, " Prefix: %s%s",
+ ospf6_inter_area_prefix_lsa_get_prefix_str (lsa, buf, sizeof(buf),
+ 0), VNL);
return 0;
}
+static char *
+ospf6_inter_area_router_lsa_get_prefix_str (struct ospf6_lsa *lsa, char *buf,
+ int buflen, int pos)
+{
+ struct ospf6_inter_router_lsa *router_lsa;
+
+ if (lsa != NULL)
+ {
+ router_lsa = (struct ospf6_inter_router_lsa *)
+ OSPF6_LSA_HEADER_END (lsa->header);
+
+
+ if (buf)
+ inet_ntop (AF_INET, &router_lsa->router_id, buf, buflen);
+ }
+
+ return (buf);
+}
+
static int
ospf6_inter_area_router_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
{
@@ -802,6 +842,7 @@ ospf6_inter_area_router_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
vty_out (vty, " Options: %s%s", buf, VNL);
vty_out (vty, " Metric: %lu%s",
(u_long) OSPF6_ABR_SUMMARY_METRIC (router_lsa), VNL);
+
inet_ntop (AF_INET, &router_lsa->router_id, buf, sizeof (buf));
vty_out (vty, " Destination Router ID: %s%s", buf, VNL);
@@ -855,14 +896,18 @@ struct ospf6_lsa_handler inter_prefix_handler =
{
OSPF6_LSTYPE_INTER_PREFIX,
"Inter-Prefix",
- ospf6_inter_area_prefix_lsa_show
+ "IAP",
+ ospf6_inter_area_prefix_lsa_show,
+ ospf6_inter_area_prefix_lsa_get_prefix_str,
};
struct ospf6_lsa_handler inter_router_handler =
{
OSPF6_LSTYPE_INTER_ROUTER,
"Inter-Router",
- ospf6_inter_area_router_lsa_show
+ "IAR",
+ ospf6_inter_area_router_lsa_show,
+ ospf6_inter_area_router_lsa_get_prefix_str,
};
void