0

In mininet, I was able to make a TCP connection between a server h1 and a host h4 in my custom POX controller c0 as the following:

h1.cmd('python -m SimpleHTTPServer 80 &')
thread.start_new_thread(tcp_thread, h4)

def tcp_thread(src):
    for i in range(10):
        src.cmd('wget -O - 10.0.0.1')
        time.sleep(5) 

h4 requests HTTP page from the server and keeps acknowledging the server normally based on TCP standard. Here, I want to be able to force h4 to send ACK packets using another path between them. I don't have a problem with forwarding or making paths but I do have an issue with how to capture or extract Ack packets before h4 sending them so I can forward them as I want.

Thank you.

Kimmel Jor
  • 25
  • 3

1 Answers1

0

If you have a PacketIn function you can add some lines of code to catch ACK flag

packet = event.parsed
tcp_found = packet.find('tcp')
if tcp_found:
  if tcp_found.ACK:
    print "ACK found"
    # do your things

The ACK flag is a tcp attribute as stated in the POX wiki

TCP (tcp) Attributes: ...... FIN (bool) - True when FIN flag set ACK (bool) - True when ACK flag set ......

To get those attributes we assign the tcp part of the packet to a variable using the find method, then we access the attributes using a dot (.) ex.

variable.attribute
tcp_found.ACK
  • Thank you very much for enlighten me. – Kimmel Jor May 19 '16 at 20:46
  • May I ask a question: I used your suggestion which is perfect. However, you know the first packet sent from `h4` is the SYN because of the handshaking process. Thus, the PacketIN raised from `h4` indicates the incoming [SYN] packet to the switch!! – Kimmel Jor May 20 '16 at 16:17
  • What is the question? – SotirisTsartsaris May 20 '16 at 16:38
  • The question is: Is it possible to specify the type of TCP packet (ACK or SNY) in the flow rule match()? For example, I will make two identical flow rules from `src` to `dst` but differ in the type of TCP, one to forward those ACKs via a specific route and another types in different route. – Kimmel Jor May 20 '16 at 16:49
  • Not with POX directly. matching tcp flags in a flow mod rule is available from openflow 1.5+ and above. Pox uses 1.0 I believe. – SotirisTsartsaris May 20 '16 at 17:19
  • Yes, it uses 1.0 ... So there is no way to upgrade to 1.5 ? – Kimmel Jor May 20 '16 at 17:22
  • Depends on the switch used in the network emulation environment. – SotirisTsartsaris May 20 '16 at 17:31