pythonnetworkingmininetopenflowryu

Why ryu OFPActionSetField did not work as an action but OFPActionOutput worked?


I am trying to write a simple ryu controller that redirect specific traffics of TCP packets and forwards all other traffics.

I built a simple topology with mininet, in which there are 3 hosts connected to 1 switch, which is controlled by the ryu controller.

Host c13 (mac 00:00:00:00:00:11, ip 10.0.2.1) will send TCP packets to host s11 (mac 00:00:00:00:00:11, ip 10.0.2.2) through the switch, and the traffic is designed to be redirected to host s12 (mac 00:00:00:00:00:12, ip 10.0.2.3), which will reply to c11, but whose packets will be modified by the switch so that c11 will think that s11 is the one who replies to it.

I used OFPActionOutput to redirect the traffic, and OFPActionSetField to modify the header fields. From the flow table entries dump, I could see that I installed the entries successfully: enter image description here

From the wireshark packet captures, I saw that the TCP packets from c11 to s11 were redirected successfully to s12. However, the fields were not changed. enter image description here

I appreciate any suggestions and hints about this problem. I appreciate all your time and replies in advance.


Solution

  • Alright, the problem turned out to be really simple yet I overlooked it for a long time... It is the order in which the action fields are set.

    After putting the SetField actions before the Output action, it worked perfectly.