]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove some now redundant ND_TCHECK_16() calls
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 5 Sep 2020 19:40:32 +0000 (21:40 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Sep 2020 16:36:18 +0000 (18:36 +0200)
ND_TCHECK_16(e).

They are redundant because they are followed by a GET_IP6ADDR_STRING(e)
call, same e, which do the bounds check.

print-ahcp.c
print-dhcp6.c
print-icmp6.c
print-lisp.c
print-mobility.c
print-ospf6.c
print-radius.c
print-rt6.c

index ffcbd2674282f96970d27dc9af5529c4e2b1b608..2a1eb1ab9ec719a62496c7dfce06a3b4aa0637b1 100644 (file)
@@ -148,7 +148,6 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha
        while (cp < ep) {
                if (cp + 16 > ep)
                        goto invalid;
-               ND_TCHECK_16(cp);
                ND_PRINT("%s%s", sep, GET_IP6ADDR_STRING(cp));
                cp += 16;
                sep = ", ";
index 0b40af81f93174c2df4d9a2d39b1ec2870429cd0..8b19d546207f8a47052b31c2cb79f69920932a1a 100644 (file)
@@ -826,8 +826,6 @@ dhcp6_print(netdissect_options *ndo,
                extp = (const u_char *)(dh6 + 1);
                dhcp6opt_print(ndo, extp, ep);
        } else {                /* relay messages */
-               ND_TCHECK_16(dh6relay->dh6relay_peeraddr);
-
                ND_PRINT("linkaddr=%s", GET_IP6ADDR_STRING(dh6relay->dh6relay_linkaddr));
 
                ND_PRINT(" peeraddr=%s", GET_IP6ADDR_STRING(dh6relay->dh6relay_peeraddr));
index f8bedc1ab825df9f6ccafc443593dc70a804fbe3..8589730376f513ff3b85fa020887a14975ef2835 100644 (file)
@@ -1079,7 +1079,6 @@ icmp6_print(netdissect_options *ndo,
 
        switch (icmp6_type) {
        case ICMP6_DST_UNREACH:
-               ND_TCHECK_16(oip->ip6_dst);
                 ND_PRINT(", %s", tok2str(icmp6_dst_unreach_code_values,"unknown unreach code (%u)",icmp6_code));
                switch (icmp6_code) {
 
@@ -1129,7 +1128,6 @@ icmp6_print(netdissect_options *ndo,
                ND_PRINT(", mtu %u", GET_BE_U_4(dp->icmp6_mtu));
                break;
        case ICMP6_TIME_EXCEEDED:
-               ND_TCHECK_16(oip->ip6_dst);
                switch (icmp6_code) {
                case ICMP6_TIME_EXCEED_TRANSIT:
                        ND_PRINT(" for %s",
@@ -1222,7 +1220,6 @@ icmp6_print(netdissect_options *ndo,
            {
                const struct nd_neighbor_solicit *p;
                p = (const struct nd_neighbor_solicit *)dp;
-               ND_TCHECK_16(p->nd_ns_target);
                ND_PRINT(", who has %s", GET_IP6ADDR_STRING(p->nd_ns_target));
                if (ndo->ndo_vflag) {
 #define NDSOLLEN 24
@@ -1237,7 +1234,6 @@ icmp6_print(netdissect_options *ndo,
                const struct nd_neighbor_advert *p;
 
                p = (const struct nd_neighbor_advert *)dp;
-               ND_TCHECK_16(p->nd_na_target);
                ND_PRINT(", tgt is %s",
                           GET_IP6ADDR_STRING(p->nd_na_target));
                if (ndo->ndo_vflag) {
@@ -1258,9 +1254,7 @@ icmp6_print(netdissect_options *ndo,
                const struct nd_redirect *p;
 
                p = (const struct nd_redirect *)dp;
-               ND_TCHECK_16(p->nd_rd_dst);
                ND_PRINT(", %s", GET_IP6ADDR_STRING(p->nd_rd_dst));
-               ND_TCHECK_16(p->nd_rd_target);
                ND_PRINT(" to %s", GET_IP6ADDR_STRING(p->nd_rd_target));
 #define REDIRECTLEN 40
                if (ndo->ndo_vflag) {
@@ -1298,7 +1292,6 @@ icmp6_print(netdissect_options *ndo,
                        cp = (const u_char *)dp + length;
                        p = (const u_char *)(dp + 1);
                        while (p < cp) {
-                               ND_TCHECK_16(p);
                                ND_PRINT(", %s", GET_IP6ADDR_STRING(p));
                                p += 16;
                        }
@@ -1466,7 +1459,6 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        break;
                case ND_OPT_PREFIX_INFORMATION:
                        opp = (const struct nd_opt_prefix_info *)op;
-                       ND_TCHECK_16(opp->nd_opt_pi_prefix);
                         ND_PRINT("%s/%u%s, Flags [%s], valid time %s",
                                   GET_IP6ADDR_STRING(opp->nd_opt_pi_prefix),
                                   GET_U_1(opp->nd_opt_pi_prefix_len),
@@ -1492,7 +1484,6 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        ND_PRINT(" lifetime %us,",
                                   GET_BE_U_4(oprd->nd_opt_rdnss_lifetime));
                        for (i = 0; i < l; i++) {
-                               ND_TCHECK_16(oprd->nd_opt_rdnss_addr[i]);
                                ND_PRINT(" addr: %s",
                                           GET_IP6ADDR_STRING(oprd->nd_opt_rdnss_addr[i]));
                        }
index ac95ba69a8ade067c2c2275f1cd067763eaccdcc..27cafb3046445567aac7e822c742be5f722be717 100644 (file)
@@ -314,7 +314,6 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
                        packet_offset += 4;
                        break;
                case IPv6_AFI:
-                       ND_TCHECK_16(packet_iterator + packet_offset);
                        ND_PRINT(" EID %s/%u,",
                                GET_IP6ADDR_STRING(packet_iterator + packet_offset),
                                mask_len);
index a79c7c2dfe5b24ac97be01f797d9a348bf768813..600f6532a4449a7c3ed8958e1930320736bf4c9f 100644 (file)
@@ -155,7 +155,6 @@ mobility_opt_print(netdissect_options *ndo,
                                ND_PRINT("(altcoa: trunc)");
                                goto trunc;
                        }
-                       ND_TCHECK_16(bp + i + 2);
                        ND_PRINT("(alt-CoA: %s)", GET_IP6ADDR_STRING(bp + i + 2));
                        break;
                case IP6MOPT_NONCEID:
@@ -308,7 +307,6 @@ mobility_print(netdissect_options *ndo,
                ND_PRINT(" status=%u", GET_U_1(mh->ip6m_data8[0]));
                /* Reserved */
                hlen = IP6M_MINLEN;
-               ND_TCHECK_16(bp + hlen);
                ND_PRINT(" homeaddr %s", GET_IP6ADDR_STRING(bp + hlen));
                hlen += 16;
                break;
index b4cf7378363955a4c7e2b101427a6888793d9a4b..890ebf795f4f8ae2897ea9363c35ac04fe6cc9e2 100644 (file)
@@ -608,7 +608,6 @@ ospf6_print_lsa(netdissect_options *ndo,
                        if (lsa_length < sizeof (nd_ipv6))
                                return (1);
                        lsa_length -= sizeof (nd_ipv6);
-                       ND_TCHECK_16(tptr);
                        ND_PRINT(" forward %s",
                                 GET_IP6ADDR_STRING(tptr));
                        tptr += sizeof(nd_ipv6);
index 5c27710a2836a6a272f04c78dbfe322428901b2c..4c18651067d214093e6c27c4912c5fc720eb89c9 100644 (file)
@@ -1074,14 +1074,7 @@ print_attr_address6(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_16(data);
-
    ND_PRINT("%s", GET_IP6ADDR_STRING(data));
-
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 static void
index cd875db7006494eef607556326f8730683c2a467..980d675faa308dfbb14d243fdf44818fc1fe4ba8 100644 (file)
@@ -70,7 +70,6 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_)
                len >>= 1;
                p = (const u_char *) dp0->ip6r0_addr;
                for (i = 0; i < len; i++) {
-                       ND_TCHECK_16(p);
                        ND_PRINT(", [%u]%s", i, GET_IP6ADDR_STRING(p));
                        p += 16;
                }
@@ -94,7 +93,6 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_)
                len >>= 1;
                p  = (const u_char *) srh->srh_segments;
                for (i = 0; i < len; i++) {
-                       ND_TCHECK_16(p);
                        ND_PRINT(", [%u]%s", i, GET_IP6ADDR_STRING(p));
                        p += 16;
                }