Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit d2616cc

Browse files
committed
spin-pcap-reader: change default capture length to 1232 bytes
Most DNS software will try to keep responses under 1232+1 bytes (see https://dnsflagday.net/2020/). This way we should see most responses. Document that we don't handle fragmented DNS packets properly.
1 parent 9eba84c commit d2616cc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

doc/user/pcap_reader.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@ but of course it can be used on Linux systems as well.
7676
Use `-i` to specify the network interface.
7777

7878
By default,
79-
`spin-pcap-reader` captures and analyzes 1514 bytes for each packet.
80-
If that's not enough (for instance, because you're using VLANs),
79+
`spin-pcap-reader` captures and analyzes 1232 bytes for each packet.
80+
For all packets,
81+
`spin-pcap-reader` just analyzes packet headers,
82+
except for DNS packets.
83+
Most DNS software attempts to send responses that fit in 1232 bytes
84+
([more info](https://dnsflagday.net/2020/)).
85+
This way,
86+
we hope to capture most DNS packets.
87+
This default may be changed by
8188
use the `-s` flag (e.g. `-s 1518`).
82-
`spin-pcap-reader` printing messages like
83-
`spin-pcap-reader: caplen 1514 != len 1518,`
84-
indicates that you need to use this flag.
8589

8690
`spin-pcap-reader` prints almost no messages to the console.
8791
Specifying the `-v` flag enables verbose mode,
@@ -97,4 +101,5 @@ For instance:
97101
through an Internet socket is not protected with TLS yet.
98102
* It would be nice to implement sandboxing for other platforms
99103
besides OpenBSD.
104+
* Fragmented DNS packets are not handled properly.
100105

src/tools/spin-pcap-reader/pcap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ main(int argc, char *argv[])
542542
char *file = NULL;
543543
char *pcap_errbuf;
544544
char *filter = "";
545-
int snaplen = 1514;
545+
int snaplen = 1232;
546546
struct bpf_program fp;
547547

548548
#ifdef __OpenBSD__

0 commit comments

Comments
 (0)