From: Tony van der Peet <tony.vanderp...@gmail.com> When a PACKET_OUT has output port of OFPP_TABLE, and the rule table includes a meter and this causes the packet to be deleted, stop the packet from being deleted twice by cloning it and setting it up to be stolen in execution.
Add a test to verify this condition. Signed-off-by: Tony van der Peet <tony.vanderp...@gmail.com> --- lib/dpif-netdev.c | 9 ++++++--- tests/ofproto-dpif.at | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 650e67ab3..d7dc815d8 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -4168,9 +4168,12 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) flow_hash_5tuple(execute->flow, 0)); } - dp_packet_batch_init_packet(&pp, execute->packet); - pp.do_not_steal = true; - dp_netdev_execute_actions(pmd, &pp, false, execute->flow, + /* Batch a copy of the packet for execution and expect this + * packet to be stolne. + */ + dp_packet_batch_init_packet(&pp, dp_packet_clone(execute->packet)); + pp.do_not_steal = false; + dp_netdev_execute_actions(pmd, &pp, true, execute->flow, execute->actions, execute->actions_len); dp_netdev_pmd_flush_output_packets(pmd, true); diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 31064ed95..522cc1318 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -9520,6 +9520,26 @@ OFPST_TABLE reply (OF1.3) (xid=0x2): OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto-dpif packet-out table meter drop]) +OVS_VSWITCHD_START +add_of_ports br0 1 2 + +AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps bands=type=drop rate=1']) +AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=1 action=meter:1,output:2']) + +ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000400080000 actions=resubmit(,0)" +ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000400080000 actions=resubmit(,0)" + +# Check that vswitchd hasn't crashed by dumping the meter added above +AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0 | ofctl_strip], [0], [dnl +OFPST_METER_CONFIG reply (OF1.3): +meter=1 pktps bands= +type=drop rate=1 +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto-dpif - ICMPv6]) OVS_VSWITCHD_START add_of_ports br0 1 -- 2.31.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev