1 From d8d8dd628302f5bde4f55f11137690bf40abaa88 Mon Sep 17 00:00:00 2001
2 From: Christian Hesse <mail@eworm.de>
3 Date: Thu, 28 Jul 2016 08:49:20 +0200
4 Subject: [PATCH 1/1] make iproute2 fhs compliant
8 netem/Makefile | 4 ++--
10 tc/tc_util.c | 15 +++++++++++++++
12 5 files changed, 20 insertions(+), 4 deletions(-)
14 diff --git a/Makefile b/Makefile
15 index f6214534..f80f46c9 100644
18 @@ -32,7 +32,7 @@ DBM_INCLUDE:=$(DESTDIR)/usr/include
22 -DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
23 +DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" -DDATADIR=\"$(DATADIR)\"
24 ifneq ($(SHARED_LIBS),y)
25 DEFINES+= -DNO_SHARED_LIBS
27 diff --git a/netem/Makefile b/netem/Makefile
28 index ba4c5a76..cb197afa 100644
31 @@ -23,9 +23,9 @@ stats: stats.c
32 $(HOSTCC) $(CCOPTS) -I../include -o $@ $@.c -lm
35 - mkdir -p $(DESTDIR)$(LIBDIR)/tc
36 + mkdir -p $(DESTDIR)$(DATADIR)/tc
37 for i in $(DISTDATA); \
38 - do install -m 644 $$i $(DESTDIR)$(LIBDIR)/tc; \
39 + do install -m 644 $$i $(DESTDIR)$(DATADIR)/tc; \
43 diff --git a/tc/q_netem.c b/tc/q_netem.c
44 index f45a64b9..83fa952d 100644
47 @@ -128,7 +128,7 @@ static int get_distribution(const char *type, __s16 *data, int maxdata)
51 - snprintf(name, sizeof(name), "%s/%s.dist", get_tc_lib(), type);
52 + snprintf(name, sizeof(name), "%s/%s.dist", get_tc_datadir(), type);
55 fprintf(stderr, "No distribution data for %s (%s: %s)\n",
56 diff --git a/tc/tc_util.c b/tc/tc_util.c
57 index ba34aed7..0adbb9ba 100644
61 #define LIBDIR "/usr/lib"
65 +#define DATADIR "/usr/share"
68 static struct db_names *cls_names;
70 #define NAMES_DB "/etc/iproute2/tc_cls"
71 @@ -72,6 +76,17 @@ const char *get_tc_lib(void)
75 +const char *get_tc_datadir(void)
77 + const char *data_dir;
79 + data_dir = getenv("TC_DATA_DIR");
81 + data_dir = DATADIR "/tc/";
86 int get_qdisc_handle(__u32 *h, const char *str)
89 diff --git a/tc/tc_util.h b/tc/tc_util.h
90 index b197bcdd..e812b895 100644
93 @@ -71,6 +71,7 @@ struct exec_util {
96 const char *get_tc_lib(void);
97 +const char *get_tc_datadir(void);
99 struct qdisc_util *get_qdisc_kind(const char *str);
100 struct filter_util *get_filter_kind(const char *str);