]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix space printing with istr[]
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 18 May 2018 07:32:28 +0000 (09:32 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 18 May 2018 08:03:59 +0000 (10:03 +0200)
Because istr[] is assign to " (invalid)", avoid adding a space before it.

Moreover:
Avoid also useless '\n'

print-hncp.c
print-lisp.c
print-ntp.c
tests/hncp_dhcpv6data-oobr.out
tests/lisp_eid_notify.out

index 7a3a6f72a8d859bfeb9fccb7c085eb12f6b4f066..caab53ce813a57ef6b69f0784b4fbbd2bd7d282a 100644 (file)
@@ -345,7 +345,7 @@ dhcpv6_print(netdissect_options *ndo,
             case DH6OPT_DNS_SERVERS:
             case DH6OPT_SNTP_SERVERS: {
                 if (optlen % 16 != 0) {
-                    ND_PRINT(" %s", istr);
+                    ND_PRINT("%s", istr);
                     return -1;
                 }
                 for (t = 0; t < optlen; t += 16)
@@ -479,14 +479,14 @@ hncp_print_rec(netdissect_options *ndo,
 
         case DNCP_REQUEST_NETWORK_STATE: {
             if (bodylen != 0)
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
         }
             break;
 
         case DNCP_REQUEST_NODE_STATE: {
             const char *node_identifier;
             if (bodylen != 4) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             node_identifier = format_nid(value);
@@ -498,7 +498,7 @@ hncp_print_rec(netdissect_options *ndo,
             const char *node_identifier;
             uint32_t endpoint_identifier;
             if (bodylen != 8) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             node_identifier = format_nid(value);
@@ -513,7 +513,7 @@ hncp_print_rec(netdissect_options *ndo,
         case DNCP_NETWORK_STATE: {
             uint64_t hash;
             if (bodylen != 8) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             hash = EXTRACT_BE_U_8(value);
@@ -526,7 +526,7 @@ hncp_print_rec(netdissect_options *ndo,
             uint32_t sequence_number;
             uint64_t hash;
             if (bodylen < 20) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             node_identifier = format_nid(value);
@@ -547,7 +547,7 @@ hncp_print_rec(netdissect_options *ndo,
             const char *peer_node_identifier;
             uint32_t peer_endpoint_identifier, endpoint_identifier;
             if (bodylen != 12) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             peer_node_identifier = format_nid(value);
@@ -565,7 +565,7 @@ hncp_print_rec(netdissect_options *ndo,
             uint32_t endpoint_identifier;
             const char *interval;
             if (bodylen < 8) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             endpoint_identifier = EXTRACT_BE_U_4(value);
@@ -579,7 +579,7 @@ hncp_print_rec(netdissect_options *ndo,
 
         case DNCP_TRUST_VERDICT: {
             if (bodylen <= 36) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             ND_PRINT(" Verdict: %u Fingerprint: %s Common Name: ",
@@ -593,7 +593,7 @@ hncp_print_rec(netdissect_options *ndo,
             uint16_t capabilities;
             uint8_t M, P, H, L;
             if (bodylen < 5) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             capabilities = EXTRACT_BE_U_2(value + 2);
@@ -617,7 +617,7 @@ hncp_print_rec(netdissect_options *ndo,
         case HNCP_DELEGATED_PREFIX: {
             int l;
             if (bodylen < 9 || bodylen < 9 + (EXTRACT_U_1(value + 8) + 7) / 8) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             ND_PRINT(" VLSO: %s PLSO: %s Prefix: ",
@@ -639,7 +639,7 @@ hncp_print_rec(netdissect_options *ndo,
                  * IPv6", or -3, meaning "the prefix runs past
                  * the end of the TLV".
                  */
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             l += 8 + (-l & 3);
@@ -653,14 +653,14 @@ hncp_print_rec(netdissect_options *ndo,
             uint8_t policy;
             int l;
             if (bodylen < 1) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             policy = EXTRACT_U_1(value);
             ND_PRINT(" type: ");
             if (policy == 0) {
                 if (bodylen != 1) {
-                    ND_PRINT(" %s", istr);
+                    ND_PRINT("%s", istr);
                     break;
                 }
                 ND_PRINT("Internet connectivity");
@@ -681,7 +681,7 @@ hncp_print_rec(netdissect_options *ndo,
                      * IPv6", or -3, meaning "the prefix runs past
                      * the end of the TLV".
                      */
-                    ND_PRINT(" %s", istr);
+                    ND_PRINT("%s", istr);
                     break;
                 }
             } else if (policy == 129) {
@@ -692,7 +692,7 @@ hncp_print_rec(netdissect_options *ndo,
                 (void)nd_printzp(ndo, value + 1, bodylen - 1, NULL);
             } else if (policy == 131) {
                 if (bodylen != 1) {
-                    ND_PRINT(" %s", istr);
+                    ND_PRINT("%s", istr);
                     break;
                 }
                 ND_PRINT("Restrictive assignment");
@@ -704,7 +704,7 @@ hncp_print_rec(netdissect_options *ndo,
 
         case HNCP_DHCPV4_DATA: {
             if (bodylen == 0) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             if (dhcpv4_print(ndo, value, bodylen, indent+1) != 0)
@@ -714,11 +714,11 @@ hncp_print_rec(netdissect_options *ndo,
 
         case HNCP_DHCPV6_DATA: {
             if (bodylen == 0) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             if (dhcpv6_print(ndo, value, bodylen, indent+1) != 0) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
         }
@@ -728,7 +728,7 @@ hncp_print_rec(netdissect_options *ndo,
             uint8_t prty;
             int l;
             if (bodylen < 6 || bodylen < 6 + (EXTRACT_U_1(value + 5) + 7) / 8) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             prty = EXTRACT_U_1(value + 4) & 0xf;
@@ -738,7 +738,7 @@ hncp_print_rec(netdissect_options *ndo,
             );
             ND_PRINT(" Prefix: ");
             if ((l = print_prefix(ndo, value + 5, bodylen - 5)) < 0) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             l += 5;
@@ -753,7 +753,7 @@ hncp_print_rec(netdissect_options *ndo,
             uint32_t endpoint_identifier;
             const char *ip_address;
             if (bodylen < 20) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             endpoint_identifier = EXTRACT_BE_U_4(value);
@@ -771,7 +771,7 @@ hncp_print_rec(netdissect_options *ndo,
             const char *ip_address;
             int len;
             if (bodylen < 17) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             ip_address = format_ip6addr(ndo, value);
@@ -783,7 +783,7 @@ hncp_print_rec(netdissect_options *ndo,
             );
             len = print_dns_label(ndo, value+17, bodylen-17, 1);
             if (len < 0) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             len += 17;
@@ -795,7 +795,7 @@ hncp_print_rec(netdissect_options *ndo,
 
         case HNCP_DOMAIN_NAME: {
             if (bodylen == 0) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             ND_PRINT(" Domain: ");
@@ -806,12 +806,12 @@ hncp_print_rec(netdissect_options *ndo,
         case HNCP_NODE_NAME: {
             u_int l;
             if (bodylen < 17) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             l = EXTRACT_U_1(value + 16);
             if (bodylen < 17 + l) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             ND_PRINT(" IP-Address: %s Name: ",
@@ -833,7 +833,7 @@ hncp_print_rec(netdissect_options *ndo,
 
         case HNCP_MANAGED_PSK: {
             if (bodylen < 32) {
-                ND_PRINT(" %s", istr);
+                ND_PRINT("%s", istr);
                 break;
             }
             ND_PRINT(" PSK: %s", format_256(value));
index d5ffe4264d8cc272eab4b1a8a469c4dac4059d5e..0d9f67d2c57db123059253ba898c5dd8bc536ae8 100644 (file)
@@ -389,7 +389,7 @@ trunc:
        nd_print_trunc(ndo);
        return;
 invalid:
-       ND_PRINT("\n   %s", istr);
+       ND_PRINT("%s", istr);
        return;
 }
 
index 9dc47190fec82024aaad676256a2394eee1e790e..65d41fb76045b98c101bc64215df3e68f920ff2f 100644 (file)
@@ -371,7 +371,7 @@ ntp_time_print(netdissect_options *ndo,
        return;
 
 invalid:
-       ND_PRINT(" %s", istr);
+       ND_PRINT("%s", istr);
        ND_TCHECK_LEN(bp, length);
        return;
 
@@ -431,7 +431,7 @@ ntp_control_print(netdissect_options *ndo,
        return;
 
 invalid:
-       ND_PRINT(" %s", istr);
+       ND_PRINT("%s", istr);
        ND_TCHECK_LEN(cd, length);
        return;
 
index b69225279f0cfea398cd49c9ce593ceb2b6e7141..a0b88f76c417138bbf2c7be84eed410f22923e54 100644 (file)
@@ -3,5 +3,5 @@ IP6 (flowlabel 0x01cc3, hlim 234, next-header UDP (17) payload length: 11025) 40
        DHCPv6-Data (25)
                Unknown (4)
                Unknown (4)
-               SNTP-servers (61956)  (invalid)
+               SNTP-servers (61956) (invalid)
         [|hncp]
index 43c52468a6e1567a518e2f96aef598bcdcaba92d..d5c63043264377ab6b97bb5171041ebc8aa62c92 100644 (file)
@@ -44,8 +44,7 @@ IP (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto UDP (17), length 160)
           Priority/Weight 1/100, Multicast Priority/Weight 1/100, flags [none],
       Record TTL 1440, Authoritative, No-Action, Map Version: 0, EID 10.30.1.80/32, 1 locator(s)
         LOC 20.20.8.239
-          Priority/Weight 1/100, Multicast Priority/Weight 1/100, flags [none],
-    (invalid)
+          Priority/Weight 1/100, Multicast Priority/Weight 1/100, flags [none], (invalid)
 IP (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto UDP (17), length 156)
     192.168.0.105.4342 > 127.0.0.1.4342: LISP-Map-Notify, flags [none],
     2 record(s), Authentication SHA1,