#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
+#publish-aaaa-on-ipv4=yes
+#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
static int is_yes(const char *s) {
assert(s);
- return *s == 'y' || *s == 'Y';
+ return *s == 'y' || *s == 'Y' || *s == '1' || *s == 't' || *s == 'T';
}
static int load_config_file(DaemonConfig *c) {
c->server_config.add_service_cookie = is_yes(p->value);
else if (strcasecmp(p->key, "publish-dns-servers") == 0) {
avahi_strfreev(c->publish_dns_servers);
- c->publish_dns_servers = avahi_split_csv(p->value);
- } else {
+ c->publish_dns_servers = avahi_split_csv(p->value);
+ } else if (strcasecmp(p->key, "publish-a-on-ipv6") == 0)
+ c->server_config.publish_a_on_ipv6 = is_yes(p->value);
+ else if (strcasecmp(p->key, "publish-aaaa-on-ipv4") == 0)
+ c->server_config.publish_aaaa_on_ipv4 = is_yes(p->value);
+ else {
avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
goto finish;
}
static void add_static_host_to_server(StaticHost *h)
{
AvahiAddress a;
+ AvahiProtocol p;
int err;
+ const AvahiServerConfig *config;
if (!h->group)
if (!(h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h))) {
return;
}
- if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, h->host, &a))) {
+ config = avahi_server_get_config(avahi_server);
+
+ p = (a.proto == AVAHI_PROTO_INET && config->publish_a_on_ipv6) ||
+ (a.proto == AVAHI_PROTO_INET6 && config->publish_aaaa_on_ipv4) ? AVAHI_PROTO_UNSPEC : a.proto;
+
+ if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, p, 0, h->host, &a))) {
avahi_log_error ("Static host name %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err));
return;
}
SIGHUP to have it reload this file. Defaults to "no".</p>
</option>
+ <option>
+ <p><opt>publish-aaaa-on-ipv4=</opt> Takes a boolean value
+ ("yes" or "no"). If set to "yes" avahi-daemon will publish an
+ IPv6 AAAA record via IPv4, i.e. the local IPv6 addresses can be
+ resolved using an IPv4 transport. Only useful when IPv4 is
+ enabled with <opt>use-ipv4=true</opt>. Defaults to "yes".</p>
+ </option>
+
+ <option>
+ <p><opt>publish-a-on-ipv6=</opt> Takes a boolean value
+ ("yes" or "no"). If set to "yes" avahi-daemon will publish an
+ IPv4 A record via IPv6, i.e. the local IPv4 addresses can be
+ resolved using an IPv6 transport. Only useful when IPv6 is
+ enabled with <opt>use-ipv6=true</opt>. Defaults to "no".</p>
+ </option>
+
</section>
<section name="Section [reflector]">