]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-tcp.c
OpenFlow: Have a function for each message type.
[tcpdump] / print-tcp.c
index 79dc6c619a67c67dbe6e205ddab69f0ff5b1eccd..a1aae18a8f23b1ab615c14099bfb2a577f2dfd6e 100644 (file)
@@ -184,12 +184,12 @@ tcp_print(netdissect_options *ndo,
         if (!ND_TTEST_2(tp->th_dport)) {
                 if (ip6) {
                         ND_PRINT("%s > %s:",
-                                 ip6addr_string(ndo, ip6->ip6_src),
-                                 ip6addr_string(ndo, ip6->ip6_dst));
+                                 GET_IP6ADDR_STRING(ip6->ip6_src),
+                                 GET_IP6ADDR_STRING(ip6->ip6_dst));
                 } else {
                         ND_PRINT("%s > %s:",
-                                 ipaddr_string(ndo, ip->ip_src),
-                                 ipaddr_string(ndo, ip->ip_dst));
+                                 GET_IPADDR_STRING(ip->ip_src),
+                                 GET_IPADDR_STRING(ip->ip_dst));
                 }
                 nd_print_trunc(ndo);
                 return;
@@ -201,9 +201,9 @@ tcp_print(netdissect_options *ndo,
         if (ip6) {
                 if (GET_U_1(ip6->ip6_nxt) == IPPROTO_TCP) {
                         ND_PRINT("%s.%s > %s.%s: ",
-                                 ip6addr_string(ndo, ip6->ip6_src),
+                                 GET_IP6ADDR_STRING(ip6->ip6_src),
                                  tcpport_string(ndo, sport),
-                                 ip6addr_string(ndo, ip6->ip6_dst),
+                                 GET_IP6ADDR_STRING(ip6->ip6_dst),
                                  tcpport_string(ndo, dport));
                 } else {
                         ND_PRINT("%s > %s: ",
@@ -212,9 +212,9 @@ tcp_print(netdissect_options *ndo,
         } else {
                 if (GET_U_1(ip->ip_p) == IPPROTO_TCP) {
                         ND_PRINT("%s.%s > %s.%s: ",
-                                 ipaddr_string(ndo, ip->ip_src),
+                                 GET_IPADDR_STRING(ip->ip_src),
                                  tcpport_string(ndo, sport),
-                                 ipaddr_string(ndo, ip->ip_dst),
+                                 GET_IPADDR_STRING(ip->ip_dst),
                                  tcpport_string(ndo, dport));
                 } else {
                         ND_PRINT("%s > %s: ",
@@ -298,7 +298,7 @@ tcp_print(netdissect_options *ndo,
                                         if (th->nxt == NULL)
                                                 (*ndo->ndo_error)(ndo,
                                                         S_ERR_ND_MEM_ALLOC,
-                                                        "tcp_print: calloc");
+                                                        "%s: calloc", __func__);
                                 }
                                 th->addr = tha;
                                 if (rev)
@@ -356,7 +356,7 @@ tcp_print(netdissect_options *ndo,
                                         if (th->nxt == NULL)
                                                 (*ndo->ndo_error)(ndo,
                                                         S_ERR_ND_MEM_ALLOC,
-                                                        "tcp_print: calloc");
+                                                        "%s: calloc", __func__);
                                 }
                                 th->addr = tha;
                                 if (rev)
@@ -446,13 +446,11 @@ tcp_print(netdissect_options *ndo,
                 while (hlen > 0) {
                         if (ch != '\0')
                                 ND_PRINT("%c", ch);
-                        ND_TCHECK_1(cp);
                         opt = GET_U_1(cp);
                         cp++;
                         if (ZEROLENOPT(opt))
                                 len = 1;
                         else {
-                                ND_TCHECK_1(cp);
                                 len = GET_U_1(cp);
                                 cp++;  /* total including type, len */
                                 if (len < 2 || len > hlen)