<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello everyone.<div><br></div><div>I'm using MIninet 2.0, POX and Open vSwitch, and I try to implement NAT/PAT function in switch. But I faced with one problem: when I send ofp_flow_mod message, like this:</div><div><br></div><div><div><i>ip_packet = packet.payload</i></div><div><i>tcp_packet = ip_packet.payload</i></div><div><i>new_src_port = random.randint(4096, 65533)</i></div></div><div><br></div><div><div><i>back_msg = of.ofp_flow_mod()</i></div><div><i>back_msg.cookie = 12</i></div><div><i>back_msg.match.in_port = port</i></div><div><i>back_msg.match.nw_dst = IPAddr("10.0.2.1") </i></div><div><i>back_msg.match.tp_dst = new_src_port</i></div><div><i>back_msg.actions.append(of.ofp_action_output(port = event.port))</i></div><div><i>back_msg.actions.append(of.ofp_action_nw_addr.set_dst(ip_packet.srcip))</i></div><div><i>back_msg.actions.append(of.ofp_action_tp_port.set_dst(tcp_packet.srcport))</i></div><div><i>back_msg.idle_timeout = 120</i></div><div><i>self.connection.send(back_msg)</i></div></div><div><i><br></i></div><div>and then I check flow with command:</div><div> <i>ovs-ofctl dump-flows tcp:127.0.0.1:6635</i></div><div><i><br></i></div><div>And the only flow with cookie = 12 has only 1 match field instead of 3, that I specify in match structure, but all actions are correct:</div><div><br></div><div>cookie=0xc, duration=5.999s, table=0, n_packets=6, n_bytes=1637, idle_timeout=120,in_port=2 actions=output:1,mod_nw_dst:10.0.1.1,mod_tp_dst:57830</div><div><br></div><div>I've added log.debug message, that could help to find problem, but it looks ok:</div><div><i>log.debug('Back message with match structure: port -  %i, IP-dest - %s, TCP-port dst - %i' % (port, back_msg.match.nw_dst, back_msg.match.tp_dst))</i></div><div><br></div><div>DEBUG:ext.lab_4:Back message with match structure: port -  2, IP-dest - 10.0.2.1, TCP-port dst - 51920</div><div><br></div><div>I send one more ofp_flow_mod message in the same event handler, but I use ofp_match.from_packet() method and it works fine.</div><div><br></div><div>Thanks,</div><div>Alex.</div></body></html>