I think we are using the same terminology to refer to 2 different things. After a connection is made:

A B SYN------> <--------SYN+ACK ACK------>

Then the ACK flag (or bit) is kept high for all subsequent packets. I used the term ACK to mean specifically the packet sent in response to a SYN+ACK packet, I did not mean to use it to refer to any packet with the ACK flag set.

You are correct that data is allowed to be sent during the 3 way handshaking provided that it remains in a buffer until the connection is established (from RFC 793). So the data does (should) not be passed up the stack until the connection is made.

I currently do not have access to a computer with the libpcap library but this code should help get you started towards your goal.

use Net::RawIP; $ack_with_data = Net::RawIP->new({ ip => { saddr => '111.111.111.111', daddr => '111.111.111.112' }, }); tcp => { source => 111, dest => 111, ack => 1, #insert the correct seq number and ack seq number seq => 11111, ack_seq => 11111, #insert http data here (i am not very familiar with http) data => "GET /asdlfk HTTP/1.1\nHost: asd.asd.com\n", }, }); $ack_with_data->send;

Disclaimer: This code might be missing some things. I was not able to test it but it should help you see how to form a packet and send it. The specific fields will need to be correctly set and I might be missing a few.


In reply to Re^3: Piggybacking data on TCP ACK by zek152
in thread Piggybacking data on TCP ACK by rrekhi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.