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.

78 lines
2.5 KiB

  1. Restore support for kernel 4.14
  2. This reverts commit bf63a25a64c9223435c26e6543ba749834b47752.
  3. ---
  4. configure.ac | 2 +-
  5. extensions/compat_xtables.h | 4 ++--
  6. extensions/pknock/xt_pknock.c | 16 ++++++++++++++++
  7. 3 files changed, 19 insertions(+), 3 deletions(-)
  8. diff --git a/configure.ac b/configure.ac
  9. index 7631f6b..0d3aa72 100644
  10. --- a/configure.ac
  11. +++ b/configure.ac
  12. @@ -61,7 +61,7 @@ if test -n "$kbuilddir"; then
  13. echo "WARNING: That kernel version is not officially supported yet. Continue at own luck.";
  14. elif test "$kmajor" -eq 5 -a "$kminor" -ge 0; then
  15. :
  16. - elif test "$kmajor" -eq 4 -a "$kminor" -ge 18; then
  17. + elif test "$kmajor" -eq 4 -a "$kminor" -ge 14; then
  18. :
  19. else
  20. echo "WARNING: That kernel version is not officially supported.";
  21. diff --git a/extensions/compat_xtables.h b/extensions/compat_xtables.h
  22. index d08354a..faf5dd8 100644
  23. --- a/extensions/compat_xtables.h
  24. +++ b/extensions/compat_xtables.h
  25. @@ -8,8 +8,8 @@
  26. #define DEBUGP Use__pr_debug__instead
  27. -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
  28. -# warning Kernels below 4.15 not supported.
  29. +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
  30. +# warning Kernels below 4.14 not supported.
  31. #endif
  32. #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
  33. diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
  34. index c76901a..7be0345 100644
  35. --- a/extensions/pknock/xt_pknock.c
  36. +++ b/extensions/pknock/xt_pknock.c
  37. @@ -357,10 +357,18 @@ has_logged_during_this_minute(const struct peer *peer)
  38. *
  39. * @r: rule
  40. */
  41. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
  42. static void peer_gc(struct timer_list *tl)
  43. +#else
  44. +static void peer_gc(unsigned long r)
  45. +#endif
  46. {
  47. unsigned int i;
  48. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
  49. struct xt_pknock_rule *rule = from_timer(rule, tl, timer);
  50. +#else
  51. + struct xt_pknock_rule *rule = (struct xt_pknock_rule *)r;
  52. +#endif
  53. struct peer *peer;
  54. struct list_head *pos, *n;
  55. @@ -467,7 +475,15 @@ add_rule(struct xt_pknock_mtinfo *info)
  56. rule->peer_head = alloc_hashtable(peer_hashsize);
  57. if (rule->peer_head == NULL)
  58. goto out;
  59. +
  60. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
  61. timer_setup(&rule->timer, peer_gc, 0);
  62. +#else
  63. + init_timer(&rule->timer);
  64. + rule->timer.function = peer_gc;
  65. + rule->timer.data = (unsigned long)rule;
  66. +#endif
  67. +
  68. rule->status_proc = proc_create_data(info->rule_name, 0, pde,
  69. &pknock_proc_ops, rule);
  70. if (rule->status_proc == NULL)
  71. --
  72. 2.21.0