10 #include "interface.h"
12 const char *main_path = ".";
13 static char **global_argv;
15 static void netifd_do_restart(struct uloop_timeout *timeout)
17 execvp(global_argv[0], global_argv);
20 static struct uloop_timeout restart_timer = {
21 .cb = netifd_do_restart,
24 void netifd_restart(void)
26 interface_set_down(NULL);
27 uloop_timeout_set(&restart_timer, 1000);
30 static int usage(const char *progname)
32 fprintf(stderr, "Usage: %s [options]\n"
34 " -s <path>: Path to the ubus socket\n"
35 " -p <path>: Path to netifd addons (default: %s)\n"
36 "\n", progname, main_path);
41 int main(int argc, char **argv)
43 const char *socket = NULL;
48 while ((ch = getopt(argc, argv, "s:")) != -1) {
57 return usage(argv[0]);
61 if (netifd_ubus_init(socket) < 0) {
62 fprintf(stderr, "Failed to connect to ubus\n");
66 config_init_interfaces(NULL);