summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2009-01-28 22:51:27 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2009-01-28 22:51:27 +0000
commit75008cd9adfe63e311ed725449634dc8ec23d3a2 (patch)
treed59ca68e1ae4709d9ead25a52431bbe266dee138
parentd0f80747e712b70e2ed54f469201e8362cb205d5 (diff)
Add 'show database intra' command, which displays Intra-Area-Prefix LSAs.
ok claudio@
-rw-r--r--usr.sbin/ospf6ctl/ospf6ctl.c36
-rw-r--r--usr.sbin/ospf6ctl/parser.c3
-rw-r--r--usr.sbin/ospf6ctl/parser.h3
3 files changed, 39 insertions, 3 deletions
diff --git a/usr.sbin/ospf6ctl/ospf6ctl.c b/usr.sbin/ospf6ctl/ospf6ctl.c
index 7041eb5b5c3..83e1de3c6c8 100644
--- a/usr.sbin/ospf6ctl/ospf6ctl.c
+++ b/usr.sbin/ospf6ctl/ospf6ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6ctl.c,v 1.19 2009/01/28 17:34:15 stsp Exp $ */
+/* $OpenBSD: ospf6ctl.c,v 1.20 2009/01/28 22:51:26 stsp Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -165,6 +165,9 @@ main(int argc, char *argv[])
case SHOW_DBRTR:
imsg_compose(ibuf, IMSG_CTL_SHOW_DB_RTR, 0, 0, NULL, 0);
break;
+ case SHOW_DBINTRA:
+ imsg_compose(ibuf, IMSG_CTL_SHOW_DB_INTRA, 0, 0, NULL, 0);
+ break;
case SHOW_DBSELF:
imsg_compose(ibuf, IMSG_CTL_SHOW_DB_SELF, 0, 0, NULL, 0);
break;
@@ -251,6 +254,7 @@ main(int argc, char *argv[])
case SHOW_DBLINK:
case SHOW_DBNET:
case SHOW_DBRTR:
+ case SHOW_DBINTRA:
case SHOW_DBSUM:
case SHOW_DBASBR:
done = show_db_msg_detail(&imsg);
@@ -845,6 +849,36 @@ show_db_msg_detail(struct imsg *imsg)
lasttype = lsa->hdr.type;
break;
+ case IMSG_CTL_SHOW_DB_INTRA:
+ lsa = imsg->data;
+ if (lsa->hdr.type != lasttype)
+ show_database_head(area_id, ifname, lsa->hdr.type);
+ show_db_hdr_msg_detail(&lsa->hdr);
+ printf("Referenced LS Type: %s\n",
+ print_ls_type(lsa->data.pref_intra.ref_type));
+ addr.s_addr = lsa->data.pref_intra.ref_lsid;
+ printf("Referenced Link State ID: %s\n", inet_ntoa(addr));
+ addr.s_addr = lsa->data.pref_intra.ref_adv_rtr;
+ printf("Referenced Advertising Router: %s\n", inet_ntoa(addr));
+ nlinks = ntohs(lsa->data.pref_intra.numprefix);
+ printf("Number of Prefixes: %d\n", nlinks);
+
+ off = sizeof(lsa->hdr) + sizeof(struct lsa_intra_prefix);
+
+ for (i = 0; i < nlinks; i++) {
+ struct in6_addr ia6;
+ prefix = (struct lsa_prefix *)((char *)lsa + off);
+ bzero(&ia6, sizeof(ia6));
+ bcopy(prefix + 1, &ia6,
+ LSA_PREFIXSIZE(prefix->prefixlen));
+
+ printf(" Prefix Address: %s\n", log_in6addr(&ia6));
+ printf(" Prefix Length: %d, Options: %x\n",
+ prefix->prefixlen, prefix->options);
+
+ off += sizeof(struct lsa_prefix);
+ }
+ break;
case IMSG_CTL_SHOW_DB_SUM:
lsa = imsg->data;
if (lsa->hdr.type != lasttype)
diff --git a/usr.sbin/ospf6ctl/parser.c b/usr.sbin/ospf6ctl/parser.c
index 6608b95f50a..400a15f5326 100644
--- a/usr.sbin/ospf6ctl/parser.c
+++ b/usr.sbin/ospf6ctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.5 2008/12/30 21:33:52 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.6 2009/01/28 22:51:26 stsp Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -99,6 +99,7 @@ static const struct token t_show_db[] = {
{KEYWORD, "link", SHOW_DBLINK, NULL},
{KEYWORD, "network", SHOW_DBNET, NULL},
{KEYWORD, "router", SHOW_DBRTR, NULL},
+ {KEYWORD, "intra", SHOW_DBINTRA, NULL},
{KEYWORD, "self-originated", SHOW_DBSELF, NULL},
{KEYWORD, "summary", SHOW_DBSUM, NULL},
{ENDTOKEN, "", NONE, NULL}
diff --git a/usr.sbin/ospf6ctl/parser.h b/usr.sbin/ospf6ctl/parser.h
index 5ac958a176c..dd16724fc14 100644
--- a/usr.sbin/ospf6ctl/parser.h
+++ b/usr.sbin/ospf6ctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.4 2008/12/30 21:33:52 claudio Exp $ */
+/* $OpenBSD: parser.h,v 1.5 2009/01/28 22:51:26 stsp Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -41,6 +41,7 @@ enum actions {
SHOW_DBLINK,
SHOW_DBNET,
SHOW_DBRTR,
+ SHOW_DBINTRA,
SHOW_DBSELF,
SHOW_DBSUM,
SHOW_DBASBR,