1
votes

i'm trying to redirect TCP flows to a specific servers using their tcp source port with RYU SDN controller. This is my topology (simple for the first step):

host -- ovs1 -- ovs2 -- server

match rule for ovs1:

match = parse.OFPMatch(in_port=port,eth_type=0x0800, ipv4_dst=server_ip, tcp_src=tcp_pkt.src_port)

But i get the following error:

EventOFPErrorMsg received.
version=0x4, msg_type=0x1, msg_len=0x4c, xid=0x370bf1bf
 `-- msg_type: OFPT_ERROR(1)
OFPErrorMsg(type=0x4, code=0x9, data=b'\x04\x0e\x00\x70\x37\x0b\xf1\xbf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x28\x80\x00\x00\x04\x00\x00\x00\x01\x80\x00\x0a\x02')
 |-- type: OFPET_BAD_MATCH(4)
 |-- code: OFPBMC_BAD_PREREQ(9)
 `-- data: version=0x4, msg_type=0xe, msg_len=0x70, xid=0x370bf1bf
     `-- msg_type: OFPT_FLOW_MOD(14)

The point is, if I remove the tcp_src option, everything works fine, that's why I think that the problem is related to how I'm passing the port.

Any ideas?

Thanks in advance!

1

1 Answers

4
votes

Ok, after spend a lot of time with this problem i got the answer. In order to define a specific match with TCP ports, we need to satisfy all the prerequisites, that means that in my case is needed to add the ip_proto field:

match = parse.OFPMatch(in_port=port,eth_type=0x0800, ip_proto=6, ipv4_dst=server_ip, tcp_src=tcp_pkt.src_port)

I found the answer here: OpenFlow Switch Specification