]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-dccp.c
DNS: Sync types with IANA
[tcpdump] / print-dccp.c
index b28db0aebab9a829b1f5ebbed3d3ac9c494aa314..39234575379889af3a6a46d688967f868ba10381 100644 (file)
@@ -17,9 +17,6 @@
 
 #include "netdissect-stdinc.h"
 
-#include <stdio.h>
-#include <string.h>
-
 #include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
@@ -192,7 +189,7 @@ static const char *dccp_feature_nums[] = {
 
 static u_int
 dccp_csum_coverage(netdissect_options *ndo,
-                  const struct dccp_hdrdh, u_int len)
+                  const struct dccp_hdr *dh, u_int len)
 {
        u_int cov;
 
@@ -252,16 +249,12 @@ static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp)
        uint64_t ackno;
 
        if (DCCPH_X(dh) != 0) {
-               ND_TCHECK_8(ackp);
                ackno = GET_BE_U_6(ackp + 2);
        } else {
-               ND_TCHECK_4(ackp);
                ackno = GET_BE_U_3(ackp + 1);
        }
 
        ND_PRINT("(ack=%" PRIu64 ") ", ackno);
-trunc:
-       return;
 }
 
 static u_int dccp_print_option(netdissect_options *, const u_char *, u_int);
@@ -299,8 +292,8 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
        if (cp > ndo->ndo_snapend)
                goto trunc;
        if (len < sizeof(struct dccp_hdr)) {
-               ND_PRINT("truncated-dccp - %u bytes missing!",
-                        (u_int)sizeof(struct dccp_hdr) - len);
+               ND_PRINT("truncated-dccp - %zu bytes missing!",
+                        sizeof(struct dccp_hdr) - len);
                return;
        }
 
@@ -319,12 +312,12 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
 
        if (ip6) {
                ND_PRINT("%s.%u > %s.%u: ",
-                         ip6addr_string(ndo, ip6->ip6_src), sport,
-                         ip6addr_string(ndo, ip6->ip6_dst), dport);
+                         GET_IP6ADDR_STRING(ip6->ip6_src), sport,
+                         GET_IP6ADDR_STRING(ip6->ip6_dst), dport);
        } else {
                ND_PRINT("%s.%u > %s.%u: ",
-                         ipaddr_string(ndo, ip->ip_src), sport,
-                         ipaddr_string(ndo, ip->ip_dst), dport);
+                         GET_IPADDR_STRING(ip->ip_src), sport,
+                         GET_IPADDR_STRING(ip->ip_dst), dport);
        }
 
        nd_print_protocol_caps(ndo);
@@ -340,7 +333,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
 
        /* other variables in generic header */
        if (ndo->ndo_vflag) {
-               ND_PRINT(" (CCVal %u, CsCov %u", DCCPH_CCVAL(dh), DCCPH_CSCOV(dh));
+               ND_PRINT(" (CCVal %u, CsCov %u", DCCPH_CCVAL(dh), DCCPH_CSCOV(dh));
        }
 
        /* checksum calculation */
@@ -348,7 +341,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
                uint16_t sum = 0, dccp_sum;
 
                dccp_sum = GET_BE_U_2(dh->dccph_checksum);
-               ND_PRINT("cksum 0x%04x ", dccp_sum);
+               ND_PRINT("cksum 0x%04x ", dccp_sum);
                if (IP_V(ip) == 4)
                        sum = dccp_cksum(ndo, ip, dh, len);
                else if (IP_V(ip) == 6)
@@ -514,7 +507,6 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
        return;
 trunc:
        nd_print_trunc(ndo);
-       return;
 }
 
 static const struct tok dccp_option_values[] = {
@@ -542,10 +534,7 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen)
 {
        uint8_t optlen, i;
 
-       ND_TCHECK_1(option);
-
        if (GET_U_1(option) >= 32) {
-               ND_TCHECK_1(option + 1);
                optlen = GET_U_1(option + 1);
                if (optlen < 2) {
                        if (GET_U_1(option) >= 128)