[PATCH] iproute - Don't hardcode the path to config files
Denys Vlasenko
vda.linux at googlemail.com
Thu Oct 8 15:14:24 UTC 2015
Applied, thanks!
On Mon, Sep 21, 2015 at 2:52 PM, Tanguy Pruvot <tanguy.pruvot at gmail.com> wrote:
> http://review.cyanogenmod.org/#/c/106437/
>
> Author: Christoph J. Thompson <cjsthompson at gmail.com>
> Date: Thu Mar 1 06:44:43 2012 +0000
>
> iproute - Don't hardcode the path to config files
>
> Allows using an alternate path for config files.
>
> Change-Id: I6fb6b2d9a4b05a7dce145574760b2a4d442377f9
> Signed-off-by: Christoph J. Thompson <cjsthompson at gmail.com>
> Signed-off-by: Michael Bestas <mikeioannina at gmail.com>
> JIRA: CYAN-6759
>
> diff --git a/networking/Config.src b/networking/Config.src
> index ca0ddcd..76ea5c3 100644
> --- a/networking/Config.src
> +++ b/networking/Config.src
> @@ -534,6 +534,13 @@ config FEATURE_IP_ROUTE
> help
> 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
> bool "ip tunnel"
> default y
> diff --git a/networking/libiproute/rt_names.c
> b/networking/libiproute/rt_names.c
> index c474ab9..0d886ae 100644
> --- a/networking/libiproute/rt_names.c
> +++ b/networking/libiproute/rt_names.c
> @@ -10,6 +10,8 @@
> #include "libbb.h"
> #include "rt_names.h"
>
> +#define CONFDIR CONFIG_FEATURE_IP_ROUTE_DIR
> +
> typedef struct rtnl_tab_t {
> const char *cached_str;
> unsigned cached_result;
> @@ -85,7 +87,7 @@ static void rtnl_rtprot_initialize(void)
> return;
> rtnl_rtprot_tab = xzalloc(sizeof(*rtnl_rtprot_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);
> }
>
> const char* FAST_FUNC rtnl_rtprot_n2a(int id, char *buf)
> @@ -123,7 +125,7 @@ static void rtnl_rtscope_initialize(void)
> rtnl_rtscope_tab->tab[254] = "host";
> rtnl_rtscope_tab->tab[253] = "link";
> 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, char *buf)
> @@ -156,7 +158,7 @@ static void rtnl_rtrealm_initialize(void)
> if (rtnl_rtrealm_tab) return;
> rtnl_rtrealm_tab = xzalloc(sizeof(*rtnl_rtrealm_tab));
> 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)
> @@ -191,7 +193,7 @@ static void rtnl_rtdsfield_initialize(void)
> if (rtnl_rtdsfield_tab) return;
> rtnl_rtdsfield_tab = xzalloc(sizeof(*rtnl_rtdsfield_tab));
> 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, char *buf)
> @@ -228,7 +230,7 @@ static void rtnl_rttable_initialize(void)
> rtnl_rttable_tab->tab[255] = "local";
> rtnl_rttable_tab->tab[254] = "main";
> 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, char *buf)
>
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list