===== Week 4 Updates =====
----
**Scenario for the week** -
* PMTU discovery
I am currently working on **PMTU discovery**. Recently, I have been encoutering a strange error while running the test scripts for packetdrill. \\
So the current test script which I have made looks like this -
// Test for Path MTU Discovery
// Establish the connection
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
0.000 bind(3, ..., ...) = 0
0.000 listen(3, 1) = 0
0.100 < S 0:0(0) win 65535
0.100 > S. 0:0(0) ack 1 <...>
0.200 < . 1:1(0) ack 1 win 65535
0.200 accept(3, ..., ...) = 4
// We send 10 data segments
0.200 write(4, ..., 14600) = 14600
0.200 > P. 1:14601(14600) ack 1
// On receiving 10 data segments at once, the client should send
// an ICMP error saying that fragmentation is required.
0.250 < [1:1461(1460)] icmp unreachable frag_needed mtu 1200
So the first odd thing which happens is that I get variable behavior on running the same script at different times. These are the two logs which I get -
▶ sudo ./packetdrill -v tests/bsd/tcp/pmtu_discovery/pmtu.pkt
inbound injected packet: 0.100013 S 0:0(0) win 65535
outbound sniffed packet: 0.100398 S. 3901362643:3901362643(0) ack 1 win 65535
inbound injected packet: 0.200013 . 1:1(0) ack 3901362644 win 65535
outbound sniffed packet: 0.200425 . 3901362644:3901363804(1160) ack 1 win 1033
tests/bsd/tcp/pmtu_discovery/pmtu.pkt:16: error handling packet: live packet field ipv4_total_length: expected: 14640 (0x3930) vs actual: 1200 (0x4b0)
script packet: 0.200000 P. 1:14601(14600) ack 1
actual packet: 0.200425 . 1:1161(1160) ack 1 win 1033
▶ sudo ./packetdrill -v tests/bsd/tcp/pmtu_discovery/pmtu.pkt
inbound injected packet: 0.100015 S 0:0(0) win 65535
outbound sniffed packet: 0.100368 S. 1553908903:1553908903(0) ack 1 win 65535
inbound injected packet: 0.200013 . 1:1(0) ack 1553908904 win 65535
outbound sniffed packet: 0.200425 . 1553908904:1553910364(1460) ack 1 win 1026
tests/bsd/tcp/pmtu_discovery/pmtu.pkt:16: error handling packet: live packet field ipv4_total_length: expected: 14640 (0x3930) vs actual: 1500 (0x5dc)
script packet: 0.200000 P. 1:14601(14600) ack 1
actual packet: 0.200425 . 1:1461(1460) ack 1 win 1026
As it can be seen, I am getting **//different window sizes from server at different times//**. This seems odd. \\
The thing which I am not able to understand is why is it that I am getting an error on sending a **P.** at 0.200 ms. The expected behaviour should be that I get an ICMP message.
==== Update ====
Thanks to [[https://github.com/tuexen|Michael]] for pointing out the mistake I was doing.\\
0.200 > P. 1:14601(14600) ack 1
This line means that I am sending down one big TCP segment to the NIC. This is supposed to work only if the card reports an interface MTU of more than 14600+ overhead, which is not true on %%FreeBSD%%. \\
One thing which I did wrong was I didn't explain the whole situation properly. Between the two log traces which I posted here, I also injected the ICMP packet just to test. Since %%FreeBSD%% stored this MTU of 1500 bytes for sometime, as a result I got the second log (which actually was scaring me the whole time :-? ) \\
The point which now remains, how will be able to implement this test ? I will have to figure out some other means for dealing with this problem.
----