From: hannes Date: Thu, 2 Oct 2003 13:35:52 +0000 (+0000) Subject: add better handling for unknown LSAs to OSPF X-Git-Tag: tcpdump-3.8-bp~43 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/0531555b158feffb9c62e4cbf8208b8c69c8a618 add better handling for unknown LSAs to OSPF --- diff --git a/ospf.h b/ospf.h index 8307f1cc..08e4e095 100644 --- a/ospf.h +++ b/ospf.h @@ -1,4 +1,4 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.7 2002-12-11 07:13:56 guy Exp $ (LBL) */ +/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.8 2003-10-02 13:35:52 hannes Exp $ (LBL) */ /* * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997 * The Regents of the University of California. All rights reserved. @@ -172,6 +172,11 @@ struct lsa { u_int16_t length; } un_opaque[1]; + /* Unknown LSA */ + struct unknown { + u_int8_t data[1]; /* may repeat */ + } un_unknown[1]; + } lsa_un; }; diff --git a/print-ospf.c b/print-ospf.c index 020dbec9..6cb6f98d 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.36 2002-12-23 19:57:49 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.37 2003-10-02 13:35:52 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -325,6 +325,31 @@ ospf_print_lsa(register const struct lsa *lsap) } ++mcp; } + break; + + /* + * FIXME those are the defined LSAs that lack a decoder + * you are welcome to contribute code ;-) + */ + + case LS_TYPE_OPAQUE_LL: + case LS_TYPE_OPAQUE_AL: + case LS_TYPE_OPAQUE_DW: + + default: + if (vflag <= 1) { + if(!print_unknown_data((u_char *)lsap->lsa_un.un_unknown, + "\n\t ", EXTRACT_16BITS(&lsap->ls_hdr.ls_length)-sizeof(struct lsa_hdr))) + return(0); + } + break; + } + + /* do we want to see an additionally hexdump ? */ + if (vflag> 1) { + if(!print_unknown_data((u_char *)lsap->lsa_un.un_unknown, + "\n\t ", EXTRACT_16BITS(&lsap->ls_hdr.ls_length)-sizeof(struct lsa_hdr))) + return(0); } return (0);