]> The Tcpdump Group git mirrors - tcpdump/commitdiff
OSPF: refine unknown packet type handling
authorDenis Ovsienko <[email protected]>
Thu, 13 Oct 2016 20:32:06 +0000 (21:32 +0100)
committerDenis Ovsienko <[email protected]>
Thu, 2 Feb 2017 20:55:03 +0000 (20:55 +0000)
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.

ospf.h
print-ospf.c

diff --git a/ospf.h b/ospf.h
index b47aaf69319deb1ca9ad49a12fade6fd62b30cde..9d0b4c46ba7572222673d559b46d8ec30a36f68b 100644 (file)
--- a/ospf.h
+++ b/ospf.h
@@ -20,7 +20,6 @@
  *
  * OSPF support contributed by Jeffrey Honig ([email protected])
  */
-#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 */
index db4231ba0f85eec030c4fca34682cf4719c396dd..8dad2eaa4b1fb1053855776b99e688aa36d56356 100644 (file)
@@ -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;