Skip to content

Commit a908f98

Browse files
LorenzoBianconiSasha Levin
authored andcommitted
openvswitch: take into account de-fragmentation/gso_size in execute_check_pkt_len
[ Upstream commit 1784365 ] ovs connection tracking module performs de-fragmentation on incoming fragmented traffic. Take info account if traffic has been de-fragmented in execute_check_pkt_len action otherwise we will perform the wrong nested action considering the original packet size. This issue typically occurs if ovs-vswitchd adds a rule in the pipeline that requires connection tracking (e.g. OVN stateful ACLs) before execute_check_pkt_len action. Moreover take into account GSO fragment size for GSO packet in execute_check_pkt_len routine Fixes: 4d5ec89 ("net: openvswitch: Add a new action check_pkt_len") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 27b7021 commit a908f98

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎net/openvswitch/actions.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,10 @@ static int execute_check_pkt_len(struct datapath *dp, struct sk_buff *skb,
11461146
struct sw_flow_key *key,
11471147
const struct nlattr *attr, bool last)
11481148
{
1149+
struct ovs_skb_cb *ovs_cb = OVS_CB(skb);
11491150
const struct nlattr *actions, *cpl_arg;
1151+
int len, max_len, rem = nla_len(attr);
11501152
const struct check_pkt_len_arg *arg;
1151-
int rem = nla_len(attr);
11521153
bool clone_flow_key;
11531154

11541155
/* The first netlink attribute in 'attr' is always
@@ -1157,7 +1158,11 @@ static int execute_check_pkt_len(struct datapath *dp, struct sk_buff *skb,
11571158
cpl_arg = nla_data(attr);
11581159
arg = nla_data(cpl_arg);
11591160

1160-
if (skb->len <= arg->pkt_len) {
1161+
len = ovs_cb->mru ? ovs_cb->mru + skb->mac_len : skb->len;
1162+
max_len = arg->pkt_len;
1163+
1164+
if ((skb_is_gso(skb) && skb_gso_validate_mac_len(skb, max_len)) ||
1165+
len <= max_len) {
11611166
/* Second netlink attribute in 'attr' is always
11621167
* 'OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL'.
11631168
*/

0 commit comments

Comments
 (0)