From: Denis Ovsienko Date: Thu, 13 Oct 2016 20:32:06 +0000 (+0100) Subject: OSPF: refine unknown packet type handling X-Git-Tag: tcpdump-4.99-bp~2086 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/a13a19a61047d79e2090b7261e57f8bd595b89d2 OSPF: refine unknown packet type handling As far as modern OSPF implementations are concerned, packet type 0 is not a valid value, so let's print it as such. Also for an invalid packet type tell its decimal value. --- diff --git a/ospf.h b/ospf.h index b47aaf69..9d0b4c46 100644 --- a/ospf.h +++ b/ospf.h @@ -20,7 +20,6 @@ * * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu) */ -#define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */ #define OSPF_TYPE_HELLO 1 /* Hello */ #define OSPF_TYPE_DD 2 /* Database Description */ #define OSPF_TYPE_LS_REQ 3 /* Link State Request */ diff --git a/print-ospf.c b/print-ospf.c index db4231ba..8dad2eaa 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -66,7 +66,6 @@ static const struct tok ospf_rla_flag_values[] = { }; static const struct tok type2str[] = { - { OSPF_TYPE_UMD, "UMD" }, { OSPF_TYPE_HELLO, "Hello" }, { OSPF_TYPE_DD, "Database Description" }, { OSPF_TYPE_LS_REQ, "LS-Request" }, @@ -988,13 +987,6 @@ ospf_decode_v2(netdissect_options *ndo, switch (op->ospf_type) { - case OSPF_TYPE_UMD: - /* - * Rob Coltun's special monitoring packets; - * do nothing - */ - break; - case OSPF_TYPE_HELLO: ND_TCHECK(op->ospf_hello.hello_options); ND_PRINT((ndo, "\n\tOptions [%s]", @@ -1127,7 +1119,7 @@ ospf_print(netdissect_options *ndo, /* If the type is valid translate it, or just print the type */ /* value. If it's not valid, say so and return */ ND_TCHECK(op->ospf_type); - cp = tok2str(type2str, "unknown LS-type", op->ospf_type); + cp = tok2str(type2str, "unknown LS-type %u", op->ospf_type); ND_PRINT((ndo, "OSPFv%u, %s, length %u", op->ospf_version, cp, length)); if (*cp == 'u') return;