act_connmark.c (002c6ca75289a4ac4f6738213dd2d258704886e4) act_connmark.c (52d1aa8b8249ff477aaa38b6f74a8ced780d079c)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/sched/act_connmark.c netfilter connmark retriever action
4 * skb mark is over-written
5 *
6 * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
7*/
8

--- 47 unchanged lines hidden (view full) ---

56 proto = NFPROTO_IPV6;
57 break;
58 default:
59 goto out;
60 }
61
62 c = nf_ct_get(skb, &ctinfo);
63 if (c) {
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/sched/act_connmark.c netfilter connmark retriever action
4 * skb mark is over-written
5 *
6 * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
7*/
8

--- 47 unchanged lines hidden (view full) ---

56 proto = NFPROTO_IPV6;
57 break;
58 default:
59 goto out;
60 }
61
62 c = nf_ct_get(skb, &ctinfo);
63 if (c) {
64 skb->mark = c->mark;
64 skb->mark = READ_ONCE(c->mark);
65 /* using overlimits stats to count how many packets marked */
66 ca->tcf_qstats.overlimits++;
67 goto out;
68 }
69
70 if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb),
71 proto, ca->net, &tuple))
72 goto out;
73
74 zone.id = ca->zone;
75 zone.dir = NF_CT_DEFAULT_ZONE_DIR;
76
77 thash = nf_conntrack_find_get(ca->net, &zone, &tuple);
78 if (!thash)
79 goto out;
80
81 c = nf_ct_tuplehash_to_ctrack(thash);
82 /* using overlimits stats to count how many packets marked */
83 ca->tcf_qstats.overlimits++;
65 /* using overlimits stats to count how many packets marked */
66 ca->tcf_qstats.overlimits++;
67 goto out;
68 }
69
70 if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb),
71 proto, ca->net, &tuple))
72 goto out;
73
74 zone.id = ca->zone;
75 zone.dir = NF_CT_DEFAULT_ZONE_DIR;
76
77 thash = nf_conntrack_find_get(ca->net, &zone, &tuple);
78 if (!thash)
79 goto out;
80
81 c = nf_ct_tuplehash_to_ctrack(thash);
82 /* using overlimits stats to count how many packets marked */
83 ca->tcf_qstats.overlimits++;
84 skb->mark = c->mark;
84 skb->mark = READ_ONCE(c->mark);
85 nf_ct_put(c);
86
87out:
88 spin_unlock(&ca->tcf_lock);
89 return ca->tcf_action;
90}
91
92static const struct nla_policy connmark_policy[TCA_CONNMARK_MAX + 1] = {

--- 153 unchanged lines hidden ---
85 nf_ct_put(c);
86
87out:
88 spin_unlock(&ca->tcf_lock);
89 return ca->tcf_action;
90}
91
92static const struct nla_policy connmark_policy[TCA_CONNMARK_MAX + 1] = {

--- 153 unchanged lines hidden ---