diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2017-03-28 11:15:13 +0200 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-03-28 10:32:53 +0000 |
commit | bd486eb9b16640af51fb58995ff59c1434737dc2 (patch) | |
tree | 2b3997fc4f87af777bf9511cbce30fa3080a36c4 | |
parent | ed3b5e5764ce368edc6ca10b81411a7b01b29444 (diff) | |
download | wireshark-bd486eb9b16640af51fb58995ff59c1434737dc2.tar.gz |
text2pcap: define max packet size to WTAP_MAX_PACKET_SIZE
Change-Id: I73ab87032e4a0c0259227622412be36aaf66a9d6
Reviewed-on: https://code.wireshark.org/review/20758
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | doc/text2pcap.pod | 2 | ||||
-rw-r--r-- | text2pcap.c | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/doc/text2pcap.pod b/doc/text2pcap.pod index 59e24b614a..d878bf14aa 100644 --- a/doc/text2pcap.pod +++ b/doc/text2pcap.pod @@ -152,7 +152,7 @@ packets encapsulated BSD-style. =item -m E<lt>max-packetE<gt> -Set the maximum packet length, default is 65535. +Set the maximum packet length, default is 262144. Useful for testing various packet boundaries when only an application level datastream is available. Example: diff --git a/text2pcap.c b/text2pcap.c index dd58e722db..848c213c79 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -141,6 +141,8 @@ #include "writecap/pcapio.h" #include "text2pcap.h" +#include "wiretap/wtap.h" + #ifdef _WIN32 #include <wsutil/unicode-utils.h> #endif /* _WIN32 */ @@ -207,12 +209,11 @@ static guint32 direction = 0; /*--- Local date -----------------------------------------------------------------*/ /* This is where we store the packet currently being built */ -#define MAX_PACKET 65535 -static guint8 packet_buf[MAX_PACKET]; +static guint8 packet_buf[WTAP_MAX_PACKET_SIZE]; static guint32 header_length; static guint32 ip_offset; static guint32 curr_offset; -static guint32 max_offset = MAX_PACKET; +static guint32 max_offset = WTAP_MAX_PACKET_SIZE; static guint32 packet_start = 0; static int start_new_packet(gboolean); @@ -459,7 +460,7 @@ write_bytes (const char bytes[], guint32 nbytes) { guint32 i; - if (curr_offset + nbytes < MAX_PACKET) { + if (curr_offset + nbytes < WTAP_MAX_PACKET_SIZE) { for (i = 0; i < nbytes; i++) { packet_buf[curr_offset] = bytes[i]; curr_offset++; @@ -1450,7 +1451,7 @@ print_usage (FILE *output) " -q generate no output at all (automatically disables -d).\n" " -n use PCAP-NG instead of PCAP as output format.\n" "", - MAX_PACKET); + WTAP_MAX_PACKET_SIZE); } /*---------------------------------------------------------------------- |