10 const char *main_path
= ".";
11 static char **global_argv
;
13 static void netifd_do_restart(struct uloop_timeout
*timeout
)
15 execvp(global_argv
[0], global_argv
);
18 static struct uloop_timeout restart_timer
= {
19 .cb
= netifd_do_restart
,
22 void netifd_restart(void)
24 uloop_timeout_set(&restart_timer
, 1000);
27 static int usage(const char *progname
)
29 fprintf(stderr
, "Usage: %s [options]\n"
31 " -s <path>: Path to the ubus socket\n"
32 " -p <path>: Path to netifd addons (default: %s)\n"
33 "\n", progname
, main_path
);
38 int main(int argc
, char **argv
)
40 const char *socket
= NULL
;
45 while ((ch
= getopt(argc
, argv
, "s:")) != -1) {
54 return usage(argv
[0]);
58 if (netifd_ubus_init(NULL
) < 0) {
59 fprintf(stderr
, "Failed to connect to ubus\n");
63 config_init_interfaces(NULL
);