Skip to content

Commit

Permalink
openvswitch: Fix cached ct with helper.
Browse files Browse the repository at this point in the history
When using conntrack helpers from OVS, a common configuration is to
perform a lookup without specifying a helper, then go through a
firewalling policy, only to decide to attach a helper afterwards.

In this case, the initial lookup will cause a ct entry to be attached to
the skb, then the later commit with helper should attach the helper and
confirm the connection. However, the helper attachment has been missing.
If the user has enabled automatic helper attachment, then this issue
will be masked as it will be applied in init_conntrack(). It is also
masked if the action is executed from ovs_packet_cmd_execute() as that
will construct a fresh skb.

This patch fixes the issue by making an explicit call to try to assign
the helper if there is a discrepancy between the action's helper and the
current skb->nfct.

Fixes: cae3a26 ("openvswitch: Allow attaching helpers to ct action")
Signed-off-by: Joe Stringer <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
joestringer authored and davem330 committed May 11, 2016
1 parent 6e14313 commit 16ec3d4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions net/openvswitch/conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,19 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
return -EINVAL;
}

/* Userspace may decide to perform a ct lookup without a helper
* specified followed by a (recirculate and) commit with one.
* Therefore, for unconfirmed connections which we will commit,
* we need to attach the helper here.
*/
if (!nf_ct_is_confirmed(ct) && info->commit &&
info->helper && !nfct_help(ct)) {
int err = __nf_ct_try_assign_helper(ct, info->ct,
GFP_ATOMIC);
if (err)
return err;
}

/* Call the helper only if:
* - nf_conntrack_in() was executed above ("!cached") for a
* confirmed connection, or
Expand Down

0 comments on commit 16ec3d4

Please sign in to comment.