All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph J. Thompson" <cjsthompson@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH 1/4] iproute2 - Don't hardcode the path to config files. Allows using an alternate path for config files.
Date: Thu, 1 Mar 2012 17:44:43 +0100	[thread overview]
Message-ID: <20120301164439.GA24257@gmail.com> (raw)

	modified:   lib/rt_names.c

Signed-off-by: Christoph J. Thompson <cjsthompson@gmail.com>
---
 lib/rt_names.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/rt_names.c b/lib/rt_names.c
index a290021..52ecdb2 100644
--- a/lib/rt_names.c
+++ b/lib/rt_names.c
@@ -23,6 +23,10 @@
 
 #include "rt_names.h"
 
+#ifndef CONFDIR
+#define CONFDIR "/etc/iproute2"
+#endif
+
 struct rtnl_hash_entry {
 	struct rtnl_hash_entry *next;
 	char *			name;
@@ -129,7 +133,7 @@ static int rtnl_rtprot_init;
 static void rtnl_rtprot_initialize(void)
 {
 	rtnl_rtprot_init = 1;
-	rtnl_tab_initialize("/etc/iproute2/rt_protos",
+	rtnl_tab_initialize(CONFDIR "/rt_protos",
 			    rtnl_rtprot_tab, 256);
 }
 
@@ -196,7 +200,7 @@ static void rtnl_rtscope_initialize(void)
 	rtnl_rtscope_tab[254] = "host";
 	rtnl_rtscope_tab[253] = "link";
 	rtnl_rtscope_tab[200] = "site";
-	rtnl_tab_initialize("/etc/iproute2/rt_scopes",
+	rtnl_tab_initialize(CONFDIR "/rt_scopes",
 			    rtnl_rtscope_tab, 256);
 }
 
@@ -259,7 +263,7 @@ static int rtnl_rtrealm_init;
 static void rtnl_rtrealm_initialize(void)
 {
 	rtnl_rtrealm_init = 1;
-	rtnl_tab_initialize("/etc/iproute2/rt_realms",
+	rtnl_tab_initialize(CONFDIR "/rt_realms",
 			    rtnl_rtrealm_tab, 256);
 }
 
@@ -328,7 +332,7 @@ static int rtnl_rttable_init;
 static void rtnl_rttable_initialize(void)
 {
 	rtnl_rttable_init = 1;
-	rtnl_hash_initialize("/etc/iproute2/rt_tables",
+	rtnl_hash_initialize(CONFDIR "/rt_tables",
 			     rtnl_rttable_hash, 256);
 }
 
@@ -396,7 +400,7 @@ static int rtnl_rtdsfield_init;
 static void rtnl_rtdsfield_initialize(void)
 {
 	rtnl_rtdsfield_init = 1;
-	rtnl_tab_initialize("/etc/iproute2/rt_dsfield",
+	rtnl_tab_initialize(CONFDIR "/rt_dsfield",
 			    rtnl_rtdsfield_tab, 256);
 }
 
-- 
1.7.4.4


-- 
Jabber: heimdal@jabber.org

                 reply	other threads:[~2012-03-01 16:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120301164439.GA24257@gmail.com \
    --to=cjsthompson@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.