You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.5 KiB

  1. From 2b76b68c65c97fc11409088c3c30993324df8500 Mon Sep 17 00:00:00 2001
  2. From: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
  3. Date: Thu, 4 Jan 2018 18:50:50 +0100
  4. Subject: [PATCH] build: support for Linux 4.15
  5. Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
  6. ---
  7. extensions/pknock/xt_pknock.c | 16 +++++++++++++++-
  8. 1 file changed, 15 insertions(+), 1 deletion(-)
  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. @@ -469,9 +479,13 @@ add_rule(struct xt_pknock_mtinfo *info)
  35. if (rule->peer_head == NULL)
  36. goto out;
  37. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
  38. + timer_setup(&rule->timer, peer_gc, 0);
  39. +#else
  40. init_timer(&rule->timer);
  41. rule->timer.function = peer_gc;
  42. rule->timer.data = (unsigned long)rule;
  43. +#endif
  44. rule->status_proc = proc_create_data(info->rule_name, 0, pde,
  45. &pknock_proc_ops, rule);