Signed-off-by: Felix Fietkau <nbd@openwrt.org>
#include "announce.h"
#include "interface.h"
-static char *iface_name = "eth0";
-
static void
signal_shutdown(int signal)
{
{
int ch, ttl;
+ uloop_init();
+
while ((ch = getopt(argc, argv, "t:i:d")) != -1) {
switch (ch) {
case 't':
debug++;
break;
case 'i':
- iface_name = optarg;
+ interface_add(optarg);
break;
}
}
- if (!iface_name)
- return -1;
-
- uloop_init();
-
- if (interface_add(iface_name)) {
- fprintf(stderr, "Failed to add interface %s\n", iface_name);
- return -1;
- }
-
signal(SIGPIPE, SIG_IGN);
signal(SIGTERM, signal_shutdown);
signal(SIGKILL, signal_shutdown);