-/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.8 2003-10-02 13:35:52 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.9 2003-10-03 13:00:33 hannes Exp $ (LBL) */
/*
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
u_int16_t ls_age;
u_int8_t ls_options;
u_int8_t ls_type;
- struct in_addr ls_stateid;
+ union {
+ struct in_addr ls_stateid;
+ struct { /* opaque LSAs change the LSA-ID field */
+ u_int8_t opaque_type;
+ u_int8_t opaque_id[3];
+ };
+ };
struct in_addr ls_router;
u_int32_t ls_seq;
u_int16_t ls_chksum;
struct in_addr mcla_vid;
} un_mcla[1];
- /* Opaque LSA */
- struct opaque {
- u_int8_t opaque_type;
- u_int8_t opaque_id[3];
- struct in_addr adv_router;
- struct in_addr sequence_num;
- u_int16_t chksum;
- u_int16_t length;
- } un_opaque[1];
-
/* Unknown LSA */
struct unknown {
u_int8_t data[1]; /* may repeat */
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.37 2003-10-02 13:35:52 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.38 2003-10-03 13:00:33 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
register const u_int32_t *lp;
register int j, k;
- printf("\n\t %s LSA (%d), LSA-ID: %s, Advertising Router: %s, seq 0x%08x, age %us",
- tok2str(lsa_values,"unknown",lsap->ls_hdr.ls_type),
- lsap->ls_hdr.ls_type,
- ipaddr_string(&lsap->ls_hdr.ls_stateid),
- ipaddr_string(&lsap->ls_hdr.ls_router),
- EXTRACT_32BITS(&lsap->ls_hdr.ls_seq),
- EXTRACT_16BITS(&lsap->ls_hdr.ls_age));
+ switch (lsap->ls_hdr.ls_type) {
+
+ /* the LSA header for opaque LSAs was slightly changed */
+ case LS_TYPE_OPAQUE_LL:
+ case LS_TYPE_OPAQUE_AL:
+ case LS_TYPE_OPAQUE_DW:
+
+ printf("\n\t %s LSA (%d), Opaque-Type: %u, Opaque-ID: %u, Adv. Router: %s, seq 0x%08x, age %us",
+ tok2str(lsa_values,"unknown",lsap->ls_hdr.ls_type),
+ (lsap->ls_hdr.ls_type),
+ *(&lsap->ls_hdr.opaque_type),
+ EXTRACT_24BITS(&lsap->ls_hdr.opaque_id),
+ ipaddr_string(&lsap->ls_hdr.ls_router),
+ EXTRACT_32BITS(&lsap->ls_hdr.ls_seq),
+ EXTRACT_16BITS(&lsap->ls_hdr.ls_age));
+
+ break;
+
+ /* all other LSA types use regular style LSA headers */
+ default:
+ printf("\n\t %s LSA (%d), LSA-ID: %s, Adv. Router: %s, seq 0x%08x, age %us",
+ tok2str(lsa_values,"unknown",lsap->ls_hdr.ls_type),
+ lsap->ls_hdr.ls_type,
+ ipaddr_string(&lsap->ls_hdr.ls_stateid),
+ ipaddr_string(&lsap->ls_hdr.ls_router),
+ EXTRACT_32BITS(&lsap->ls_hdr.ls_seq),
+ EXTRACT_16BITS(&lsap->ls_hdr.ls_age));
+ break;
+ }
+
printf("\n\t Options: %s", bittok2str(ospf_option_values,"none",lsap->ls_hdr.ls_options));
TCHECK(lsap->ls_hdr.ls_length);