libs: add luci-lib-ip

Add new luci.ip library which is an api compatible C reimplementation
of ip.lua. It also supports dumping the system routing table and neighbour
entry database via netlink.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2015-01-22 14:59:13 +01:00
parent 390c4bd5a7
commit 0ff02e3a13
3 changed files with 1256 additions and 0 deletions

14
libs/luci-lib-ip/Makefile Normal file
View file

@ -0,0 +1,14 @@
#
# Copyright (C) 2015 LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Lua library for IP calculation and routing information
LUCI_DEPENDS:=+liblua +libnl-tiny
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -0,0 +1,17 @@
IP_CFLAGS = -std=gnu99 -I$(STAGING_DIR)/usr/include/libnl-tiny/
IP_LDFLAGS = -llua -lm -lnl-tiny
IP_OBJ = ip.o
IP_LIB = ip.so
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LUA_CFLAGS) $(IP_CFLAGS) $(FPIC) -c -o $@ $<
compile: $(IP_OBJ)
$(CC) $(LDFLAGS) -shared -o $(IP_LIB) $(IP_OBJ) $(IP_LDFLAGS)
install: compile
mkdir -p $(DESTDIR)/usr/lib/lua/luci
cp $(IP_LIB) $(DESTDIR)/usr/lib/lua/luci/$(IP_LIB)
clean:
rm -f *.o *.so

1225
libs/luci-lib-ip/src/ip.c Normal file

File diff suppressed because it is too large Load diff