iproute: don't hardcode the path to config files
Allows using an alternate path for config files. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Christoph J. Thompson <cjsthompson@gmail.com> Signed-off-by: Michael Bestas <mikeioannina@gmail.com>
This commit is contained in:
parent
413feca279
commit
d1eea8db92
@ -533,6 +533,13 @@ config FEATURE_IP_ROUTE
|
|||||||
help
|
help
|
||||||
Add support for routing table management to "ip".
|
Add support for routing table management to "ip".
|
||||||
|
|
||||||
|
config FEATURE_IP_ROUTE_DIR
|
||||||
|
string "ip route configuration directory"
|
||||||
|
default "/etc/iproute2"
|
||||||
|
depends on FEATURE_IP_ROUTE
|
||||||
|
help
|
||||||
|
Location of the "ip" applet routing configuration.
|
||||||
|
|
||||||
config FEATURE_IP_TUNNEL
|
config FEATURE_IP_TUNNEL
|
||||||
bool "ip tunnel"
|
bool "ip tunnel"
|
||||||
default y
|
default y
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
#include "rt_names.h"
|
#include "rt_names.h"
|
||||||
|
|
||||||
|
#define CONFDIR CONFIG_FEATURE_IP_ROUTE_DIR
|
||||||
|
|
||||||
typedef struct rtnl_tab_t {
|
typedef struct rtnl_tab_t {
|
||||||
const char *cached_str;
|
const char *cached_str;
|
||||||
unsigned cached_result;
|
unsigned cached_result;
|
||||||
@ -92,7 +94,7 @@ static void rtnl_rtprot_initialize(void)
|
|||||||
return;
|
return;
|
||||||
rtnl_rtprot_tab = xzalloc(sizeof(*rtnl_rtprot_tab));
|
rtnl_rtprot_tab = xzalloc(sizeof(*rtnl_rtprot_tab));
|
||||||
memcpy(rtnl_rtprot_tab->tab, init_tab, sizeof(init_tab));
|
memcpy(rtnl_rtprot_tab->tab, init_tab, sizeof(init_tab));
|
||||||
rtnl_tab_initialize("/etc/iproute2/rt_protos", rtnl_rtprot_tab->tab);
|
rtnl_tab_initialize(CONFDIR "/rt_protos", rtnl_rtprot_tab->tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
@ -129,7 +131,7 @@ static void rtnl_rtscope_initialize(void)
|
|||||||
rtnl_rtscope_tab->tab[254] = "host";
|
rtnl_rtscope_tab->tab[254] = "host";
|
||||||
rtnl_rtscope_tab->tab[253] = "link";
|
rtnl_rtscope_tab->tab[253] = "link";
|
||||||
rtnl_rtscope_tab->tab[200] = "site";
|
rtnl_rtscope_tab->tab[200] = "site";
|
||||||
rtnl_tab_initialize("/etc/iproute2/rt_scopes", rtnl_rtscope_tab->tab);
|
rtnl_tab_initialize(CONFDIR "/rt_scopes", rtnl_rtscope_tab->tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* FAST_FUNC rtnl_rtscope_n2a(int id)
|
const char* FAST_FUNC rtnl_rtscope_n2a(int id)
|
||||||
@ -159,7 +161,7 @@ static void rtnl_rtrealm_initialize(void)
|
|||||||
if (rtnl_rtrealm_tab) return;
|
if (rtnl_rtrealm_tab) return;
|
||||||
rtnl_rtrealm_tab = xzalloc(sizeof(*rtnl_rtrealm_tab));
|
rtnl_rtrealm_tab = xzalloc(sizeof(*rtnl_rtrealm_tab));
|
||||||
rtnl_rtrealm_tab->tab[0] = "unknown";
|
rtnl_rtrealm_tab->tab[0] = "unknown";
|
||||||
rtnl_tab_initialize("/etc/iproute2/rt_realms", rtnl_rtrealm_tab->tab);
|
rtnl_tab_initialize(CONFDIR "/rt_realms", rtnl_rtrealm_tab->tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FAST_FUNC rtnl_rtrealm_a2n(uint32_t *id, char *arg)
|
int FAST_FUNC rtnl_rtrealm_a2n(uint32_t *id, char *arg)
|
||||||
@ -191,7 +193,7 @@ static void rtnl_rtdsfield_initialize(void)
|
|||||||
if (rtnl_rtdsfield_tab) return;
|
if (rtnl_rtdsfield_tab) return;
|
||||||
rtnl_rtdsfield_tab = xzalloc(sizeof(*rtnl_rtdsfield_tab));
|
rtnl_rtdsfield_tab = xzalloc(sizeof(*rtnl_rtdsfield_tab));
|
||||||
rtnl_rtdsfield_tab->tab[0] = "0";
|
rtnl_rtdsfield_tab->tab[0] = "0";
|
||||||
rtnl_tab_initialize("/etc/iproute2/rt_dsfield", rtnl_rtdsfield_tab->tab);
|
rtnl_tab_initialize(CONFDIR "/rt_dsfield", rtnl_rtdsfield_tab->tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* FAST_FUNC rtnl_dsfield_n2a(int id)
|
const char* FAST_FUNC rtnl_dsfield_n2a(int id)
|
||||||
@ -227,7 +229,7 @@ static void rtnl_rttable_initialize(void)
|
|||||||
rtnl_rttable_tab->tab[255] = "local";
|
rtnl_rttable_tab->tab[255] = "local";
|
||||||
rtnl_rttable_tab->tab[254] = "main";
|
rtnl_rttable_tab->tab[254] = "main";
|
||||||
rtnl_rttable_tab->tab[253] = "default";
|
rtnl_rttable_tab->tab[253] = "default";
|
||||||
rtnl_tab_initialize("/etc/iproute2/rt_tables", rtnl_rttable_tab->tab);
|
rtnl_tab_initialize(CONFDIR "/rt_tables", rtnl_rttable_tab->tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* FAST_FUNC rtnl_rttable_n2a(int id)
|
const char* FAST_FUNC rtnl_rttable_n2a(int id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user