From ae69f417e1c7b62ad61b494c71e9e7bf48e0d4ac Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Jul 21 2023 19:44:13 +0000 Subject: Import openvswitch3.1-3.1.0-43 from Fast DataPath --- diff --git a/SOURCES/openvswitch-3.1.0.patch b/SOURCES/openvswitch-3.1.0.patch index fd6e911..7a558aa 100644 --- a/SOURCES/openvswitch-3.1.0.patch +++ b/SOURCES/openvswitch-3.1.0.patch @@ -2905,7 +2905,7 @@ index e05ffe312..b44c72969 100644 if (result != UKEY_KEEP) { /* Clears 'recircs' if filled by revalidate_ukey(). */ diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c -index a9cf3cbee..10a5844d8 100644 +index a9cf3cbee..78b6df409 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -66,6 +66,7 @@ @@ -2944,7 +2944,124 @@ index a9cf3cbee..10a5844d8 100644 if (flow->nw_ttl > 1) { flow->nw_ttl--; return false; -@@ -7128,6 +7134,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, +@@ -6979,6 +6985,107 @@ xlate_ofpact_unroll_xlate(struct xlate_ctx *ctx, + "cookie=%#"PRIx64, a->rule_table_id, a->rule_cookie); + } + ++/* Reset the mirror context if we modify the packet and would like to mirror ++ * the new copy. */ ++static void ++reset_mirror_ctx(struct xlate_ctx *ctx, const struct flow *flow, ++ const struct ofpact *a) ++{ ++ switch (a->type) { ++ case OFPACT_STRIP_VLAN: ++ case OFPACT_PUSH_VLAN: ++ case OFPACT_SET_ETH_SRC: ++ case OFPACT_SET_ETH_DST: ++ case OFPACT_PUSH_MPLS: ++ case OFPACT_POP_MPLS: ++ case OFPACT_SET_MPLS_LABEL: ++ case OFPACT_SET_MPLS_TC: ++ case OFPACT_SET_MPLS_TTL: ++ case OFPACT_DEC_MPLS_TTL: ++ case OFPACT_DEC_NSH_TTL: ++ case OFPACT_DEC_TTL: ++ case OFPACT_SET_VLAN_VID: ++ case OFPACT_SET_VLAN_PCP: ++ case OFPACT_ENCAP: ++ case OFPACT_DECAP: ++ case OFPACT_NAT: ++ ctx->mirrors = 0; ++ return; ++ ++ case OFPACT_SET_FIELD: { ++ const struct ofpact_set_field *set_field; ++ const struct mf_field *mf; ++ ++ set_field = ofpact_get_SET_FIELD(a); ++ mf = set_field->field; ++ if (mf_are_prereqs_ok(mf, flow, NULL)) { ++ ctx->mirrors = 0; ++ } ++ return; ++ } ++ ++ case OFPACT_SET_IPV4_SRC: ++ case OFPACT_SET_IPV4_DST: ++ if (flow->dl_type == htons(ETH_TYPE_IP)) { ++ ctx->mirrors = 0; ++ } ++ return; ++ ++ case OFPACT_SET_IP_DSCP: ++ case OFPACT_SET_IP_ECN: ++ case OFPACT_SET_IP_TTL: ++ if (is_ip_any(flow)) { ++ ctx->mirrors = 0; ++ } ++ return; ++ ++ case OFPACT_SET_L4_SRC_PORT: ++ case OFPACT_SET_L4_DST_PORT: ++ if (is_ip_any(flow) && !(flow->nw_frag & FLOW_NW_FRAG_LATER)) { ++ ctx->mirrors = 0; ++ } ++ return; ++ ++ case OFPACT_OUTPUT_REG: ++ case OFPACT_OUTPUT_TRUNC: ++ case OFPACT_GROUP: ++ case OFPACT_OUTPUT: ++ case OFPACT_CONTROLLER: ++ case OFPACT_RESUBMIT: ++ case OFPACT_GOTO_TABLE: ++ case OFPACT_WRITE_METADATA: ++ case OFPACT_SET_TUNNEL: ++ case OFPACT_REG_MOVE: ++ case OFPACT_STACK_PUSH: ++ case OFPACT_STACK_POP: ++ case OFPACT_LEARN: ++ case OFPACT_ENQUEUE: ++ case OFPACT_SET_QUEUE: ++ case OFPACT_POP_QUEUE: ++ case OFPACT_MULTIPATH: ++ case OFPACT_BUNDLE: ++ case OFPACT_EXIT: ++ case OFPACT_UNROLL_XLATE: ++ case OFPACT_FIN_TIMEOUT: ++ case OFPACT_CLEAR_ACTIONS: ++ case OFPACT_WRITE_ACTIONS: ++ case OFPACT_METER: ++ case OFPACT_SAMPLE: ++ case OFPACT_CLONE: ++ case OFPACT_DEBUG_RECIRC: ++ case OFPACT_DEBUG_SLOW: ++ case OFPACT_CT: ++ case OFPACT_CT_CLEAR: ++ case OFPACT_CHECK_PKT_LARGER: ++ case OFPACT_DELETE_FIELD: ++ case OFPACT_NOTE: ++ case OFPACT_CONJUNCTION: ++ return; ++ } ++ ++ OVS_NOT_REACHED(); ++} ++ + static void + do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, + struct xlate_ctx *ctx, bool is_last_action, +@@ -7020,6 +7127,8 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, + break; + } + ++ reset_mirror_ctx(ctx, flow, a); ++ + if (OVS_UNLIKELY(ctx->xin->trace)) { + struct ofputil_port_map map = OFPUTIL_PORT_MAP_INITIALIZER(&map); + +@@ -7128,6 +7237,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, case OFPACT_SET_IPV4_SRC: if (flow->dl_type == htons(ETH_TYPE_IP)) { memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src); @@ -2952,7 +3069,7 @@ index a9cf3cbee..10a5844d8 100644 flow->nw_src = ofpact_get_SET_IPV4_SRC(a)->ipv4; } break; -@@ -7135,12 +7142,14 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, +@@ -7135,12 +7245,14 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, case OFPACT_SET_IPV4_DST: if (flow->dl_type == htons(ETH_TYPE_IP)) { memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst); @@ -2967,7 +3084,7 @@ index a9cf3cbee..10a5844d8 100644 wc->masks.nw_tos |= IP_DSCP_MASK; flow->nw_tos &= ~IP_DSCP_MASK; flow->nw_tos |= ofpact_get_SET_IP_DSCP(a)->dscp; -@@ -7149,6 +7158,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, +@@ -7149,6 +7261,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, case OFPACT_SET_IP_ECN: if (is_ip_any(flow)) { @@ -2975,7 +3092,7 @@ index a9cf3cbee..10a5844d8 100644 wc->masks.nw_tos |= IP_ECN_MASK; flow->nw_tos &= ~IP_ECN_MASK; flow->nw_tos |= ofpact_get_SET_IP_ECN(a)->ecn; -@@ -7157,6 +7167,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, +@@ -7157,6 +7270,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, case OFPACT_SET_IP_TTL: if (is_ip_any(flow)) { @@ -2983,7 +3100,7 @@ index a9cf3cbee..10a5844d8 100644 wc->masks.nw_ttl = 0xff; flow->nw_ttl = ofpact_get_SET_IP_TTL(a)->ttl; } -@@ -7224,6 +7235,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, +@@ -7224,6 +7338,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, /* Set the field only if the packet actually has it. */ if (mf_are_prereqs_ok(mf, flow, wc)) { @@ -2991,7 +3108,7 @@ index a9cf3cbee..10a5844d8 100644 mf_mask_field_masked(mf, ofpact_set_field_mask(set_field), wc); mf_set_flow_value_masked(mf, set_field->value, ofpact_set_field_mask(set_field), -@@ -7280,6 +7292,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, +@@ -7280,6 +7395,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len, case OFPACT_DEC_TTL: wc->masks.nw_ttl = 0xff; @@ -3771,7 +3888,7 @@ index 000000000..ac2fc1b80 +OVS_VSWITCHD_STOP(["/cannot find route for controller/d"]) +AT_CLEANUP diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at -index fa6111c1e..6b58cabec 100644 +index fa6111c1e..119b78ef9 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -849,7 +849,7 @@ table=2 ip actions=set_field:192.168.3.91->ip_src,output(11) @@ -3840,6 +3957,33 @@ index fa6111c1e..6b58cabec 100644 Datapath actions: dnl 100,dnl set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl +@@ -5349,7 +5349,7 @@ AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) + flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" + AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout]) + AT_CHECK_UNQUOTED([tail -1 stdout], [0], +- [Datapath actions: 3,push_vlan(vid=17,pcp=0),2 ++ [Datapath actions: 3,push_vlan(vid=17,pcp=0),2,3 + ]) + + flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" +@@ -5388,7 +5388,7 @@ flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x080 + AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout]) + actual=`tail -1 stdout | sed 's/Datapath actions: //'` + +-expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100" ++expected="push_vlan(vid=12,pcp=0),100,2,1,pop_vlan,push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),100,2,1" + AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout]) + mv stdout expout + AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout]) +@@ -5656,7 +5656,7 @@ AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) + flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" + AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout]) + AT_CHECK_UNQUOTED([tail -1 stdout], [0], +- [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2 ++ [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2,trunc(100),3 + ]) + + flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" @@ -11884,7 +11884,7 @@ ovs-ofctl dump-flows br0 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout]) diff --git a/SPECS/openvswitch3.1.spec b/SPECS/openvswitch3.1.spec index b87fa6d..a247f48 100644 --- a/SPECS/openvswitch3.1.spec +++ b/SPECS/openvswitch3.1.spec @@ -63,7 +63,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 3.1.0 -Release: 42%{?dist} +Release: 43%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -757,6 +757,12 @@ exit 0 %endif %changelog +* Fri Jul 21 2023 Open vSwitch CI - 3.1.0-43 +- Merging upstream branch-3.1 [RH git: da1afee4f8] + Commit list: + cad4759fa1 ofproto-dpif-upcall: Mirror packets that are modified. (#2155579) + + * Wed Jul 19 2023 Open vSwitch CI - 3.1.0-42 - Merging upstream branch-3.1 [RH git: b1a11e2717] Commit list: