#include <stdlib.h>
#include <string.h>
#include <getopt.h>
+#include <unistd.h>
#include "netifd.h"
#include "ubus.h"
#include "config.h"
+#include "interface.h"
+const char *main_path = ".";
static char **global_argv;
static void netifd_do_restart(struct uloop_timeout *timeout)
void netifd_restart(void)
{
+ interface_set_down(NULL);
uloop_timeout_set(&restart_timer, 1000);
}
fprintf(stderr, "Usage: %s [options]\n"
"Options:\n"
" -s <path>: Path to the ubus socket\n"
- "\n", progname);
+ " -p <path>: Path to netifd addons (default: %s)\n"
+ "\n", progname, main_path);
return 1;
}
case 's':
socket = optarg;
break;
+ case 'p':
+ main_path = optarg;
+ break;
default:
return usage(argv[0]);
}
}
- if (netifd_ubus_init(NULL) < 0) {
+ if (netifd_ubus_init(socket) < 0) {
fprintf(stderr, "Failed to connect to ubus\n");
return 1;
}