summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-ospf6.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2001-04-03 07:45:48 +0000
committerfenner <fenner@FreeBSD.org>2001-04-03 07:45:48 +0000
commitace14a2b50f2cc05c079d0b9137b49066dbb1206 (patch)
tree4953fdd47c44b8ec88d34a4db7b698841365e22f /contrib/tcpdump/print-ospf6.c
parent54c4a9c9f2aca2e032cbf41f5eb012e2e9628dd4 (diff)
downloadFreeBSD-src-ace14a2b50f2cc05c079d0b9137b49066dbb1206.zip
FreeBSD-src-ace14a2b50f2cc05c079d0b9137b49066dbb1206.tar.gz
Virgin import of tcpdump.org tcpdump v3.6.2
Diffstat (limited to 'contrib/tcpdump/print-ospf6.c')
-rw-r--r--contrib/tcpdump/print-ospf6.c94
1 files changed, 55 insertions, 39 deletions
diff --git a/contrib/tcpdump/print-ospf6.c b/contrib/tcpdump/print-ospf6.c
index f368346..f52b462 100644
--- a/contrib/tcpdump/print-ospf6.c
+++ b/contrib/tcpdump/print-ospf6.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.2 1999/11/21 09:36:58 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.6 2000/09/29 04:58:45 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -35,9 +35,6 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_var.h>
#include <ctype.h>
#include <stdio.h>
@@ -71,6 +68,13 @@ static const struct bits ospf6_rla_flag_bits[] = {
{ 0, NULL }
};
+static const struct bits ospf6_asla_flag_bits[] = {
+ { ASLA_FLAG_EXTERNAL, "E" },
+ { ASLA_FLAG_FWDADDR, "F" },
+ { ASLA_FLAG_ROUTETAG, "T" },
+ { 0, NULL }
+};
+
static struct tok type2str[] = {
{ OSPF_TYPE_UMD, "umd" },
{ OSPF_TYPE_HELLO, "hello" },
@@ -241,6 +245,8 @@ ospf6_print_lsaprefix(register const struct lsa_prefix *lsapp)
lsapp->lsa_p_len);
if (lsapp->lsa_p_opt)
printf("(opt=%x)", lsapp->lsa_p_opt);
+ if (lsapp->lsa_p_mbz)
+ printf("(mbz=%x)", ntohs(lsapp->lsa_p_mbz)); /* XXX */
return sizeof(*lsapp) - 4 + k * 4;
trunc:
@@ -254,7 +260,7 @@ trunc:
static int
ospf6_print_lsa(register const struct lsa *lsap)
{
- register const u_char *ls_end;
+ register const u_char *ls_end, *ls_opt;
register const struct rlalink *rlp;
#if 0
register const struct tos_metric *tosp;
@@ -270,6 +276,7 @@ ospf6_print_lsa(register const struct lsa *lsap)
register const u_int32_t *lp;
#endif
register int j, k;
+ u_int32_t flags32;
if (ospf6_print_lshdr(&lsap->ls_hdr))
return (1);
@@ -342,12 +349,51 @@ ospf6_print_lsa(register const struct lsa *lsap)
lsapp = lsap->lsa_un.un_inter_ap.inter_ap_prefix;
while (lsapp + sizeof(lsapp) <= (struct lsa_prefix *)ls_end) {
k = ospf6_print_lsaprefix(lsapp);
- if (k < 0)
+ if (k)
goto trunc;
lsapp = (struct lsa_prefix *)(((u_char *)lsapp) + k);
}
break;
+ case LS_SCOPE_AS | LS_TYPE_ASE:
+ TCHECK(lsap->lsa_un.un_asla.asla_metric);
+ flags32 = ntohl(lsap->lsa_un.un_asla.asla_metric);
+ ospf6_print_bits(ospf6_asla_flag_bits, flags32);
+ printf(" metric %u",
+ ntohl(lsap->lsa_un.un_asla.asla_metric) &
+ ASLA_MASK_METRIC);
+ lsapp = lsap->lsa_un.un_asla.asla_prefix;
+ k = ospf6_print_lsaprefix(lsapp);
+ if (k < 0)
+ goto trunc;
+ if ((ls_opt = (u_char *)(((u_char *)lsapp) + k)) < ls_end) {
+ struct in6_addr *fwdaddr6;
+
+ if ((flags32 & ASLA_FLAG_FWDADDR) != 0) {
+ fwdaddr6 = (struct in6_addr *)ls_opt;
+ TCHECK(*fwdaddr6);
+ printf(" forward %s",
+ ip6addr_string(fwdaddr6));
+ ls_opt += sizeof(struct in6_addr);
+ }
+
+ if ((flags32 & ASLA_FLAG_ROUTETAG) != 0) {
+ TCHECK(*(u_int32_t *)ls_opt);
+ printf(" tag %s",
+ ipaddr_string((u_int32_t *)ls_opt));
+
+ ls_opt += sizeof(u_int32_t);
+ }
+
+ if (lsapp->lsa_p_mbz) {
+ TCHECK(*(u_int32_t *)ls_opt);
+ printf(" RefLSID: %s",
+ ipaddr_string((u_int32_t *)ls_opt));
+
+ ls_opt += sizeof(u_int32_t);
+ }
+ }
+ break;
#if 0
case LS_TYPE_SUM_ABR:
TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
@@ -364,36 +410,6 @@ ospf6_print_lsa(register const struct lsa *lsap)
}
break;
- case LS_TYPE_ASE:
- TCHECK(lsap->lsa_un.un_nla.nla_mask);
- printf(" mask %s",
- ipaddr_string(&lsap->lsa_un.un_asla.asla_mask));
-
- TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
- almp = lsap->lsa_un.un_asla.asla_metric;
- while ((u_char *)almp < ls_end) {
- register u_int32_t ul;
-
- TCHECK(almp->asla_tosmetric);
- ul = ntohl(almp->asla_tosmetric);
- printf(" type %d tos %d metric %d",
- (ul & ASLA_FLAG_EXTERNAL) ? 2 : 1,
- (ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS,
- (ul & ASLA_MASK_METRIC));
- TCHECK(almp->asla_forward);
- if (almp->asla_forward.s_addr) {
- printf(" forward %s",
- ipaddr_string(&almp->asla_forward));
- }
- TCHECK(almp->asla_tag);
- if (almp->asla_tag.s_addr) {
- printf(" tag %s",
- ipaddr_string(&almp->asla_tag));
- }
- ++almp;
- }
- break;
-
case LS_TYPE_GROUP:
/* Multicast extensions as of 23 July 1991 */
mcp = lsap->lsa_un.un_mcla;
@@ -432,7 +448,7 @@ ospf6_print_lsa(register const struct lsa *lsap)
lsapp = llsap->llsa_prefix;
for (j = 0; j < ntohl(llsap->llsa_nprefix); j++) {
k = ospf6_print_lsaprefix(lsapp);
- if (k < 0)
+ if (k)
goto trunc;
lsapp = (struct lsa_prefix *)(((u_char *)lsapp) + k);
}
@@ -455,7 +471,7 @@ ospf6_print_lsa(register const struct lsa *lsap)
j < ntohs(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
j++) {
k = ospf6_print_lsaprefix(lsapp);
- if (k < 0)
+ if (k)
goto trunc;
lsapp = (struct lsa_prefix *)(((u_char *)lsapp) + k);
}
@@ -624,7 +640,7 @@ ospf6_print(register const u_char *bp, register u_int length)
/* value. If it's not valid, say so and return */
TCHECK(op->ospf6_type);
cp = tok2str(type2str, "type%d", op->ospf6_type);
- printf(" OSPFv%d-%s %d:", op->ospf6_version, cp, length);
+ printf("OSPFv%d-%s %d:", op->ospf6_version, cp, length);
if (*cp == 't')
return;
OpenPOWER on IntegriCloud