diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-10-20 19:43:39 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-10-20 19:43:39 +0000 |
commit | fc73cf5578f2f8d8cca3b8ffa2a6d5eea412ed69 (patch) | |
tree | 1060ca3c20eed0aa6a76466543abbb7063baaa43 | |
parent | d74b50abd7829b49dbfb32ed8fb11f3bebd1d650 (diff) | |
download | 2012-tzsp-fc73cf5578f2f8d8cca3b8ffa2a6d5eea412ed69.tar.gz 2012-tzsp-fc73cf5578f2f8d8cca3b8ffa2a6d5eea412ed69.tar.bz2 2012-tzsp-fc73cf5578f2f8d8cca3b8ffa2a6d5eea412ed69.zip |
Amélioration de la gestion des min/max de la taille de capture
git-svn-id: file:///var/svn/2012-tzsp/trunk@5 147d2d3d-d0bd-48ea-923a-d90ac20f5906
-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); } |