diff options
-rw-r--r-- | pcap2tzsp.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pcap2tzsp.c b/pcap2tzsp.c index 50b31c4..ec9264a 100644 --- a/pcap2tzsp.c +++ b/pcap2tzsp.c @@ -26,9 +26,15 @@ /* 70 bytes captured packets will to sent in ~128 bytes frames when encapsulated */ #define UDP_SEND_BUFLEN 1500 -#define MAX_TZSP_PAYLOAD (1500-40-16) +/* MAX_TZSP_PAYLOAD is for not trying to send TZSP packets greater than the interface MTU + MAX_TZSP_PAYLOAD = MTU - IP header - UDP header - TZSP header + I am assuming the following : + - Layer 2 overhead is the same for the captured packet and the transmitted packet + - MTU is assumed to be 1500 for now +*/ +#define MAX_TZSP_PAYLOAD (1500-20-8-16) #define MIN_BYTES_TO_CAPTURE 16 -#define MAX_BYTES_TO_CAPTURE (1500-40-16) +#define MAX_BYTES_TO_CAPTURE (1500-20-8-16) /* @@ -197,7 +203,7 @@ void capture_loop(char pcap_filter[]) { snaplen=atoi(opt_snaplen); if ( snaplen < MIN_BYTES_TO_CAPTURE || snaplen > MAX_BYTES_TO_CAPTURE ) { - fprintf(stderr, "snaplen of %i is not in the allowedrange of [%i..%i]", snaplen, MIN_BYTES_TO_CAPTURE, MAX_BYTES_TO_CAPTURE); + fprintf(stderr, "snaplen of %i is not in the allowed range of [%i..%i]\n", snaplen, MIN_BYTES_TO_CAPTURE, MAX_BYTES_TO_CAPTURE); exit(12); } |