diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-03-16 18:09:04 +0100 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-03-16 18:09:04 +0100 |
commit | f66b9f147ecf5db067e36719784a552a5909b3fc (patch) | |
tree | c68a61cb9bb84649b40977ab0e45455211905bad | |
parent | 4262e95c1c0a09c7f98ea6623d364bfda41e8bec (diff) |
build: respect PREFIX_STRING on config file locations
When setting a prefix from the build system, also pass this through the
hard coded strings for config file locations in the toolkit, so that the
installed files (which use PREFIX) can be properly found.
Suggested-by: Peter Stuge <peter@stuge.se>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | dissector_eth.c | 6 | ||||
-rw-r--r-- | geoip.c | 14 | ||||
-rw-r--r-- | oui.c | 2 | ||||
-rw-r--r-- | trafgen_parser.y | 3 |
5 files changed, 14 insertions, 12 deletions
@@ -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 = ð_ports_udp; break; case PORTS_TCP: - file = "/etc/netsniff-ng/tcp.conf"; + file = PREFIX_STRING "/etc/netsniff-ng/tcp.conf"; table = ð_ports_tcp; break; case PORTS_ETHER: - file = "/etc/netsniff-ng/ether.conf"; + file = PREFIX_STRING "/etc/netsniff-ng/ether.conf"; table = ð_ether_types; break; default: @@ -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"); @@ -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; |