--- qemud/mdns.h.orig 2008-05-10 19:29:18.000000000 +0200 +++ qemud/mdns.h 2008-05-10 19:29:38.000000000 +0200 @@ -83,7 +83,7 @@ * * returns the service record, or NULL upon failure */ -struct libvirtd_mdns_entry *libvirtd_mdns_add_entry(struct libvirtd_mdns_group *group, const char *type, int port); +struct libvirtd_mdns_entry *libvirtd_mdns_add_entry(struct libvirtd_mdns_group *group, const char *type, const char *host, int port); /** * Removes a service entry from a group --- qemud/mdns.c.orig 2008-05-10 19:22:45.000000000 +0200 +++ qemud/mdns.c 2008-05-10 19:35:10.000000000 +0200 @@ -46,6 +46,7 @@ struct libvirtd_mdns_entry { char *type; + char *host; int port; struct libvirtd_mdns_entry *next; }; @@ -153,7 +154,7 @@ group->name, entry->type, NULL, - NULL, + entry->host, entry->port, NULL)) < 0) { AVAHI_DEBUG("Failed to add %s service on port %d: %s", @@ -440,18 +441,28 @@ } } -struct libvirtd_mdns_entry *libvirtd_mdns_add_entry(struct libvirtd_mdns_group *group, const char *type, int port) { +struct libvirtd_mdns_entry *libvirtd_mdns_add_entry(struct libvirtd_mdns_group *group, const char *type, const char *host, int port) { struct libvirtd_mdns_entry *entry = malloc(sizeof(*entry)); - AVAHI_DEBUG("Adding entry %s %d to group %s", type, port, group->name); + AVAHI_DEBUG("Adding entry %s %s %d to group %s", type, (host == NULL ? "0.0.0.0" : host), port, group->name); if (!entry) return NULL; entry->port = port; + if (!(entry->type = strdup(type))) { free(entry); return NULL; } + + if (host != NULL) { + if (!(entry->host = strdup(host))) { + free(entry->type); + free(entry); + return NULL; + } + } + entry->next = group->entry; group->entry = entry; return entry; --- qemud/qemud.c.orig2 2008-05-10 19:22:57.000000000 +0200 +++ qemud/qemud.c 2008-05-10 19:26:46.000000000 +0200 @@ -828,7 +828,7 @@ * Add the primary entry - we choose SSH because its most likely to always * be available */ - libvirtd_mdns_add_entry(group, "_libvirt._tcp", port); + libvirtd_mdns_add_entry(group, "_libvirt._tcp", ip_addr, port); libvirtd_mdns_start(server->mdns); } #endif