cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
577
Views
1
Helpful
1
Replies

Exasock - Advancing Sequence Number On TCP Preload

yagizarkayin
Level 1
Level 1

Hello,

I am trying to preload a number of packages to the exanic card, and send them sequentially (in a for loop). I am using the example given here:

https://github.com/cisco/exanic-software/blob/master/examples/exasock/tcp-preload-slot.c

However, from my understanding, in this example all slots have the same TCP/IP header, therefore the same sequence number. Because only one of the slots will be sent. I want to send all of them one by one. How can I increase the sequence number to the next sequence number while loading packages?

Thanks in advance.

Kind regards

1 Accepted Solution

Accepted Solutions

I think you are right with the tcp-preload-slot.c example only sending one packet being due to all slots having the same sequence number. Sending multiple preloaded packets sequentially with increasing sequence numbers, you could perhaps modify the existing tcp-preload-slot.c? For example.

  1. Iterate over each slot: Instead using sock->num_slots - 1, iterate through each slot index (i) in the for loop.
  2. Calculate and update sequence number: For each slot (i), calculate the corresponding sequence number by adding i * MSS to the initial sequence number stored in tcp_hdr->seq. Update the tcp_hdr->seq field in the current slot's memory with this calculated sequence number.
  3. Send each packet: Within the loop, after updating the sequence number, call the appropriate Exasock send function (e.g., exasock_send_pkt) to transmit the packet from the current slot.

Warning! Incorrect manipulation can disrupt the TCP flow and lead to issues.

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

1 Reply 1

I think you are right with the tcp-preload-slot.c example only sending one packet being due to all slots having the same sequence number. Sending multiple preloaded packets sequentially with increasing sequence numbers, you could perhaps modify the existing tcp-preload-slot.c? For example.

  1. Iterate over each slot: Instead using sock->num_slots - 1, iterate through each slot index (i) in the for loop.
  2. Calculate and update sequence number: For each slot (i), calculate the corresponding sequence number by adding i * MSS to the initial sequence number stored in tcp_hdr->seq. Update the tcp_hdr->seq field in the current slot's memory with this calculated sequence number.
  3. Send each packet: Within the loop, after updating the sequence number, call the appropriate Exasock send function (e.g., exasock_send_pkt) to transmit the packet from the current slot.

Warning! Incorrect manipulation can disrupt the TCP flow and lead to issues.

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io