I am trying to understand how ECN flag affects TCP congestion window of sender (snd_cwnd parameter in linux).
To do so, I used scapy to generate the desired packet on HostA directed to HostB as sr(IP(src='a.a.a.a',dst='b.b.b.b')/TCP(flags=0x050)).
This did trigger hostA to send a tcp ecn enabled packet to hostB, but since scapy works in user space and not particularly with Linux Kernel TCP I could not extract the the congestion window parameters . I then used StraemSocket() module of scapy to tie scapy connection to linux TCP socket. Hosta = server(a.a.a.a), HostB =client(b.b.b.b)
code as below: server:
from scapy.all import * import socket serversocket = socket.socket() serversocket.bind(("a.a.a.a",9876)) serversocket.listen(1) sc,sockname = serversocket.accept() serverstream=StreamSocket(sc) serverstream.sr(IP(src='a.a.a.a',dst='b.b.b.b')/TCP(flags=0x050))
from scpay.all import * import socket clientsocket = socket.socket() clientsocket.connect(("a.a.a.a",9876)) clientstream = StreamSocket(clientsocket) clientstream.sr(IP(src="b.b.b.b",dst="a.a.a.a")/TCP(flags="S"))
as can be seen from below snapshot, 3 way handshake with ecn and cwd flags is successful( I have enabled ecn on the hosts and all intermediate routers). but wireshark just doesn’t capture the ecn flagged packet sent by server.I am not sure if the server sent the packet at all and I am really at the end of my thoughts here.