Skip to content
forked from cujoai/nflua

Netfilter binding for Lua

License

Notifications You must be signed in to change notification settings

luainkernel/nflua

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copyright (C) 2017-2019 CUJO LLC

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


NFLua

User Space Libraries

First build lua-memory:

make -C deps/lua-memory/src linux CFLAGS="-I/usr/include/lua -fPIC"
rm -f deps/lua-memory/src/*.o

The step above does not use make to avoid temporary files that would then be reused in the kernel module compilation below, leading to errors. Then build NFLua:

make -C lib/
make -C lua/
make -C iptables/

Kernel Module

In order to build NFLua follow the instruction in section 2 of Building External Modules.

You must declare the following parameters in your make invocation:

CONFIG_LUNATIK=m
CONFIG_LUAMEMORY=m
CONFIG_LUAJSON=m
CONFIG_LUABASE64=m
CONFIG_NFLUA=m

An example of the invocation:

make -C /usr/src/linux-headers-`uname -r` M=$PWD \
CONFIG_LUNATIK=m \
CONFIG_LUAMEMORY=m \
CONFIG_LUAJSON=m \
CONFIG_LUABASE64=m \
CONFIG_NFLUA=m \
modules

To load NFLua and its dependencies:

sudo modprobe nf_conntrack
sudo insmod ./deps/lunatik/lunatik.ko
sudo insmod ./deps/luabase64/luabase64.ko
sudo insmod ./deps/lua-memory/lua-memory.ko
sudo insmod ./deps/luajson/luajson.ko
sudo insmod ./src/nflua.ko

To remove NFLua and its dependencies:

sudo rmmod nflua luajson lua-memory luabase64 lunatik

Running the Tests

sudo LD_LIBRARY_PATH=./lib:./deps/lua-memory/src LUA_CPATH='./lua/?.so;;' \
    XTABLES_LIBDIR=./iptables:/usr/lib/x86_64-linux-gnu/xtables \
    lua tests/all.lua

About

Netfilter binding for Lua

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 74.1%
  • Lua 22.1%
  • Makefile 2.4%
  • Other 1.4%