Skip to content

Commit

Permalink
fixup! Allow specific Lua script to be run in xdp enviroment
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorNogueiraRio committed Jun 5, 2019
1 parent 07cbb93 commit 0834040
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#include "lauxlib.h"
#include "lualib.h"
#include "luadata.h"

#include <linux/uaccess.h>
#include <linux/bitops.h>
#include <linux/capability.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 0834040

Please sign in to comment.