summaryrefslogtreecommitdiff
path: root/llmnrd.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-18 16:49:51 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-18 16:49:51 +0100
commit069060cad6d9a21d9ec287a7ae9a22deb87f4abc (patch)
tree93846e5638c08a6bd3e1f38e79bae78dcbba01df /llmnrd.c
parent8868bebeee5aad1247bd93a031a7fa30138da13d (diff)
llmnrd: Join IP multicast group on each new interface
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'llmnrd.c')
-rw-r--r--llmnrd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/llmnrd.c b/llmnrd.c
index 5b1a4ea..4da5c4e 100644
--- a/llmnrd.c
+++ b/llmnrd.c
@@ -108,7 +108,7 @@ int main(int argc, char **argv)
int c, ret = EXIT_FAILURE;
long num_arg;
bool daemonize = false;
- char *hostname = "";
+ char *hostname = NULL;
uint16_t port = LLMNR_UDP_PORT;
while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
register_signal(SIGTERM, signal_handler);
register_signal(SIGHUP, signal_handler);
- if (hostname[0] == '\0') {
+ if (!hostname) {
/* TODO: Consider hostname changing at runtime */
hostname = xmalloc(255);
if (gethostname(hostname, 255) != 0) {
@@ -156,10 +156,13 @@ int main(int argc, char **argv)
}
}
+ if (llmnr_init(hostname, port) < 0)
+ goto out;
+
if (iface_start_thread() < 0)
goto out;
- ret = llmnr_run(hostname, port);
+ ret = llmnr_run();
out:
free(hostname);
return ret;