History

net: prefer nf_ct_put instead of nf_conntrack_put

Its the same as nf_conntrack_put(), but without the need for an indirect call. The downside is a module dependency on nf_conntrack, but all of these already depend on conntrack anyway.

Florian Westphal committed 4 years ago

Commit 408bdcf1 parent 6ae79893 files · +15 −9Browse files

Showing the changes to net/openvswitch (1 of 3 files). Show all

Unified · Split

net/openvswitch/conntrack.c+10−4
@@ -574,7 +574,7 @@ ovs_ct_expect_find(struct net *net, const struct nf_conntrack_zone *zone, · 573 unmodified lines
574574 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
575575
576576 nf_ct_delete(ct, 0, 0);
577− nf_conntrack_put(&ct->ct_general);
577+ nf_ct_put(ct);
578578 }
579579 }
580580
@@ -723,7 +723,7 @@ static bool skb_nfct_cached(struct net *net, · 142 unmodified lines
723723 if (nf_ct_is_confirmed(ct))
724724 nf_ct_delete(ct, 0, 0);
725725
726− nf_conntrack_put(&ct->ct_general);
726+ nf_ct_put(ct);
727727 nf_ct_set(skb, NULL, 0);
728728 return false;
729729 }
@@ -967,7 +967,8 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, · 237 unmodified lines
967967
968968 /* Associate skb with specified zone. */
969969 if (tmpl) {
970− nf_conntrack_put(skb_nfct(skb));
970+ ct = nf_ct_get(skb, &ctinfo);
971+ nf_ct_put(ct);
971972 nf_conntrack_get(&tmpl->ct_general);
972973 nf_ct_set(skb, tmpl, IP_CT_NEW);
973974 }
@@ -1328,7 +1329,12 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb, · 354 unmodified lines
13281329
13291330 int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key)
13301331 {
1331− nf_conntrack_put(skb_nfct(skb));
1332+ enum ip_conntrack_info ctinfo;
1333+ struct nf_conn *ct;
1334+
1335+ ct = nf_ct_get(skb, &ctinfo);
1336+
1337+ nf_ct_put(ct);
13321338 nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
13331339 ovs_ct_fill_key(skb, key, false);
13341340

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t