201-fix-lua-packetscript.patch 2.7 KB

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