summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--dissector_eth.c6
-rw-r--r--geoip.c14
-rw-r--r--oui.c2
-rw-r--r--trafgen_parser.y3
5 files changed, 14 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 87adcbb..4591806 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,7 @@ ifneq ($(wildcard /usr/include/linux/net_tstamp.h),)
CFLAGS += -D__WITH_HARDWARE_TIMESTAMPING
endif
CFLAGS += -DVERSION_STRING=\"$(VERSION_STRING)\"
+CFLAGS += -DPREFIX_STRING=\"$(PREFIX)\"
CFLAGS += -std=gnu99
WFLAGS = -Wall
diff --git a/dissector_eth.c b/dissector_eth.c
index f352645..0ac88af 100644
--- a/dissector_eth.c
+++ b/dissector_eth.c
@@ -118,15 +118,15 @@ static void dissector_init_ports(enum ports which)
switch (which) {
case PORTS_UDP:
- file = "/etc/netsniff-ng/udp.conf";
+ file = PREFIX_STRING "/etc/netsniff-ng/udp.conf";
table = &eth_ports_udp;
break;
case PORTS_TCP:
- file = "/etc/netsniff-ng/tcp.conf";
+ file = PREFIX_STRING "/etc/netsniff-ng/tcp.conf";
table = &eth_ports_tcp;
break;
case PORTS_ETHER:
- file = "/etc/netsniff-ng/ether.conf";
+ file = PREFIX_STRING "/etc/netsniff-ng/ether.conf";
table = &eth_ether_types;
break;
default:
diff --git a/geoip.c b/geoip.c
index 9d2e82c..c4c6cf8 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 = "/etc/netsniff-ng/city4.dat",
+ .local = PREFIX_STRING "/etc/netsniff-ng/city4.dat",
.remote = "/GeoLiteCity.dat.gz",
.possible_prefix = PRE,
},
[GEOIP_CITY_EDITION_REV1_V6] = {
.desc = "City IPv6",
- .local = "/etc/netsniff-ng/city6.dat",
+ .local = PREFIX_STRING "/etc/netsniff-ng/city6.dat",
.remote = "/GeoLiteCityv6.dat.gz",
.possible_prefix = PRE "/GeoLiteCityv6-beta",
},
[GEOIP_COUNTRY_EDITION] = {
.desc = "Country IPv4",
- .local = "/etc/netsniff-ng/country4.dat",
+ .local = PREFIX_STRING "/etc/netsniff-ng/country4.dat",
.remote = "/GeoIP.dat.gz",
.possible_prefix = PRE "/GeoLiteCountry",
},
[GEOIP_COUNTRY_EDITION_V6] = {
.desc = "Country IPv6",
- .local = "/etc/netsniff-ng/country6.dat",
+ .local = PREFIX_STRING "/etc/netsniff-ng/country6.dat",
.remote = "/GeoIPv6.dat.gz",
.possible_prefix = PRE,
},
[GEOIP_ASNUM_EDITION] = {
.desc = "AS Numbers IPv4",
- .local = "/etc/netsniff-ng/asname4.dat",
+ .local = PREFIX_STRING "/etc/netsniff-ng/asname4.dat",
.remote = "/GeoIPASNum.dat.gz",
.possible_prefix = PRE "/asnum",
},
[GEOIP_ASNUM_EDITION_V6] = {
.desc = "AS Numbers IPv6",
- .local = "/etc/netsniff-ng/asname6.dat",
+ .local = PREFIX_STRING "/etc/netsniff-ng/asname6.dat",
.remote = "/GeoIPASNumv6.dat.gz",
.possible_prefix = PRE "/asnum",
},
@@ -520,7 +520,7 @@ static void init_mirrors(void)
FILE *fp;
char buff[256];
- fp = fopen("/etc/netsniff-ng/geoip.conf", "r");
+ fp = fopen(PREFIX_STRING "/etc/netsniff-ng/geoip.conf", "r");
if (!fp)
panic("Cannot open geoip.conf!\n");
diff --git a/oui.c b/oui.c
index 66d7aa4..e735c15 100644
--- a/oui.c
+++ b/oui.c
@@ -43,7 +43,7 @@ void dissector_init_oui(void)
if (initialized)
return;
- fp = fopen("/etc/netsniff-ng/oui.conf", "r");
+ fp = fopen(PREFIX_STRING "/etc/netsniff-ng/oui.conf", "r");
if (!fp)
panic("No oui.conf found!\n");
diff --git a/trafgen_parser.y b/trafgen_parser.y
index ece3b25..9d2dd09 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -576,7 +576,8 @@ int compile_packets(char *file, int verbose, int cpu, bool invoke_cpp)
base = basename((b = xstrdup(file)));
slprintf(tmp_file, sizeof(tmp_file), "%s/.tmp-%u-%s", dir, rand(), base);
- slprintf(cmd, sizeof(cmd), "cpp -I/etc/netsniff-ng/ %s > %s", file, tmp_file);
+ slprintf(cmd, sizeof(cmd), "cpp -I" PREFIX_STRING
+ "/etc/netsniff-ng/ %s > %s", file, tmp_file);
system(cmd);
file = tmp_file;