]> The Tcpdump Group git mirrors - tcpdump/commitdiff
TCP: Use GET_IPADDR_STRING()/GET_IP6ADDR_STRING() calls
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 23 Sep 2020 14:28:52 +0000 (16:28 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 23 Sep 2020 15:33:30 +0000 (17:33 +0200)
Replace the calls to ipaddr_string()/ip6addr_string() with calls to
GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds
checking.

print-tcp.c

index 0c712f1fd89ae31a64ad76480bf118c2947271bb..ff5279c3ad84db7f9ebd428e9179ce04c0f9db4c 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: ",