kernel: add some fixes for kernel 3.9
[openwrt.git] / package / network / utils / xtables-addons / patches / 201-fix-lua-packetscript.patch
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  
7 -spinlock_t lock = SPIN_LOCK_UNLOCKED;
8 +DEFINE_SPINLOCK(lock);
9  
10  static uint32_t 
11 -lua_tg(struct sk_buff *pskb, const struct xt_target_param *par)
12 +lua_tg(struct sk_buff *pskb, const struct xt_action_param *par)
13  {
14         uint32_t  verdict;
15         lua_packet_segment *p;
16 @@ -208,16 +208,16 @@ static bool load_script_into_state(uint3
17   * some workqueue initialization. So far this is done each time this function
18   * is called, subject to change.
19   */
20 -static bool
21 +static int
22  lua_tg_checkentry(const struct xt_tgchk_param *par)
23  {
24         const struct xt_lua_tginfo *info = par->targinfo;
25  
26         if (load_script_into_state(info->state_id, info->script_size, (char *)info->buf)) {
27                 lua_state_refs[info->state_id]++;
28 -               return true;
29 +               return 0;
30         }
31 -       return false;
32 +       return -EINVAL;
33  }
34  
35  /*::*
36 --- a/extensions/LUA/lua/llimits.h
37 +++ b/extensions/LUA/lua/llimits.h
38 @@ -8,7 +8,6 @@
39  #define llimits_h
40  
41  #include <stddef.h>
42 -#include <limits.h>
43  
44  #include "lua.h"
45  
46 --- a/extensions/LUA/lua/lapi.c
47 +++ b/extensions/LUA/lua/lapi.c
48 @@ -4,9 +4,6 @@
49  ** See Copyright Notice in lua.h
50  */
51  
52 -#include <stdarg.h>
53 -#include <math.h>
54 -#include <assert.h>
55  #include <string.h>
56  
57  #define lapi_c
58 --- a/extensions/LUA/lua/ltable.c
59 +++ b/extensions/LUA/lua/ltable.c
60 @@ -18,7 +18,6 @@
61  ** Hence even when the load factor reaches 100%, performance remains good.
62  */
63  
64 -#include <math.h>
65  #include <string.h>
66  
67  #define ltable_c
68 --- a/extensions/LUA/lua/luaconf.h
69 +++ b/extensions/LUA/lua/luaconf.h
70 @@ -13,6 +13,10 @@
71  #if !defined(__KERNEL__)
72  #include <limits.h>
73  #else
74 +#undef UCHAR_MAX
75 +#undef SHRT_MAX
76 +#undef BUFSIZ
77 +#undef NO_FPU
78  #define UCHAR_MAX      255
79  #define SHRT_MAX        32767
80  #define BUFSIZ                 8192
81 @@ -637,6 +641,8 @@ union luai_Cast { double l_d; long l_l;
82  */
83  #if defined(__KERNEL__)
84  #undef LUA_USE_ULONGJMP
85 +#define setjmp __builtin_setjmp
86 +#define longjmp __builtin_longjmp
87  #endif
88  
89  #if defined(__cplusplus)