aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2016-05-11 13:29:26 -0400
committerDavid S. Miller <davem@davemloft.net>2016-05-11 15:14:56 -0400
commit16ec3d4fbb967bd0e1c8d9dce9ef70e915a86615 (patch)
tree1ff4a7f34f35711958bbb8ea1840b56944df97ec /net/openvswitch
parent6e14313f01f02f324d5dd68a49d34ec1e4bb569e (diff)
openvswitch: Fix cached ct with helper.
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: cae3a2627520 ("openvswitch: Allow attaching helpers to ct action") Signed-off-by: Joe Stringer <joe@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/conntrack.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index b5fea1101faa..10c84d882881 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -776,6 +776,19 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
776 return -EINVAL; 776 return -EINVAL;
777 } 777 }
778 778
779 /* Userspace may decide to perform a ct lookup without a helper
780 * specified followed by a (recirculate and) commit with one.
781 * Therefore, for unconfirmed connections which we will commit,
782 * we need to attach the helper here.
783 */
784 if (!nf_ct_is_confirmed(ct) && info->commit &&
785 info->helper && !nfct_help(ct)) {
786 int err = __nf_ct_try_assign_helper(ct, info->ct,
787 GFP_ATOMIC);
788 if (err)
789 return err;
790 }
791
779 /* Call the helper only if: 792 /* Call the helper only if:
780 * - nf_conntrack_in() was executed above ("!cached") for a 793 * - nf_conntrack_in() was executed above ("!cached") for a
781 * confirmed connection, or 794 * confirmed connection, or