]> The Tcpdump Group git mirrors - tcpdump/commitdiff
OpenFlow 1.0: Lose 4 more ND_TCHECK_LEN() calls.
authorDenis Ovsienko <[email protected]>
Sat, 19 Sep 2020 01:24:12 +0000 (02:24 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 19 Sep 2020 01:34:54 +0000 (02:34 +0100)
ND_TCHECK_LEN() just before an unconditional GET_ETHERADDR_STRING() is
excess. ND_TCHECK_LEN() just before a conditional GET_ETHERADDR_STRING()
can be removed where there is a subsequent unconditional GET_ call (this
is not specific to GET_ETHERADDR_STRING(), for example, unconditional
fetch of "dl_type" makes sure that it is safe to have the fetch of
"dl_vlan_pcp" conditional).

print-openflow-1.0.c

index 1888e24fc50a2a7c7827c762387187e6d33f703b..409b59e21fe842fd490a8e6b5a9d1958de69db38 100644 (file)
@@ -1137,7 +1137,6 @@ of10_phy_ports_print(netdissect_options *ndo,
                         tok2str(ofpp_str, "%u", GET_BE_U_2(cp)));
                cp += 2;
                /* hw_addr */
-               ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
                ND_PRINT(", hw_addr %s", GET_ETHERADDR_STRING(cp));
                cp += MAC_ADDR_LEN;
                /* name */
@@ -1330,12 +1329,10 @@ of10_match_print(netdissect_options *ndo,
                         tok2str(ofpp_str, "%u", GET_BE_U_2(cp)));
        cp += 2;
        /* dl_src */
-       ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
        if (! (wildcards & OFPFW_DL_SRC))
                ND_PRINT("%smatch dl_src %s", pfx, GET_ETHERADDR_STRING(cp));
        cp += MAC_ADDR_LEN;
        /* dl_dst */
-       ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
        if (! (wildcards & OFPFW_DL_DST))
                ND_PRINT("%smatch dl_dst %s", pfx, GET_ETHERADDR_STRING(cp));
        cp += MAC_ADDR_LEN;
@@ -1494,7 +1491,6 @@ of10_actions_print(netdissect_options *ndo,
                case OFPAT_SET_DL_SRC:
                case OFPAT_SET_DL_DST:
                        /* dl_addr */
-                       ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
                        ND_PRINT(", dl_addr %s", GET_ETHERADDR_STRING(cp));
                        cp += MAC_ADDR_LEN;
                        /* pad */