]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more ND_TCHECK_n()/ND_TTEST_n() macros
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 12 Jan 2018 21:00:45 +0000 (22:00 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 12 Jan 2018 21:00:45 +0000 (22:00 +0100)
print-timed.c
print-udp.c

index 487b4e7de439268b01381b2336247f0ac6e4cb9b..519873530099f70c3c9c795490022dc0ec180bd5 100644 (file)
@@ -98,22 +98,22 @@ timed_print(netdissect_options *ndo,
        uint8_t tsp_type;
        int sec, usec;
 
-       ND_TCHECK(tsp->tsp_type);
+       ND_TCHECK_1(tsp->tsp_type);
        tsp_type = EXTRACT_U_1(tsp->tsp_type);
        if (tsp_type < TSPTYPENUMBER)
                ND_PRINT("TSP_%s", tsptype[tsp_type]);
        else
                ND_PRINT("(tsp_type %#x)", tsp_type);
 
-       ND_TCHECK(tsp->tsp_vers);
+       ND_TCHECK_1(tsp->tsp_vers);
        ND_PRINT(" vers %u", EXTRACT_U_1(tsp->tsp_vers));
 
-       ND_TCHECK(tsp->tsp_seq);
+       ND_TCHECK_2(tsp->tsp_seq);
        ND_PRINT(" seq %u", EXTRACT_BE_U_2(tsp->tsp_seq));
 
        switch (tsp_type) {
        case TSP_LOOP:
-               ND_TCHECK(tsp->tsp_hopcnt);
+               ND_TCHECK_1(tsp->tsp_hopcnt);
                ND_PRINT(" hopcnt %u", EXTRACT_U_1(tsp->tsp_hopcnt));
                break;
        case TSP_SETTIME:
index ede213fc374aa64c273391cc8f1c49c9703157c5..8aa135b4a16da91e22ecf0664662d66dde5b847a 100644 (file)
@@ -398,7 +398,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                ip6 = (const struct ip6_hdr *)bp2;
        else
                ip6 = NULL;
-       if (!ND_TTEST(up->uh_dport)) {
+       if (!ND_TTEST_2(up->uh_dport)) {
                udpipaddr_print(ndo, ip, -1, -1);
                goto trunc;
        }
@@ -411,7 +411,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                ND_PRINT("truncated-udp %u", length);
                return;
        }
-       if (!ND_TTEST(up->uh_ulen)) {
+       if (!ND_TTEST_2(up->uh_ulen)) {
                udpipaddr_print(ndo, ip, sport, dport);
                goto trunc;
        }
@@ -520,7 +520,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                enum sunrpc_msg_type direction;
 
                rp = (const struct sunrpc_msg *)(up + 1);
-               if (ND_TTEST(rp->rm_direction)) {
+               if (ND_TTEST_4(rp->rm_direction)) {
                        direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(rp->rm_direction);
                        if (dport == NFS_PORT && direction == SUNRPC_CALL) {
                                ND_PRINT("NFS request xid %u ",
@@ -696,9 +696,9 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                        lisp_print(ndo, (const u_char *)(up + 1), length);
                else if (IS_SRC_OR_DST_PORT(VXLAN_GPE_PORT))
                        vxlan_gpe_print(ndo, (const u_char *)(up + 1), length);
-               else if (ND_TTEST(((const struct LAP *)cp)->type) &&
-                   EXTRACT_U_1(((const struct LAP *)cp)->type) == lapDDP &&
-                   (atalk_port(sport) || atalk_port(dport))) {
+               else if (ND_TTEST_1(((const struct LAP *)cp)->type) &&
+                        EXTRACT_U_1(((const struct LAP *)cp)->type) == lapDDP &&
+                        (atalk_port(sport) || atalk_port(dport))) {
                        if (ndo->ndo_vflag)
                                ND_PRINT("kip ");
                        llap_print(ndo, cp, length);