From 1438c0119533ea6374f233ee5dc9898b32f7e7c6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 5 Jan 2007 22:19:28 +0000 Subject: add new config options "publish-aaaa-on-ipv4=" and "publish-a-on-ipv6=" git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1366 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/static-hosts.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'avahi-daemon/static-hosts.c') diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c index 9941a51..35058fc 100644 --- a/avahi-daemon/static-hosts.c +++ b/avahi-daemon/static-hosts.c @@ -110,7 +110,9 @@ static void static_host_free(StaticHost *s) { 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))) { @@ -123,7 +125,12 @@ static void add_static_host_to_server(StaticHost *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; } -- cgit