]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CLNP: squelch a fall-through warning (GH #618)
authorDenis Ovsienko <[email protected]>
Thu, 26 Jul 2018 12:16:11 +0000 (13:16 +0100)
committerDenis Ovsienko <[email protected]>
Thu, 26 Jul 2018 12:16:11 +0000 (13:16 +0100)
This change addresses one of the warnings listed in the bug report.

./print-isoclns.c: In function ‘clnp_print’:
./print-isoclns.c:1054:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
             if (EXTRACT_U_1(pptr) == NLPID_CLNP) {
                ^
./print-isoclns.c:1061:9: note: here
         case  CLNP_PDU_DT:
         ^~~~

[skip ci]

print-isoclns.c

index 38bdd833d87b5ff0640a2fcfb5a502fe2b98dabc..241d6087e912698e9a4e3f35adbc8f16aea64dd4 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * specification:
  *
- * CLNP: ISO 8473
+ * CLNP: ISO 8473 (respective ITU version is at http://www.itu.int/rec/T-REC-X.233/en/)
  * ES-IS: ISO 9542
  * IS-IS: ISO 10589
  */
@@ -1058,6 +1058,18 @@ clnp_print(netdissect_options *ndo,
                 break;
             }
 
+        /* The cases above break from the switch block if they see and print
+         * a CLNP header in the Data part. For an Error Report PDU this is
+         * described in Section 7.9.6 of ITU X.233 (1997 E), also known as
+         * ISO/IEC 8473-1:1998(E). It is not clear why in this code the same
+         * applies to an Echo Response PDU, as the standard does not specify
+         * the contents -- could be a proprietary extension or a bug. In either
+         * case, if the Data part does not contain a CLNP header, its structure
+         * is considered unknown and the decoding falls through to print the
+         * contents as-is.
+         */
+        ND_FALL_THROUGH;
+
         case   CLNP_PDU_DT:
         case   CLNP_PDU_MD:
         case   CLNP_PDU_ERQ: