blob: 904ab3d457ef8b9d1ae6851dd129fa1c6596ec96 [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Jiri Pirko0c6965d2014-11-05 20:51:51 +01003 * net/sched/act_gact.c Generic actions
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * copyright Jamal Hadi Salim (2002-4)
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <linux/types.h>
9#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/string.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/errno.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/skbuff.h>
13#include <linux/rtnetlink.h>
14#include <linux/module.h>
15#include <linux/init.h>
Arnaldo Carvalho de Melodc5fc572007-03-25 23:06:12 -070016#include <net/netlink.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <net/pkt_sched.h>
Davide Caratti0da2dbd2019-03-20 15:00:02 +010018#include <net/pkt_cls.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/tc_act/tc_gact.h>
20#include <net/tc_act/tc_gact.h>
Pedro Tammela871cf382022-12-06 10:55:12 -030021#include <net/tc_wrapper.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
WANG Conga85a9702016-07-25 16:09:41 -070023static struct tc_action_ops act_gact_ops;
WANG Congddf97cc2016-02-22 15:57:53 -080024
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#ifdef CONFIG_GACT_PROB
David S. Millere9ce1cd2006-08-21 23:54:55 -070026static int gact_net_rand(struct tcf_gact *gact)
Linus Torvalds1da177e2005-04-16 15:20:36 -070027{
Eric Dumazetcef5ecf2015-07-06 05:18:05 -070028 smp_rmb(); /* coupled with smp_wmb() in tcf_gact_init() */
Jason A. Donenfeld8032bf12022-10-09 20:44:02 -060029 if (get_random_u32_below(gact->tcfg_pval))
David S. Millere9ce1cd2006-08-21 23:54:55 -070030 return gact->tcf_action;
31 return gact->tcfg_paction;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032}
33
David S. Millere9ce1cd2006-08-21 23:54:55 -070034static int gact_determ(struct tcf_gact *gact)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035{
Eric Dumazetcc6510a2015-07-06 05:18:06 -070036 u32 pack = atomic_inc_return(&gact->packets);
37
Eric Dumazetcef5ecf2015-07-06 05:18:05 -070038 smp_rmb(); /* coupled with smp_wmb() in tcf_gact_init() */
Eric Dumazetcc6510a2015-07-06 05:18:06 -070039 if (pack % gact->tcfg_pval)
David S. Millere9ce1cd2006-08-21 23:54:55 -070040 return gact->tcf_action;
41 return gact->tcfg_paction;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042}
43
David S. Millere9ce1cd2006-08-21 23:54:55 -070044typedef int (*g_rand)(struct tcf_gact *gact);
Eric Dumazetcc7ec452011-01-19 19:26:56 +000045static g_rand gact_rand[MAX_RAND] = { NULL, gact_net_rand, gact_determ };
David S. Millere9ce1cd2006-08-21 23:54:55 -070046#endif /* CONFIG_GACT_PROB */
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Patrick McHardy53b2bf32008-01-23 20:36:30 -080048static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
49 [TCA_GACT_PARMS] = { .len = sizeof(struct tc_gact) },
50 [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) },
51};
52
Benjamin LaHaisec1b52732013-01-14 05:15:39 +000053static int tcf_gact_init(struct net *net, struct nlattr *nla,
WANG Conga85a9702016-07-25 16:09:41 -070054 struct nlattr *est, struct tc_action **a,
Vlad Buslovabbb0d32019-10-30 16:09:05 +020055 struct tcf_proto *tp, u32 flags,
56 struct netlink_ext_ack *extack)
Linus Torvalds1da177e2005-04-16 15:20:36 -070057{
Zhengchao Shaoacd0a7a2022-09-08 12:14:33 +080058 struct tc_action_net *tn = net_generic(net, act_gact_ops.net_id);
Cong Wang695176b2021-07-29 16:12:14 -070059 bool bind = flags & TCA_ACT_FLAGS_BIND;
Patrick McHardy7ba699c2008-01-22 22:11:50 -080060 struct nlattr *tb[TCA_GACT_MAX + 1];
Davide Caratti0da2dbd2019-03-20 15:00:02 +010061 struct tcf_chain *goto_ch = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 struct tc_gact *parm;
David S. Millere9ce1cd2006-08-21 23:54:55 -070063 struct tcf_gact *gact;
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 int ret = 0;
Dmytro Linkin7be8ef22019-08-01 13:02:51 +000065 u32 index;
Patrick McHardycee63722008-01-23 20:33:32 -080066 int err;
Hiroaki SHIMODA696ecdc2012-08-03 19:57:52 +090067#ifdef CONFIG_GACT_PROB
68 struct tc_gact_p *p_parm = NULL;
69#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Patrick McHardycee63722008-01-23 20:33:32 -080071 if (nla == NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 return -EINVAL;
73
Johannes Berg8cb08172019-04-26 14:07:28 +020074 err = nla_parse_nested_deprecated(tb, TCA_GACT_MAX, nla, gact_policy,
75 NULL);
Patrick McHardycee63722008-01-23 20:33:32 -080076 if (err < 0)
77 return err;
78
Patrick McHardy53b2bf32008-01-23 20:36:30 -080079 if (tb[TCA_GACT_PARMS] == NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 return -EINVAL;
Patrick McHardy7ba699c2008-01-22 22:11:50 -080081 parm = nla_data(tb[TCA_GACT_PARMS]);
Dmytro Linkin7be8ef22019-08-01 13:02:51 +000082 index = parm->index;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Patrick McHardy53b2bf32008-01-23 20:36:30 -080084#ifndef CONFIG_GACT_PROB
Patrick McHardy7ba699c2008-01-22 22:11:50 -080085 if (tb[TCA_GACT_PROB] != NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 return -EOPNOTSUPP;
Hiroaki SHIMODA696ecdc2012-08-03 19:57:52 +090087#else
88 if (tb[TCA_GACT_PROB]) {
89 p_parm = nla_data(tb[TCA_GACT_PROB]);
90 if (p_parm->ptype >= MAX_RAND)
91 return -EINVAL;
Davide Caratti9469f372018-10-20 23:33:07 +020092 if (TC_ACT_EXT_CMP(p_parm->paction, TC_ACT_GOTO_CHAIN)) {
93 NL_SET_ERR_MSG(extack,
94 "goto chain not allowed on fallback");
95 return -EINVAL;
96 }
Hiroaki SHIMODA696ecdc2012-08-03 19:57:52 +090097 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070098#endif
99
Dmytro Linkin7be8ef22019-08-01 13:02:51 +0000100 err = tcf_idr_check_alloc(tn, &index, a, bind);
Vlad Buslov0190c1d2018-07-05 17:24:32 +0300101 if (!err) {
Vlad Buslove3822672019-10-30 16:09:06 +0200102 ret = tcf_idr_create_from_flags(tn, index, est, a,
103 &act_gact_ops, bind, flags);
Vlad Buslov0190c1d2018-07-05 17:24:32 +0300104 if (ret) {
Dmytro Linkin7be8ef22019-08-01 13:02:51 +0000105 tcf_idr_cleanup(tn, index);
WANG Cong86062032014-02-11 17:07:31 -0800106 return ret;
Vlad Buslov0190c1d2018-07-05 17:24:32 +0300107 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 ret = ACT_P_CREATED;
Vlad Buslov0190c1d2018-07-05 17:24:32 +0300109 } else if (err > 0) {
Jamal Hadi Salim1a293212013-12-23 08:02:11 -0500110 if (bind)/* dont override defaults */
111 return 0;
Cong Wang695176b2021-07-29 16:12:14 -0700112 if (!(flags & TCA_ACT_FLAGS_REPLACE)) {
Vlad Buslov4e8ddd72018-07-05 17:24:30 +0300113 tcf_idr_release(*a, bind);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 return -EEXIST;
Vlad Buslov4e8ddd72018-07-05 17:24:30 +0300115 }
Vlad Buslov0190c1d2018-07-05 17:24:32 +0300116 } else {
117 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 }
119
Davide Caratti0da2dbd2019-03-20 15:00:02 +0100120 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
121 if (err < 0)
122 goto release_idr;
WANG Conga85a9702016-07-25 16:09:41 -0700123 gact = to_gact(*a);
David S. Millere9ce1cd2006-08-21 23:54:55 -0700124
Vlad Buslov653cd282018-08-14 21:46:16 +0300125 spin_lock_bh(&gact->tcf_lock);
Davide Caratti0da2dbd2019-03-20 15:00:02 +0100126 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127#ifdef CONFIG_GACT_PROB
Hiroaki SHIMODA696ecdc2012-08-03 19:57:52 +0900128 if (p_parm) {
David S. Millere9ce1cd2006-08-21 23:54:55 -0700129 gact->tcfg_paction = p_parm->paction;
Eric Dumazetcef5ecf2015-07-06 05:18:05 -0700130 gact->tcfg_pval = max_t(u16, 1, p_parm->pval);
131 /* Make sure tcfg_pval is written before tcfg_ptype
132 * coupled with smp_rmb() in gact_net_rand() & gact_determ()
133 */
134 smp_wmb();
David S. Millere9ce1cd2006-08-21 23:54:55 -0700135 gact->tcfg_ptype = p_parm->ptype;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 }
137#endif
Vlad Buslov653cd282018-08-14 21:46:16 +0300138 spin_unlock_bh(&gact->tcf_lock);
Vlad Buslove8917f42018-08-10 20:51:43 +0300139
Davide Caratti0da2dbd2019-03-20 15:00:02 +0100140 if (goto_ch)
141 tcf_chain_put_by_act(goto_ch);
142
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 return ret;
Davide Caratti0da2dbd2019-03-20 15:00:02 +0100144release_idr:
145 tcf_idr_release(*a, bind);
146 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147}
148
Pedro Tammela871cf382022-12-06 10:55:12 -0300149TC_INDIRECT_SCOPE int tcf_gact_act(struct sk_buff *skb,
150 const struct tc_action *a,
151 struct tcf_result *res)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152{
WANG Conga85a9702016-07-25 16:09:41 -0700153 struct tcf_gact *gact = to_gact(a);
Eric Dumazet56e5d1c2015-07-06 05:18:08 -0700154 int action = READ_ONCE(gact->tcf_action);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#ifdef CONFIG_GACT_PROB
Eric Dumazet8f2ae965b2015-07-06 05:18:07 -0700157 {
158 u32 ptype = READ_ONCE(gact->tcfg_ptype);
159
160 if (ptype)
161 action = gact_rand[ptype](gact);
162 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163#endif
Vlad Buslov5e1ad952019-10-30 16:09:01 +0200164 tcf_action_update_bstats(&gact->common, skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 if (action == TC_ACT_SHOT)
Vlad Buslov26b537a2019-10-30 16:09:02 +0200166 tcf_action_inc_drop_qstats(&gact->common);
Eric Dumazet56e5d1c2015-07-06 05:18:08 -0700167
168 tcf_lastuse_update(&gact->tcf_tm);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
170 return action;
171}
172
Po Liu4b61d3e2020-06-19 14:01:07 +0800173static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u64 packets,
174 u64 drops, u64 lastuse, bool hw)
Amir Vadai9fea47d2016-05-13 12:55:36 +0000175{
WANG Conga85a9702016-07-25 16:09:41 -0700176 struct tcf_gact *gact = to_gact(a);
Amir Vadai9fea47d2016-05-13 12:55:36 +0000177 int action = READ_ONCE(gact->tcf_action);
178 struct tcf_t *tm = &gact->tcf_tm;
179
Po Liu4b61d3e2020-06-19 14:01:07 +0800180 tcf_action_update_stats(a, bytes, packets,
181 action == TC_ACT_SHOT ? packets : drops, hw);
Roi Dayan3bb23422017-12-26 07:48:51 +0200182 tm->lastuse = max_t(u64, tm->lastuse, lastuse);
Amir Vadai9fea47d2016-05-13 12:55:36 +0000183}
184
Jamal Hadi Salim0b0f43f2016-06-05 10:41:32 -0400185static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a,
186 int bind, int ref)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187{
Arnaldo Carvalho de Melo27a884d2007-04-19 20:29:13 -0700188 unsigned char *b = skb_tail_pointer(skb);
WANG Conga85a9702016-07-25 16:09:41 -0700189 struct tcf_gact *gact = to_gact(a);
Eric Dumazet1c40be12010-08-16 20:04:22 +0000190 struct tc_gact opt = {
191 .index = gact->tcf_index,
Vlad Buslov036bb442018-07-05 17:24:24 +0300192 .refcnt = refcount_read(&gact->tcf_refcnt) - ref,
193 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind,
Eric Dumazet1c40be12010-08-16 20:04:22 +0000194 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 struct tcf_t t;
196
Vlad Buslov653cd282018-08-14 21:46:16 +0300197 spin_lock_bh(&gact->tcf_lock);
Vlad Buslove8917f42018-08-10 20:51:43 +0300198 opt.action = gact->tcf_action;
David S. Miller1b34ec42012-03-29 05:11:39 -0400199 if (nla_put(skb, TCA_GACT_PARMS, sizeof(opt), &opt))
200 goto nla_put_failure;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201#ifdef CONFIG_GACT_PROB
David S. Millere9ce1cd2006-08-21 23:54:55 -0700202 if (gact->tcfg_ptype) {
Eric Dumazet1c40be12010-08-16 20:04:22 +0000203 struct tc_gact_p p_opt = {
204 .paction = gact->tcfg_paction,
205 .pval = gact->tcfg_pval,
206 .ptype = gact->tcfg_ptype,
207 };
208
David S. Miller1b34ec42012-03-29 05:11:39 -0400209 if (nla_put(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt))
210 goto nla_put_failure;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 }
212#endif
Jamal Hadi Salim48d8ee12016-06-06 06:32:55 -0400213 tcf_tm_dump(&t, &gact->tcf_tm);
Nicolas Dichtel9854518e2016-04-26 10:06:18 +0200214 if (nla_put_64bit(skb, TCA_GACT_TM, sizeof(t), &t, TCA_GACT_PAD))
David S. Miller1b34ec42012-03-29 05:11:39 -0400215 goto nla_put_failure;
Vlad Buslov653cd282018-08-14 21:46:16 +0300216 spin_unlock_bh(&gact->tcf_lock);
Vlad Buslove8917f42018-08-10 20:51:43 +0300217
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 return skb->len;
219
Patrick McHardy7ba699c2008-01-22 22:11:50 -0800220nla_put_failure:
Vlad Buslov653cd282018-08-14 21:46:16 +0300221 spin_unlock_bh(&gact->tcf_lock);
Arnaldo Carvalho de Melodc5fc572007-03-25 23:06:12 -0700222 nlmsg_trim(skb, b);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 return -1;
224}
225
Roman Mashak9c5c9c52018-03-08 16:59:20 -0500226static size_t tcf_gact_get_fill_size(const struct tc_action *act)
227{
228 size_t sz = nla_total_size(sizeof(struct tc_gact)); /* TCA_GACT_PARMS */
229
230#ifdef CONFIG_GACT_PROB
231 if (to_gact(act)->tcfg_ptype)
232 /* TCA_GACT_PROB */
233 sz += nla_total_size(sizeof(struct tc_gact_p));
234#endif
235
236 return sz;
237}
238
Baowen Zhengc54e1d92021-12-17 19:16:21 +0100239static int tcf_gact_offload_act_setup(struct tc_action *act, void *entry_data,
Ido Schimmelc2ccf84e2022-04-07 10:35:22 +0300240 u32 *index_inc, bool bind,
241 struct netlink_ext_ack *extack)
Baowen Zhengc54e1d92021-12-17 19:16:21 +0100242{
243 if (bind) {
244 struct flow_action_entry *entry = entry_data;
245
246 if (is_tcf_gact_ok(act)) {
247 entry->id = FLOW_ACTION_ACCEPT;
248 } else if (is_tcf_gact_shot(act)) {
249 entry->id = FLOW_ACTION_DROP;
250 } else if (is_tcf_gact_trap(act)) {
251 entry->id = FLOW_ACTION_TRAP;
252 } else if (is_tcf_gact_goto_chain(act)) {
253 entry->id = FLOW_ACTION_GOTO;
254 entry->chain_index = tcf_gact_goto_chain_index(act);
Ido Schimmel69642c22022-04-07 10:35:23 +0300255 } else if (is_tcf_gact_continue(act)) {
256 NL_SET_ERR_MSG_MOD(extack, "Offload of \"continue\" action is not supported");
257 return -EOPNOTSUPP;
258 } else if (is_tcf_gact_reclassify(act)) {
259 NL_SET_ERR_MSG_MOD(extack, "Offload of \"reclassify\" action is not supported");
260 return -EOPNOTSUPP;
261 } else if (is_tcf_gact_pipe(act)) {
262 NL_SET_ERR_MSG_MOD(extack, "Offload of \"pipe\" action is not supported");
263 return -EOPNOTSUPP;
Baowen Zhengc54e1d92021-12-17 19:16:21 +0100264 } else {
Ido Schimmel69642c22022-04-07 10:35:23 +0300265 NL_SET_ERR_MSG_MOD(extack, "Unsupported generic action offload");
Baowen Zhengc54e1d92021-12-17 19:16:21 +0100266 return -EOPNOTSUPP;
267 }
268 *index_inc = 1;
269 } else {
Baowen Zheng8cbfe932021-12-17 19:16:22 +0100270 struct flow_offload_action *fl_action = entry_data;
271
272 if (is_tcf_gact_ok(act))
273 fl_action->id = FLOW_ACTION_ACCEPT;
274 else if (is_tcf_gact_shot(act))
275 fl_action->id = FLOW_ACTION_DROP;
276 else if (is_tcf_gact_trap(act))
277 fl_action->id = FLOW_ACTION_TRAP;
278 else if (is_tcf_gact_goto_chain(act))
279 fl_action->id = FLOW_ACTION_GOTO;
280 else
281 return -EOPNOTSUPP;
Baowen Zhengc54e1d92021-12-17 19:16:21 +0100282 }
283
284 return 0;
285}
286
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287static struct tc_action_ops act_gact_ops = {
288 .kind = "gact",
Eli Coheneddd2cf2019-02-10 14:25:00 +0200289 .id = TCA_ID_GACT,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 .owner = THIS_MODULE,
Jamal Hadi Salim17400052018-08-12 09:34:52 -0400291 .act = tcf_gact_act,
Amir Vadai9fea47d2016-05-13 12:55:36 +0000292 .stats_update = tcf_gact_stats_update,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 .dump = tcf_gact_dump,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294 .init = tcf_gact_init,
Roman Mashak9c5c9c52018-03-08 16:59:20 -0500295 .get_fill_size = tcf_gact_get_fill_size,
Baowen Zhengc54e1d92021-12-17 19:16:21 +0100296 .offload_act_setup = tcf_gact_offload_act_setup,
WANG Conga85a9702016-07-25 16:09:41 -0700297 .size = sizeof(struct tcf_gact),
WANG Congddf97cc2016-02-22 15:57:53 -0800298};
299
300static __net_init int gact_init_net(struct net *net)
301{
Zhengchao Shaoacd0a7a2022-09-08 12:14:33 +0800302 struct tc_action_net *tn = net_generic(net, act_gact_ops.net_id);
WANG Congddf97cc2016-02-22 15:57:53 -0800303
Cong Wang981471bd2019-08-25 10:01:32 -0700304 return tc_action_net_init(net, tn, &act_gact_ops);
WANG Congddf97cc2016-02-22 15:57:53 -0800305}
306
Cong Wang039af9c2017-12-11 15:35:03 -0800307static void __net_exit gact_exit_net(struct list_head *net_list)
WANG Congddf97cc2016-02-22 15:57:53 -0800308{
Zhengchao Shaoacd0a7a2022-09-08 12:14:33 +0800309 tc_action_net_exit(net_list, act_gact_ops.net_id);
WANG Congddf97cc2016-02-22 15:57:53 -0800310}
311
312static struct pernet_operations gact_net_ops = {
313 .init = gact_init_net,
Cong Wang039af9c2017-12-11 15:35:03 -0800314 .exit_batch = gact_exit_net,
Zhengchao Shaoacd0a7a2022-09-08 12:14:33 +0800315 .id = &act_gact_ops.net_id,
WANG Congddf97cc2016-02-22 15:57:53 -0800316 .size = sizeof(struct tc_action_net),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317};
318
319MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
320MODULE_DESCRIPTION("Generic Classifier actions");
321MODULE_LICENSE("GPL");
322
David S. Millere9ce1cd2006-08-21 23:54:55 -0700323static int __init gact_init_module(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324{
325#ifdef CONFIG_GACT_PROB
Eric Dumazetcc7ec452011-01-19 19:26:56 +0000326 pr_info("GACT probability on\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327#else
Eric Dumazetcc7ec452011-01-19 19:26:56 +0000328 pr_info("GACT probability NOT on\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329#endif
WANG Congddf97cc2016-02-22 15:57:53 -0800330
331 return tcf_register_action(&act_gact_ops, &gact_net_ops);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332}
333
David S. Millere9ce1cd2006-08-21 23:54:55 -0700334static void __exit gact_cleanup_module(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335{
WANG Congddf97cc2016-02-22 15:57:53 -0800336 tcf_unregister_action(&act_gact_ops, &gact_net_ops);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337}
338
339module_init(gact_init_module);
340module_exit(gact_cleanup_module);