summaryrefslogtreecommitdiffstats
path: root/avahi-daemon
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-01-05 22:19:28 +0000
committerLennart Poettering <lennart@poettering.net>2007-01-05 22:19:28 +0000
commit1438c0119533ea6374f233ee5dc9898b32f7e7c6 (patch)
treea8525398cd2a1072af3f9d7d8f8e22af63ad4eb1 /avahi-daemon
parent1c24d17c1001240306e054ea534c3aa69a45604b (diff)
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
Diffstat (limited to 'avahi-daemon')
-rw-r--r--avahi-daemon/avahi-daemon.conf2
-rw-r--r--avahi-daemon/main.c10
-rw-r--r--avahi-daemon/static-hosts.c9
3 files changed, 17 insertions, 4 deletions
diff --git a/avahi-daemon/avahi-daemon.conf b/avahi-daemon/avahi-daemon.conf
index 1992a67..21fa166 100644
--- a/avahi-daemon/avahi-daemon.conf
+++ b/avahi-daemon/avahi-daemon.conf
@@ -45,6 +45,8 @@ enable-wide-area=yes
#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
diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c
index 33f1265..0b26446 100644
--- a/avahi-daemon/main.c
+++ b/avahi-daemon/main.c
@@ -442,7 +442,7 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
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) {
@@ -541,8 +541,12 @@ 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;
}
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;
}