Check if parent_name is properly set in build_gateway_get_l2_hdr_size routine if tag_request is set 0, since parent_name is mandatory for dynamically allocated VLANID.
Reported-at: https://issues.redhat.com/browse/FDP-38 Fixes: b68753a573cd ("northd: dynamically compute l2 hdr len for check_pkt_larger action") Signed-off-by: Lorenzo Bianconi <[email protected]> --- Changes since v1: - add more unit-tests --- northd/northd.c | 8 +++++++- tests/ovn-northd.at | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/northd/northd.c b/northd/northd.c index 3eaa43f07..b041467a3 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -12282,7 +12282,13 @@ build_gateway_get_l2_hdr_size(struct ovn_port *op) struct ovn_port *localnet_port = peer->od->localnet_ports[i]; const struct nbrec_logical_switch_port *nbsp = localnet_port->nbsp; - if (nbsp && nbsp->n_tag_request > 0) { + if (!nbsp || !nbsp->tag_request) { + continue; + } + + if (nbsp->tag_request[0] || + (nbsp->parent_name && nbsp->parent_name[0])) { + /* Valid tag. */ return VLAN_ETH_HEADER_LEN; } } diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 23dbe111f..3cee55283 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -6267,6 +6267,23 @@ AT_CHECK([grep "lr_in_admission" lr0flows | grep -e "check_pkt_larger" | sort], table=0 (lr_in_admission ), priority=50 , match=(eth.mcast && inport == "lr0-public"), action=(reg9[[1]] = check_pkt_larger(1518); xreg0[[0..47]] = 00:00:20:20:12:13; next;) ]) +# tag 0 requires a parent port +check ovn-nbctl --wait=sb set Logical_Switch_Port ext-port tag_request=0 + +ovn-sbctl dump-flows lr0 > lr0flows +AT_CHECK([grep "lr_in_admission" lr0flows | grep -e "check_pkt_larger" | sort], [0], [dnl + table=0 (lr_in_admission ), priority=50 , match=(eth.dst == 00:00:20:20:12:13 && inport == "lr0-public"), action=(reg9[[1]] = check_pkt_larger(1514); xreg0[[0..47]] = 00:00:20:20:12:13; next;) + table=0 (lr_in_admission ), priority=50 , match=(eth.mcast && inport == "lr0-public"), action=(reg9[[1]] = check_pkt_larger(1514); xreg0[[0..47]] = 00:00:20:20:12:13; next;) +]) + +check ovn-nbctl --wait=sb set Logical_Switch_Port ext-port parent_name=ext-parent-port + +ovn-sbctl dump-flows lr0 > lr0flows +AT_CHECK([grep "lr_in_admission" lr0flows | grep -e "check_pkt_larger" | sort], [0], [dnl + table=0 (lr_in_admission ), priority=50 , match=(eth.dst == 00:00:20:20:12:13 && inport == "lr0-public"), action=(reg9[[1]] = check_pkt_larger(1518); xreg0[[0..47]] = 00:00:20:20:12:13; next;) + table=0 (lr_in_admission ), priority=50 , match=(eth.mcast && inport == "lr0-public"), action=(reg9[[1]] = check_pkt_larger(1518); xreg0[[0..47]] = 00:00:20:20:12:13; next;) +]) + AT_CLEANUP ]) -- 2.41.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
