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.

136 lines
3.4 KiB

  1. --- a/extensions/LUA/xt_LUA_target.c
  2. +++ b/extensions/LUA/xt_LUA_target.c
  3. @@ -19,7 +19,7 @@
  4. #include <linux/kernel.h>
  5. #include <linux/slab.h>
  6. #include <linux/module.h>
  7. -#include <asm/uaccess.h>
  8. +#include <linux/uaccess.h>
  9. #include <net/ip.h>
  10. #include <linux/netfilter/x_tables.h>
  11. #include "xt_LUA.h"
  12. @@ -64,10 +64,10 @@ uint32_t lua_state_refs[LUA_STATE_ARRAY
  13. * XT_CONTINUE inside the *register_lua_packet_lib* function.
  14. */
  15. -spinlock_t lock = SPIN_LOCK_UNLOCKED;
  16. +DEFINE_SPINLOCK(lock);
  17. static uint32_t
  18. -lua_tg(struct sk_buff *pskb, const struct xt_target_param *par)
  19. +lua_tg(struct sk_buff *pskb, const struct xt_action_param *par)
  20. {
  21. uint32_t verdict;
  22. lua_packet_segment *p;
  23. @@ -79,7 +79,7 @@ lua_tg(struct sk_buff *pskb, const struc
  24. L = lua_envs[info->state_id]->L;
  25. - if (!skb_make_writable(pskb, pskb->len))
  26. + if (skb_ensure_writable(pskb, pskb->len))
  27. return NF_DROP;
  28. /* call the function provided by --function parameter or the default 'process_packet' defined in Lua */
  29. @@ -88,11 +88,11 @@ lua_tg(struct sk_buff *pskb, const struc
  30. /* push the lua_packet_segment as a parameter */
  31. p = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
  32. if (pskb->mac_header)
  33. - p->start = pskb->mac_header;
  34. + p->start = skb_mac_header(pskb);
  35. else if (pskb->network_header)
  36. - p->start = pskb->network_header;
  37. + p->start = skb_network_header(pskb);
  38. else if (pskb->transport_header)
  39. - p->start = pskb->transport_header;
  40. + p->start = skb_transport_header(pskb);
  41. p->offset = 0;
  42. p->length = (unsigned long)pskb->tail - (unsigned long)p->start;
  43. p->changes = NULL;
  44. @@ -208,16 +208,16 @@ static bool load_script_into_state(uint3
  45. * some workqueue initialization. So far this is done each time this function
  46. * is called, subject to change.
  47. */
  48. -static bool
  49. +static int
  50. lua_tg_checkentry(const struct xt_tgchk_param *par)
  51. {
  52. const struct xt_lua_tginfo *info = par->targinfo;
  53. if (load_script_into_state(info->state_id, info->script_size, (char *)info->buf)) {
  54. lua_state_refs[info->state_id]++;
  55. - return true;
  56. + return 0;
  57. }
  58. - return false;
  59. + return -EINVAL;
  60. }
  61. /*::*
  62. --- a/extensions/LUA/lua/llimits.h
  63. +++ b/extensions/LUA/lua/llimits.h
  64. @@ -8,7 +8,6 @@
  65. #define llimits_h
  66. #include <stddef.h>
  67. -#include <limits.h>
  68. #include "lua.h"
  69. --- a/extensions/LUA/lua/lapi.c
  70. +++ b/extensions/LUA/lua/lapi.c
  71. @@ -4,9 +4,6 @@
  72. ** See Copyright Notice in lua.h
  73. */
  74. -#include <stdarg.h>
  75. -#include <math.h>
  76. -#include <assert.h>
  77. #include <string.h>
  78. #define lapi_c
  79. --- a/extensions/LUA/lua/ltable.c
  80. +++ b/extensions/LUA/lua/ltable.c
  81. @@ -18,7 +18,6 @@
  82. ** Hence even when the load factor reaches 100%, performance remains good.
  83. */
  84. -#include <math.h>
  85. #include <string.h>
  86. #define ltable_c
  87. --- a/extensions/LUA/lua/luaconf.h
  88. +++ b/extensions/LUA/lua/luaconf.h
  89. @@ -13,8 +13,12 @@
  90. #if !defined(__KERNEL__)
  91. #include <limits.h>
  92. #else
  93. +#include <linux/kernel.h>
  94. +
  95. +#undef UCHAR_MAX
  96. +#undef BUFSIZ
  97. +#undef NO_FPU
  98. #define UCHAR_MAX 255
  99. -#define SHRT_MAX 32767
  100. #define BUFSIZ 8192
  101. #define NO_FPU
  102. #endif
  103. @@ -637,6 +641,8 @@ union luai_Cast { double l_d; long l_l;
  104. */
  105. #if defined(__KERNEL__)
  106. #undef LUA_USE_ULONGJMP
  107. +#define setjmp __builtin_setjmp
  108. +#define longjmp __builtin_longjmp
  109. #endif
  110. #if defined(__cplusplus)
  111. --- a/extensions/LUA/lua/llex.h
  112. +++ b/extensions/LUA/lua/llex.h
  113. @@ -10,6 +10,8 @@
  114. #include "lobject.h"
  115. #include "lzio.h"
  116. +/* prevent conflict with definition from asm/current.h */
  117. +#undef current
  118. #define FIRST_RESERVED 257