11 #include "interface.h"
13 const char *main_path
= ".";
14 static char **global_argv
;
16 static void netifd_do_restart(struct uloop_timeout
*timeout
)
18 execvp(global_argv
[0], global_argv
);
21 static struct uloop_timeout restart_timer
= {
22 .cb
= netifd_do_restart
,
25 void netifd_restart(void)
27 interface_set_down(NULL
);
28 uloop_timeout_set(&restart_timer
, 1000);
31 static int usage(const char *progname
)
33 fprintf(stderr
, "Usage: %s [options]\n"
35 " -s <path>: Path to the ubus socket\n"
36 " -p <path>: Path to netifd addons (default: %s)\n"
37 "\n", progname
, main_path
);
42 int main(int argc
, char **argv
)
44 const char *socket
= NULL
;
49 while ((ch
= getopt(argc
, argv
, "s:")) != -1) {
58 return usage(argv
[0]);
62 if (netifd_ubus_init(socket
) < 0) {
63 fprintf(stderr
, "Failed to connect to ubus\n");
68 fprintf(stderr
, "Failed to initialize system control\n");
72 config_init_interfaces(NULL
);