summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cmds2
-rw-r--r--Makefile3
-rw-r--r--geoip.c18
3 files changed, 14 insertions, 9 deletions
diff --git a/Cmds b/Cmds
index 1b2719a..e841d26 100644
--- a/Cmds
+++ b/Cmds
@@ -37,6 +37,8 @@ endif
INST = echo -e " INST\t$(1)" && install -d $(2) && \
install --mode=644 -DC $(1) $(2)/$(shell basename $(1))
+INSTD = echo -e " INSTD\t$(1)" && install -d $(1)
+
# Determine wheter origin of PREFIX is "file" or "command line"
ifeq ("$(origin PREFIX)", "$(filter $(origin PREFIX), file command line)")
INSTX = echo -e " INST\t$(1)" && install -d $(2) && \
diff --git a/Makefile b/Makefile
index aba2983..59d79ac 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,7 @@ SBINDIR = $(PREFIX)/sbin
INCDIR = $(PREFIX)/include
ETCDIR ?= $(CONFIG_ETCDIR)
ETCDIRE = $(ETCDIR)/netsniff-ng
+DATDIR = $(PREFIX)/share/netsniff-ng
MAN8DIR = $(PREFIX)/share/man/man8
# Shut up make, helper warnings, parallel compilation!
@@ -102,6 +103,7 @@ CFLAGS_MIN += -D_FILE_OFFSET_BITS=64
CFLAGS_MIN += -DVERSION_STRING=\"$(VERSION_STRING)\"
CFLAGS_MIN += -DVERSION_LONG=\"$(VERSION_LONG)\"
CFLAGS_MIN += -DETCDIRE_STRING=\"$(ETCDIRE)\"
+CFLAGS_MIN += -DDATDIR_STRING=\"$(DATDIR)\"
WFLAGS_DEF = -Wall
@@ -170,6 +172,7 @@ mrproper: distclean
install: install_all
install_all: $(foreach tool,$(TOOLS),$(tool)_install)
+ $(Q)$(call INSTD,$(DATDIR))
install_allbutcurvetun: $(foreach tool,$(filter-out curvetun,$(TOOLS)),$(tool)_install)
install_allbutmausezahn: $(foreach tool,$(filter-out mausezahn,$(TOOLS)),$(tool)_install)
uninstall: $(foreach tool,$(TOOLS),$(tool)_uninstall)
diff --git a/geoip.c b/geoip.c
index d95305c..edf1497 100644
--- a/geoip.c
+++ b/geoip.c
@@ -33,37 +33,37 @@ struct file {
static const struct file files[] = {
[GEOIP_CITY_EDITION_REV1] = {
.desc = "City IPv4",
- .local = ETCDIRE_STRING "/city4.dat",
+ .local = DATDIR_STRING "/city4.dat",
.remote = "/GeoLiteCity.dat.gz",
.possible_prefix = PRE,
},
[GEOIP_CITY_EDITION_REV1_V6] = {
.desc = "City IPv6",
- .local = ETCDIRE_STRING "/city6.dat",
+ .local = DATDIR_STRING "/city6.dat",
.remote = "/GeoLiteCityv6.dat.gz",
.possible_prefix = PRE "/GeoLiteCityv6-beta",
},
[GEOIP_COUNTRY_EDITION] = {
.desc = "Country IPv4",
- .local = ETCDIRE_STRING "/country4.dat",
+ .local = DATDIR_STRING "/country4.dat",
.remote = "/GeoIP.dat.gz",
.possible_prefix = PRE "/GeoLiteCountry",
},
[GEOIP_COUNTRY_EDITION_V6] = {
.desc = "Country IPv6",
- .local = ETCDIRE_STRING "/country6.dat",
+ .local = DATDIR_STRING "/country6.dat",
.remote = "/GeoIPv6.dat.gz",
.possible_prefix = PRE,
},
[GEOIP_ASNUM_EDITION] = {
.desc = "AS Numbers IPv4",
- .local = ETCDIRE_STRING "/asname4.dat",
+ .local = DATDIR_STRING "/asname4.dat",
.remote = "/GeoIPASNum.dat.gz",
.possible_prefix = PRE "/asnum",
},
[GEOIP_ASNUM_EDITION_V6] = {
.desc = "AS Numbers IPv6",
- .local = ETCDIRE_STRING "/asname6.dat",
+ .local = DATDIR_STRING "/asname6.dat",
.remote = "/GeoIPASNumv6.dat.gz",
.possible_prefix = PRE "/asnum",
},
@@ -627,19 +627,19 @@ static void init_mirrors(void)
if (!fp)
panic("Cannot open geoip.conf!\n");
- fmemset(buff, 0, sizeof(buff));
+ memset(buff, 0, sizeof(buff));
while (fgets(buff, sizeof(buff), fp) != NULL &&
i < array_size(servers)) {
buff[sizeof(buff) - 1] = 0;
buff[strlen(buff) - 1] = 0;
if (buff[0] == '#') {
- fmemset(buff, 0, sizeof(buff));
+ memset(buff, 0, sizeof(buff));
continue;
}
servers[i++] = xstrdup(buff);
- fmemset(buff, 0, sizeof(buff));
+ memset(buff, 0, sizeof(buff));
}
fclose(fp);