]> The Tcpdump Group git mirrors - tcpdump/commitdiff
The payload of an SCTP DATA chunk is *not* necessarily ASCII text, so it
authorguy <guy>
Wed, 12 Dec 2001 07:16:40 +0000 (07:16 +0000)
committerguy <guy>
Wed, 12 Dec 2001 07:16:40 +0000 (07:16 +0000)
shouldn't be printed by directly sending it to the standard output;
print it with "default_print()" if neither the "-x" nor the "-q" flag
were set.

print-sctp.c

index 2d1987b2555ef4342456c6fe7a473ab8cff431b6..2ee6b25d7317ad2a01f473eea4f0ae4ccbfc0cf1 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.6 2001-12-11 09:41:54 guy Exp $ (NETLAB/PEL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.7 2001-12-12 07:16:40 guy Exp $ (NETLAB/PEL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -207,14 +207,16 @@ void sctp_print(const u_char *bp,        /* beginning of sctp packet */
              {                    /* at the command line */
                char *payloadPtr;
                
              {                    /* at the command line */
                char *payloadPtr;
                
-               printf("[Payload: {");
+               printf("[Payload");
 
 
-               payloadPtr = (char *) (++dataHdrPtr);
-               fwrite(payloadPtr,
-                     htons(chunkDescPtr->chunkLength)-1 -
-                     sizeof(struct sctpDataPart)-sizeof(struct sctpChunkDesc),
-                     1, stdout);
-               printf("}] ");
+               if (!xflag && !qflag) {
+                       payloadPtr = (char *) (++dataHdrPtr);
+                       printf(":");
+                       default_print(payloadPtr,
+                             htons(chunkDescPtr->chunkLength)-1 -
+                             sizeof(struct sctpDataPart)-sizeof(struct sctpChunkDesc));
+               } else
+                       printf("]");
              }
            break;
          }
              }
            break;
          }