diff options
Diffstat (limited to 'net/openvswitch/conntrack.c')
-rw-r--r-- | net/openvswitch/conntrack.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index c2cc11168fd5..3e8892216f94 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -53,6 +53,8 @@ struct ovs_conntrack_info { | |||
53 | struct md_labels labels; | 53 | struct md_labels labels; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info); | ||
57 | |||
56 | static u16 key_to_nfproto(const struct sw_flow_key *key) | 58 | static u16 key_to_nfproto(const struct sw_flow_key *key) |
57 | { | 59 | { |
58 | switch (ntohs(key->eth.type)) { | 60 | switch (ntohs(key->eth.type)) { |
@@ -141,6 +143,7 @@ static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state, | |||
141 | * previously sent the packet to conntrack via the ct action. | 143 | * previously sent the packet to conntrack via the ct action. |
142 | */ | 144 | */ |
143 | static void ovs_ct_update_key(const struct sk_buff *skb, | 145 | static void ovs_ct_update_key(const struct sk_buff *skb, |
146 | const struct ovs_conntrack_info *info, | ||
144 | struct sw_flow_key *key, bool post_ct) | 147 | struct sw_flow_key *key, bool post_ct) |
145 | { | 148 | { |
146 | const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt; | 149 | const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt; |
@@ -158,13 +161,15 @@ static void ovs_ct_update_key(const struct sk_buff *skb, | |||
158 | zone = nf_ct_zone(ct); | 161 | zone = nf_ct_zone(ct); |
159 | } else if (post_ct) { | 162 | } else if (post_ct) { |
160 | state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID; | 163 | state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID; |
164 | if (info) | ||
165 | zone = &info->zone; | ||
161 | } | 166 | } |
162 | __ovs_ct_update_key(key, state, zone, ct); | 167 | __ovs_ct_update_key(key, state, zone, ct); |
163 | } | 168 | } |
164 | 169 | ||
165 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) | 170 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) |
166 | { | 171 | { |
167 | ovs_ct_update_key(skb, key, false); | 172 | ovs_ct_update_key(skb, NULL, key, false); |
168 | } | 173 | } |
169 | 174 | ||
170 | int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) | 175 | int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) |
@@ -418,7 +423,7 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, | |||
418 | } | 423 | } |
419 | } | 424 | } |
420 | 425 | ||
421 | ovs_ct_update_key(skb, key, true); | 426 | ovs_ct_update_key(skb, info, key, true); |
422 | 427 | ||
423 | return 0; | 428 | return 0; |
424 | } | 429 | } |
@@ -708,7 +713,7 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, | |||
708 | nf_conntrack_get(&ct_info.ct->ct_general); | 713 | nf_conntrack_get(&ct_info.ct->ct_general); |
709 | return 0; | 714 | return 0; |
710 | err_free_ct: | 715 | err_free_ct: |
711 | nf_conntrack_free(ct_info.ct); | 716 | __ovs_ct_free_action(&ct_info); |
712 | return err; | 717 | return err; |
713 | } | 718 | } |
714 | 719 | ||
@@ -750,6 +755,11 @@ void ovs_ct_free_action(const struct nlattr *a) | |||
750 | { | 755 | { |
751 | struct ovs_conntrack_info *ct_info = nla_data(a); | 756 | struct ovs_conntrack_info *ct_info = nla_data(a); |
752 | 757 | ||
758 | __ovs_ct_free_action(ct_info); | ||
759 | } | ||
760 | |||
761 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info) | ||
762 | { | ||
753 | if (ct_info->helper) | 763 | if (ct_info->helper) |
754 | module_put(ct_info->helper->me); | 764 | module_put(ct_info->helper->me); |
755 | if (ct_info->ct) | 765 | if (ct_info->ct) |