diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-11-07 01:12:05 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-11-07 01:12:05 +0200 |
commit | 660b77270e599fed9a8a6bc94a0e2d44b8f282dd (patch) | |
tree | ba2a630e6365e96c7ec5a43bfde757a870c99a5e /src | |
parent | 25593b5e6fea76ed7c08db586924032c0810c27e (diff) | |
download | squark-660b77270e599fed9a8a6bc94a0e2d44b8f282dd.tar.bz2 squark-660b77270e599fed9a8a6bc94a0e2d44b8f282dd.tar.xz |
build: use build system from apk-tools/opennhrp
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 43 | ||||
-rw-r--r-- | src/authdb.c | 2 | ||||
-rw-r--r-- | src/blob.c | 1 | ||||
-rw-r--r-- | src/squark-auth-snmp.c | 8 | ||||
-rw-r--r-- | src/squark-filter.c | 2 |
5 files changed, 28 insertions, 28 deletions
diff --git a/src/Makefile b/src/Makefile index db683a2..5863414 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,30 +1,25 @@ -TARGETS=squark-auth-snmp squark-auth-ip squark-filter squarkdb.so +progs-y += squark-filter squark-auth-snmp squark-auth-ip +shlibs-y += squarkdb.so +scripts-y += sqdb-build.lua -NETSNMP_CFLAGS:=$(shell net-snmp-config --cflags) -NETSNMP_LIBS:=$(shell net-snmp-config --libs) -LUA_CFLAGS:=$(shell pkg-config --cflags lua5.1) -LUA_LIBS:=$(shell pkg-config --libs lua5.1) -CMPH_CFLAGS:=$(shell pkg-config --cflags cmph) -CMPH_LIBS:=$(shell pkg-config --libs cmph) +common-objs += filterdb.o authdb.o blob.o addr.o -CC=gcc -CFLAGS=-g -I. $(NETSNMP_CFLAGS) $(LUA_CFLAGS) $(CMPH_CFLAGS) -std=gnu99 -D_GNU_SOURCE -Wall -LIBS+=-lrt +squark-filter-objs += squark-filter.o $(common-objs) +squark-auth-snmp-objs += squark-auth-snmp.o $(common-objs) +squark-auth-ip-objs += squark-auth-ip.o $(common-objs) +squarkdb.so-objs += lua-squarkdb.o filterdb.o blob.o -all: $(TARGETS) +CFLAGS += -DSQUARK_VERSION=\"$(FULL_VERSION)\" +LIBS += -lrt -squark-auth-snmp: squark-auth-snmp.o filterdb.o authdb.o blob.o addr.o - $(CC) -o $@ $^ $(NETSNMP_LIBS) $(LIBS) +CFLAGS_lua-squarkdb.o += $(shell pkg-config --cflags lua5.1) +LIBS_squark-filter += $(shell pkg-config --libs cmph) +LIBS_squark-auth-snmp += $(shell net-snmp-config --libs) +LIBS_squarkdb.so += $(shell pkg-config --libs lua5.1) -squark-auth-ip: squark-auth-ip.o filterdb.o authdb.o blob.o addr.o - $(CC) -o $@ $^ $(LIBS) - -squark-filter: squark-filter.o filterdb.o authdb.o blob.o addr.o - $(CC) -o $@ $^ $(CMPH_LIBS) $(LIBS) - -squarkdb.so: lua-squarkdb.o filterdb.o blob.o - $(CC) -shared -o $@ $^ $(LUA_LIBS) $(CMPH_LIBS) $(LIBS) - -clean: - rm $(OBJS1) $(TARGETS) +install: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALL) $(addprefix $(obj)/,$(progs-y) $(scripts-y)) $(DESTDIR)$(BINDIR) + $(INSTALLDIR) $(DESTDIR)$(LUALIBDIR) + $(INSTALL) $(addprefix $(obj)/,$(shlibs-y)) $(DESTDIR)$(LUALIBDIR)
\ No newline at end of file diff --git a/src/authdb.c b/src/authdb.c index e6e71c4..85fb44e 100644 --- a/src/authdb.c +++ b/src/authdb.c @@ -361,4 +361,6 @@ int adbc_refresh(struct authdb_config *cfg, time_t now) cfg->block_categories |= cfg->hard_block_categories; fclose(in); + + return 1; } @@ -1,6 +1,7 @@ #include <time.h> #include <ctype.h> #include <string.h> +#include <arpa/inet.h> #include "blob.h" diff --git a/src/squark-auth-snmp.c b/src/squark-auth-snmp.c index 81b846d..aa45c73 100644 --- a/src/squark-auth-snmp.c +++ b/src/squark-auth-snmp.c @@ -389,10 +389,10 @@ void link_switch(const char *a, int ap, const char *b, int bp) struct switch_port_info *spia, *spib; sockaddr_any addr; - sia = get_switch(addr_parse(BLOB_STRLEN(a), &addr)); + sia = get_switch(addr_parse(BLOB_STRLEN((char *) a), &addr)); spia = get_switch_port(sia, ap); - sib = get_switch(addr_parse(BLOB_STRLEN(b), &addr)); + sib = get_switch(addr_parse(BLOB_STRLEN((char *) b), &addr)); spib = get_switch_port(sib, bp); addr_copy(&spia->link_partner, &sib->addr); @@ -1110,9 +1110,9 @@ int main(int argc, char **argv) if (l2_root == NULL) l2_root = l3_root; - l3_root_dev = get_switch(addr_parse(BLOB_STRLEN(l3_root), &addr)); + l3_root_dev = get_switch(addr_parse(BLOB_STRLEN((char *) l3_root), &addr)); l3_if_ndx = resolve_ifName2ifIndex(l3_root_dev, BLOB_STRLEN((char *) l3_ifname)); - l2_root_dev = get_switch(addr_parse(BLOB_STRLEN(l2_root), &addr)); + l2_root_dev = get_switch(addr_parse(BLOB_STRLEN((char *) l2_root), &addr)); l2_vlan_ndx = atoi(l2_vlan); username_format_flags = parse_format(username_format); diff --git a/src/squark-filter.c b/src/squark-filter.c index 995da40..14515cf 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -183,6 +183,7 @@ error: return 0; } +#if 0 static void url_print(struct url_info *nfo) { #define print_field(nfo, x) if (!blob_is_null(nfo->x)) printf(" %s{%.*s}", #x, nfo->x.len, nfo->x.ptr) @@ -198,6 +199,7 @@ static void url_print(struct url_info *nfo) printf("\n"); fflush(stdout); } +#endif static int url_classify(struct url_info *url, struct sqdb *db) { |