Skip to content

Commit

Permalink
northd: check if parent_name is set for tag_request 0
Browse files Browse the repository at this point in the history
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: b68753a ("northd: dynamically compute l2 hdr len for check_pkt_larger action")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
LorenzoBianconi authored and numansiddique committed Sep 14, 2023
1 parent aa352ac commit ef9a78b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 7 additions & 1 deletion northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12843,7 +12843,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;
}
}
Expand Down
17 changes: 17 additions & 0 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -6280,6 +6280,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
])

Expand Down

0 comments on commit ef9a78b

Please sign in to comment.