3
votes

I'm using Net::RawIP to send packets with specific TCP flags. Is there a way to set the CWR flag? TCP protokey "res2" sets the ECE flag, but "res1" seems to set the NS flag:

$n = Net::RawIP->new({
ip  => {
        saddr => 'my.target.lan',
        daddr => 'my.target.lan',
       },
tcp => {
        source => 123,
        dest   => 123,
        res1   => 1,
        res2   => 1,
        fin    => 1,
        syn    => 1
       }
});

Here's a Wireshark capture of the packet's flags:

Wireshark capture of the packet's flags

1
Wouldn't it be window? ("If ARGPROTO is tcp PROTOKEY can be one of (source, dest, seq, ack_seq, doff, res1, res2, urg, ack, psh, rst, syn, fin, window, check, urg_ptr, data).") - ikegami
No, window sets the window size value. - Flip

1 Answers

1
votes

res2 is two bits wide.

res2 => 1   # ECE
res2 => 2   # CWR
res2 => 3   # ECE & CWR

(It might be the opposite on big-endian machines, but I doubt it.)

(res1 is the 4 bits labeled as "Reserved" and "Nonce" in the Wireshark capture.)