ctx = uci_alloc_context();
uci_ctx = ctx;
+ if (config_path)
+ uci_set_confdir(ctx, config_path);
+
#ifdef DUMMY_MODE
- uci_set_confdir(ctx, "./config");
uci_set_savedir(ctx, "./tmp");
#endif
} else {
unsigned int debug_mask = 0;
const char *main_path = DEFAULT_MAIN_PATH;
+const char *config_path = DEFAULT_CONFIG_PATH;
const char *resolv_conf = DEFAULT_RESOLV_CONF;
static char **global_argv;
" -d <mask>: Mask for debug messages\n"
" -s <path>: Path to the ubus socket\n"
" -p <path>: Path to netifd addons (default: %s)\n"
+ " -c <path>: Path to UCI configuration\n"
" -h <path>: Path to the hotplug script\n"
" -r <path>: Path to resolv.conf\n"
" -l <level>: Log output level (default: %d)\n"
global_argv = argv;
- while ((ch = getopt(argc, argv, "d:s:p:h:r:l:S")) != -1) {
+ while ((ch = getopt(argc, argv, "d:s:p:c:h:r:l:S")) != -1) {
switch(ch) {
case 'd':
debug_mask = strtoul(optarg, NULL, 0);
case 'p':
main_path = optarg;
break;
+ case 'c':
+ config_path = optarg;
+ break;
case 'h':
hotplug_cmd_path = optarg;
break;
#ifdef DUMMY_MODE
#define DEFAULT_MAIN_PATH "./examples"
+#define DEFAULT_CONFIG_PATH "./config"
#define DEFAULT_HOTPLUG_PATH "./examples/hotplug-cmd"
#define DEFAULT_RESOLV_CONF "./tmp/resolv.conf"
#else
#define DEFAULT_MAIN_PATH "/lib/netifd"
+#define DEFAULT_CONFIG_PATH NULL /* use the default set in libuci */
#define DEFAULT_HOTPLUG_PATH "/sbin/hotplug-call"
#define DEFAULT_RESOLV_CONF "/tmp/resolv.conf.auto"
#endif
struct interface;
extern const char *main_path;
+extern const char *config_path;
void netifd_restart(void);
void netifd_reload(void);