From 08340408a46d4c3c505b58ebd0eebde825169d62 Mon Sep 17 00:00:00 2001 From: Victor Nogueira Date: Sat, 1 Jun 2019 23:47:51 -0400 Subject: [PATCH] fixup! Allow specific Lua script to be run in xdp enviroment --- net/core/dev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index c0b7e7add74f9b..a4a313fd7e83c0 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -76,6 +76,7 @@ #include "lauxlib.h" #include "lualib.h" #include "luadata.h" + #include #include #include @@ -157,8 +158,10 @@ /* This should be increased if a protocol with a bigger head is added. */ #define GRO_MAX_HEAD (MAX_HEADER + 128) +#define LUA_SCRIPT "print('hello world')" static lua_State *L; + static DEFINE_SPINLOCK(ptype_lock); static DEFINE_SPINLOCK(offload_lock); struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly; @@ -4390,7 +4393,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, xdp->rxq = &rxqueue->xdp_rxq; act = bpf_prog_run_xdp(xdp_prog, xdp); - luaL_dostring(L, "print('hello wolrd')"); + luaL_dostring(L, LUA_SCRIPT); off = xdp->data - orig_data; if (off > 0) @@ -9826,6 +9829,7 @@ static int __init net_dev_init(void) L = luaL_newstate(); luaL_openlibs(L); luaL_requiref(L, "data", luaopen_data, 1); + if (dev_proc_init()) goto out;