[avahi] Service Name Conflicts

Timothy Potter tpotter01 at me.com
Wed Jan 31 14:10:15 UTC 2018


I think I have found the issue.

My service file is setup like this:

<!-- See avahi.service(5) for more information about this configuration file -->
 
<service-group>
 
  <name replace-wildcards="yes">%h</name>
 
  <service protocol="ipv6">
    <type>_http._tcp</type>
    <port>80</port>
  </service>
 
</service-group>


In the file 

avahi-daemon/static-services.c
 
function:  entry_group_callback, if a conflict is detected a new name is created and stored in g->chosen_name and an attempt is made to add the service again with this new name.
 
case AVAHI_ENTRY_GROUP_COLLISION: {
            char *n;
 
            remove_static_service_group_from_server(g);
 
            n = avahi_alternative_service_name(g->chosen_name);
            avahi_free(g->chosen_name);
            g->chosen_name = n;
 
            avahi_log_notice("Service name conflict for \"%s\" (%s), retrying with \"%s\".", g->name, g->filename, g->chosen_name);
 
            add_static_service_group_to_server(g);
            break;
        }
 

The problem is in add_static_service_group_to_server.    There is an if to see if g->chosen_name = NULL or if the replace-wildcards is set to yes.  If either of those are true ( in my chase it is ) it then frees the g->chosen_name and rebuilds it with the same name that was in conflict to begin with.  It never tries to add the service with the new service name so I continually receive the “Service name conflict”.

static void add_static_service_group_to_server(StaticServiceGroup *g) {
    StaticService *s;
 
    assert(g);
 
    if (g->entry_group && !avahi_s_entry_group_is_empty(g->entry_group))
        /* This service group is already registered in the server */
        return;
 
    if (!g->chosen_name || (g->replace_wildcards && strstr(g->name, "%h"))) {
 
        avahi_free(g->chosen_name);
 
        if (g->replace_wildcards) {
            char label[AVAHI_LABEL_MAX];
            const char *p;
 
            p = avahi_server_get_host_name(avahi_server);
            avahi_unescape_label(&p, label, sizeof(label));
 
            g->chosen_name = replacestr(g->name, "%h", label);
        } else
            g->chosen_name = avahi_strdup(g->name);
 
    }



> On Jan 26, 2018, at 9:50 AM, Timothy Potter <tpotter01 at me.com> wrote:
> 
> I have several Linux machines all running kernel version 3.12 and avahi-daemon 0.6.31. Each machine has a unique host name and they are all advertising an ssh, sftp, and http. When I start all the machines up everything runs just fine. If one of the machines gets re-booted, when the avahi-daemon on that machine starts up again, it reports service conflicts every couple of seconds:
> 
> Jun  1 16:20:12 Node00b01973d6c8 daemon.notice avahi-daemon[1624]: Service name conflict for "%h" (/services/ssh.service), retrying with "Node00b01973d6c8 #2".
> Jun  1 16:20:12 Node00b01973d6c8 daemon.notice avahi-daemon[1624]: Service name conflict for "%h" (/services/http.service), retrying with "Node00b01973d6c8 #2".
> Jun  1 16:20:32 Node00b01973d6c8 daemon.notice avahi-daemon[1624]: Service name conflict for "%h" (/services/sftp-ssh.service), retrying with "Node00b01973d6c8 #2".
> 
> These message print every few seconds. The only way I have been able to make them go away is to reboot all the machines running the avahi-daemon. Any suggestions on how to fix this?
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/avahi/attachments/20180131/31e85d4a/attachment.html>


More information about the avahi mailing list