]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-openflow-1.3.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-openflow-1.3.c
index 79de7d7b9999205bf3d9e86bc7fd584ed16e4eb5..11817d459da2ceddc19cddca37ab2af5ce469d8c 100644 (file)
@@ -33,9 +33,7 @@
 
 /* \summary: OpenFlow protocol version 1.3 printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -655,13 +653,13 @@ of13_port_print(netdissect_options *ndo,
        /* pad */
        cp += 4;
        /* hw_addr */
-       ND_PRINT(", hw_addr %s", GET_ETHERADDR_STRING(cp));
-       cp += MAC_ADDR_LEN;
+       ND_PRINT(", hw_addr %s", GET_MAC48_STRING(cp));
+       cp += MAC48_LEN;
        /* pad2 */
        cp += 2;
        /* name */
        ND_PRINT(", name '");
-       (void)nd_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN);
+       nd_printjnp(ndo, cp, OFP_MAX_PORT_NAME_LEN);
        ND_PRINT("'");
        cp += OFP_MAX_PORT_NAME_LEN;
 
@@ -676,7 +674,7 @@ of13_port_print(netdissect_options *ndo,
        cp += 4;
        /* state */
        ND_PRINT("\n\t   state 0x%08x", GET_BE_U_4(cp));
-       of_bitmap_print(ndo, ofpps_bm, GET_BE_U_4(cp), OFPPS_U);;
+       of_bitmap_print(ndo, ofpps_bm, GET_BE_U_4(cp), OFPPS_U);
        cp += 4;
        /* curr */
        ND_PRINT("\n\t   curr 0x%08x", GET_BE_U_4(cp));
@@ -812,8 +810,8 @@ of13_port_mod_print(netdissect_options *ndo,
        /* pad */
        cp += 4;
        /* hw_addr */
-       ND_PRINT(", hw_addr %s", GET_ETHERADDR_STRING(cp));
-       cp += MAC_ADDR_LEN;
+       ND_PRINT(", hw_addr %s", GET_MAC48_STRING(cp));
+       cp += MAC48_LEN;
        /* pad2 */
        cp += 2;
        /* config */
@@ -856,21 +854,20 @@ of13_hello_elements_print(netdissect_options *ndo,
        while (len) {
                uint16_t type, bmlen;
 
-               if (len < OF_HELLO_ELEM_MINSIZE)
-                       goto invalid;
+               ND_PRINT("\n\t");
+               ND_ICHECKMSG_U("remaining length", len, <, OF_HELLO_ELEM_MINSIZE);
                /* type */
                type = GET_BE_U_2(cp);
                OF_FWD(2);
-               ND_PRINT("\n\t type %s",
+               ND_PRINT(" type %s",
                         tok2str(ofphet_str, "unknown (0x%04x)", type));
                /* length */
                bmlen = GET_BE_U_2(cp);
                OF_FWD(2);
                ND_PRINT(", length %u", bmlen);
                /* cp is OF_HELLO_ELEM_MINSIZE bytes in */
-               if (bmlen < OF_HELLO_ELEM_MINSIZE ||
-                   bmlen > OF_HELLO_ELEM_MINSIZE + len)
-                       goto invalid;
+               ND_ICHECKMSG_U("bitmap length", bmlen, <, OF_HELLO_ELEM_MINSIZE);
+               ND_ICHECKMSG_U("bitmap length", bmlen, >, OF_HELLO_ELEM_MINSIZE + len);
                switch (type) {
                case OFPHET_VERSIONBITMAP:
                        /*