]>
Commit | Line | Data |
---|---|---|
1 | commit 2b76b68c65c97fc11409088c3c30993324df8500 | |
2 | Author: Marcelo Henrique Cerri <marcelo.cerri@canonical.com> | |
3 | Date: Thu Jan 4 18:50:50 2018 +0100 | |
4 | ||
5 | build: support for Linux 4.15 | |
6 | ||
7 | Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com> | |
8 | ||
9 | diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c | |
10 | index 6fbdea4..31d4bc8 100644 | |
11 | --- a/extensions/pknock/xt_pknock.c | |
12 | +++ b/extensions/pknock/xt_pknock.c | |
13 | @@ -358,10 +358,20 @@ has_logged_during_this_minute(const struct peer *peer) | |
14 | * @r: rule | |
15 | */ | |
16 | static void | |
17 | -peer_gc(unsigned long r) | |
18 | +peer_gc( | |
19 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) | |
20 | + struct timer_list *tl | |
21 | +#else | |
22 | + unsigned long r | |
23 | +#endif | |
24 | +) | |
25 | { | |
26 | unsigned int i; | |
27 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) | |
28 | + struct xt_pknock_rule *rule = from_timer(rule, tl, timer); | |
29 | +#else | |
30 | struct xt_pknock_rule *rule = (struct xt_pknock_rule *)r; | |
31 | +#endif | |
32 | struct peer *peer; | |
33 | struct list_head *pos, *n; | |
34 | ||
35 | @@ -469,9 +479,13 @@ add_rule(struct xt_pknock_mtinfo *info) | |
36 | if (rule->peer_head == NULL) | |
37 | goto out; | |
38 | ||
39 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) | |
40 | + timer_setup(&rule->timer, peer_gc, 0); | |
41 | +#else | |
42 | init_timer(&rule->timer); | |
43 | rule->timer.function = peer_gc; | |
44 | rule->timer.data = (unsigned long)rule; | |
45 | +#endif | |
46 | ||
47 | rule->status_proc = proc_create_data(info->rule_name, 0, pde, | |
48 | &pknock_proc_ops, rule); |