11 const char *main_path = ".";
12 static char **global_argv;
14 static void netifd_do_restart(struct uloop_timeout *timeout)
16 execvp(global_argv[0], global_argv);
19 static struct uloop_timeout restart_timer = {
20 .cb = netifd_do_restart,
23 void netifd_restart(void)
25 interface_set_down(NULL);
26 uloop_timeout_set(&restart_timer, 1000);
29 static int usage(const char *progname)
31 fprintf(stderr, "Usage: %s [options]\n"
33 " -s <path>: Path to the ubus socket\n"
34 " -p <path>: Path to netifd addons (default: %s)\n"
35 "\n", progname, main_path);
40 int main(int argc, char **argv)
42 const char *socket = NULL;
47 while ((ch = getopt(argc, argv, "s:")) != -1) {
56 return usage(argv[0]);
60 if (netifd_ubus_init(NULL) < 0) {
61 fprintf(stderr, "Failed to connect to ubus\n");
65 config_init_interfaces(NULL);