|
| 1 | +# Some tricks for debugging cjdns issues using traffic analysis |
| 2 | + |
| 3 | +Traffic analysis on cjdns is stupidly hard because everything is encrypted point to point. |
| 4 | +Basically the only thing you have to go on is the size of packets, recently we fixed a bug |
| 5 | +in the switch pinger which was causing packets to be dropped randomly (most of the time). |
| 6 | + |
| 7 | +In order to detect where the packets were dropping, we used ping with a special size and |
| 8 | +tcpdumped for the related packet. |
| 9 | + |
| 10 | +Switch pings sent over UDP will normally appear as 60 bytes. By adding a few bytes of payload |
| 11 | +data to the ping, one can cause packets to appear at the UDP level which are of a very unlikely |
| 12 | +size. |
| 13 | + |
| 14 | +## Step 1: startup tcpdump |
| 15 | + |
| 16 | + $ sudo tcpdump -n -i eth0 'udp and port 11223' | grep ' 6[0-9]$' |
| 17 | + |
| 18 | +## Step 2: begin sending pings |
| 19 | + |
| 20 | + $ ./contrib/nodejs/tools/ping -s 0000.0000.0000.0aa3 |
| 21 | + |
| 22 | +Observe suddenly 60 byte packets appear: |
| 23 | + |
| 24 | + 18:40:56.292748 IP 123.45.67.8.12345 > 87.65.43.210.11223: UDP, length 60 |
| 25 | + 18:40:56.292748 IP 123.45.67.8.12345 > 87.65.43.210.11223: UDP, length 60 |
| 26 | + |
| 27 | +## Step 3: vary the size |
| 28 | + |
| 29 | +In order to find a packet size which will filter out noise, add some bytes of data to the ping. |
| 30 | + |
| 31 | + $ ./contrib/nodejs/tools/ping -d 'x' -s 0000.0000.0000.0aa3 |
| 32 | + |
| 33 | +This will create a ping with a single byte payload which will lead to 61 byte packets, a very |
| 34 | +rare packet size in general. |
| 35 | + |
| 36 | + 18:40:56.293030 IP 123.45.67.8.12345 > 87.65.43.210.11223: UDP, length 61 |
| 37 | + 18:40:57.289980 IP 123.45.67.8.12345 > 87.65.43.210.11223: UDP, length 61 |
| 38 | + 18:40:57.290356 IP 123.45.67.8.12345 > 87.65.43.210.11223: UDP, length 61 |
| 39 | + |
| 40 | +Once you find a "quiet" packet size to grep for, you can begin testing to see where the packet |
| 41 | +drops. |
| 42 | + |
0 commit comments