[Pkg-utopia-commits] r1246 - packages/unstable/avahi/debian

Sjoerd Simons sjoerd at alioth.debian.org
Sun Mar 4 21:09:06 CET 2007


Author: sjoerd
Date: 2007-03-04 20:09:05 +0000 (Sun, 04 Mar 2007)
New Revision: 1246

Added:
   packages/unstable/avahi/debian/avahi-daemon-check-dns.sh
Modified:
   packages/unstable/avahi/debian/avahi-daemon.default
   packages/unstable/avahi/debian/avahi-daemon.ifupdown
   packages/unstable/avahi/debian/avahi-daemon.resolvconf
   packages/unstable/avahi/debian/changelog
   packages/unstable/avahi/debian/rules
Log:
* Move .local detection code to a common script. Also minize the cases where
  host lookups are done, fixing annoying slowdowns (Closes: #409513)
* Add a way to disable the .location detection code completely for the cases
  we can't work around. (Closes: #406272)

Added: packages/unstable/avahi/debian/avahi-daemon-check-dns.sh
===================================================================
--- packages/unstable/avahi/debian/avahi-daemon-check-dns.sh	2007-03-03 02:55:22 UTC (rev 1245)
+++ packages/unstable/avahi/debian/avahi-daemon-check-dns.sh	2007-03-04 20:09:05 UTC (rev 1246)
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# If we have an unicast .local domain, we immediately disable avahi to avoid
+# conflicts with the multicast IP4LL .local domain
+DISABLE_TAG_DIR="/var/run/avahi-daemon/"
+DISABLE_TAG="$DISABLE_TAG_DIR/disabled-for-unicast-local"
+
+. /etc/default/avahi-daemon
+
+AVAHI_DAEMON_DETECT_LOCAL=1
+test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon
+
+if [ "$AVAHI_DAEMON_DETECT_LOCAL" != "1" ]; then
+  exit 0
+fi
+
+
+dns_has_local() { 
+  # If there are no nameserver entries in resolv.conf there are no unicast
+  # .local domains :)
+  $(grep -q nameserver /etc/resolv.conf) || return 1;
+
+  # If there is no local nameserver and no we have no global ip addresses
+  # then there is no need to query the nameservers
+  if ! $(egrep -q "nameserver 127.0.0.1|::1" /etc/resolv.conf); then 
+    # Get addresses of all running interfaces
+    ADDRS=$(ifconfig | grep ' addr:')
+    # Filter out all local addresses
+    ADDRS=$(echo "${ADDRS}" | egrep -v ':127|Scope:Host|Scope:Link')
+    if [ -z "${ADDRS}" ] ; then
+      return 1;
+    fi
+  fi
+
+  OUT=`LC_ALL=C host -t soa local. 2>&1`
+  if [ $? -eq 0 ] && echo "$OUT" | egrep -vq 'has no|not found'; then
+    return 0
+  fi
+  return 1
+}
+
+if dns_has_local ; then
+    if [ -x /etc/init.d/avahi-daemon ]; then
+        /etc/init.d/avahi-daemon stop || true
+        if [ -x /usr/bin/logger ]; then
+            logger -p daemon.warning -t avahi <<EOF
+Avahi detected that your currently configured local DNS server serves
+a domain .local. This is inherently incompatible with Avahi and thus
+Avahi disabled itself. If you want to use Avahi in this network, please
+contact your administrator and convince him to use a different DNS domain,
+since .local should be used exclusively for Zeroconf technology.
+For more information, see http://avahi.org/wiki/AvahiAndUnicastDotLocal
+EOF
+        fi
+    fi
+    if [ ! -d ${DISABLE_TAG_DIR} ] ; then 
+      mkdir -m 0755 -p ${DISABLE_TAG_DIR}
+      chown avahi:avahi ${DISABLE_TAG_DIR}
+    fi 
+    touch ${DISABLE_TAG}
+else
+    # no unicast .local conflict, so remove the tag and start avahi again
+    if [ -e ${DISABLE_TAG} ]; then
+        rm -f ${DISABLE_TAG}
+        if [ -x /etc/init.d/avahi-daemon ]; then
+            /etc/init.d/avahi-daemon start || true
+        fi
+    fi
+fi
+
+exit 0


Property changes on: packages/unstable/avahi/debian/avahi-daemon-check-dns.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: packages/unstable/avahi/debian/avahi-daemon.default
===================================================================
--- packages/unstable/avahi/debian/avahi-daemon.default	2007-03-03 02:55:22 UTC (rev 1245)
+++ packages/unstable/avahi/debian/avahi-daemon.default	2007-03-04 20:09:05 UTC (rev 1246)
@@ -1,2 +1,7 @@
 # 0 = don't start, 1 = start
 AVAHI_DAEMON_START=1
+
+# 1 = Try to detect unicast dns servers that serve .local and disable avahi in
+# that case, 0 = Don't try to detect .local unicast dns servers, can cause
+# troubles on misconfigured networks
+AVAHI_DAEMON_DETECT_LOCAL=1

Modified: packages/unstable/avahi/debian/avahi-daemon.ifupdown
===================================================================
--- packages/unstable/avahi/debian/avahi-daemon.ifupdown	2007-03-03 02:55:22 UTC (rev 1245)
+++ packages/unstable/avahi/debian/avahi-daemon.ifupdown	2007-03-04 20:09:05 UTC (rev 1246)
@@ -2,41 +2,8 @@
 #
 # If we have an unicast .local domain, we immediately disable avahi to avoid
 # conflicts with the multicast IP4LL .local domain
-DISABLE_TAG_DIR="/var/run/avahi-daemon/"
-DISABLE_TAG="$DISABLE_TAG_DIR/disabled-for-unicast-local"
 
 # Bail out if resolvconf is installed
 [ -x /sbin/resolvconf ] && exit 0
 
-OUT=`LC_ALL=C host -t soa local. 2>&1`
-
-if [ $? -eq 0 ] && echo "$OUT" | egrep -vq 'has no|not found'; then
-    if [ -x /etc/init.d/avahi-daemon ]; then
-        /etc/init.d/avahi-daemon stop || true
-        if [ -x /usr/bin/logger ]; then
-            logger -p daemon.warning -t avahi <<EOF
-Avahi detected that your currently configured local DNS server serves
-a domain .local. This is inherently incompatible with Avahi and thus
-Avahi disabled itself. If you want to use Avahi in this network, please
-contact your administrator and convince him to use a different DNS domain,
-since .local should be used exclusively for Zeroconf technology.
-For more information, see http://avahi.org/wiki/AvahiAndUnicastDotLocal
-EOF
-        fi
-    fi
-    if [ ! -d ${DISABLE_TAG_DIR} ] ; then 
-      mkdir -m 0755 -p ${DISABLE_TAG_DIR}
-      chown avahi:avahi ${DISABLE_TAG_DIR}
-    fi 
-    touch ${DISABLE_TAG}
-else
-    # no unicast .local conflict, so remove the tag and start avahi again
-    if [ -e ${DISABLE_TAG} ]; then
-        rm -f ${DISABLE_TAG}
-        if [ -x /etc/init.d/avahi-daemon ]; then
-            /etc/init.d/avahi-daemon start || true
-        fi
-    fi
-fi
-
-exit 0
+exec /usr/lib/avahi/avahi-daemon-check-dns.sh 

Modified: packages/unstable/avahi/debian/avahi-daemon.resolvconf
===================================================================
--- packages/unstable/avahi/debian/avahi-daemon.resolvconf	2007-03-03 02:55:22 UTC (rev 1245)
+++ packages/unstable/avahi/debian/avahi-daemon.resolvconf	2007-03-04 20:09:05 UTC (rev 1246)
@@ -2,38 +2,5 @@
 #
 # If we have an unicast .local domain, we immediately disable avahi to avoid
 # conflicts with the multicast IP4LL .local domain
-DISABLE_TAG_DIR="/var/run/avahi-daemon/"
-DISABLE_TAG="$DISABLE_TAG_DIR/disabled-for-unicast-local"
 
-OUT=`LC_ALL=C host -t soa local. 2>&1`
-
-if [ $? -eq 0 ] && echo "$OUT" | egrep -vq 'has no|not found'; then
-    if [ -x /etc/init.d/avahi-daemon ]; then
-        /etc/init.d/avahi-daemon stop || true
-        if [ -x /usr/bin/logger ]; then
-            logger -p daemon.warning -t avahi <<EOF
-Avahi detected that your currently configured local DNS server serves
-a domain .local. This is inherently incompatible with Avahi and thus
-Avahi disabled itself. If you want to use Avahi in this network, please
-contact your administrator and convince him to use a different DNS domain,
-since .local should be used exclusively for Zeroconf technology.
-For more information, see http://avahi.org/wiki/AvahiAndUnicastDotLocal
-EOF
-        fi
-    fi
-    if [ ! -d ${DISABLE_TAG_DIR} ] ; then 
-      mkdir -m 0755 -p ${DISABLE_TAG_DIR}
-      chown avahi:avahi ${DISABLE_TAG_DIR}
-    fi 
-    touch ${DISABLE_TAG}
-else
-    # no unicast .local conflict, so remove the tag and start avahi again
-    if [ -e ${DISABLE_TAG} ]; then
-        rm -f ${DISABLE_TAG}
-        if [ -x /etc/init.d/avahi-daemon ]; then
-            /etc/init.d/avahi-daemon start || true
-        fi
-    fi
-fi
-
-exit 0
+exec /usr/lib/avahi/avahi-daemon-check-dns.sh 

Modified: packages/unstable/avahi/debian/changelog
===================================================================
--- packages/unstable/avahi/debian/changelog	2007-03-03 02:55:22 UTC (rev 1245)
+++ packages/unstable/avahi/debian/changelog	2007-03-04 20:09:05 UTC (rev 1246)
@@ -1,3 +1,12 @@
+avahi (0.6.16-3) unstable; urgency=low
+
+  * Move .local detection code to a common script. Also minize the cases where
+    host lookups are done, fixing annoying slowdowns (Closes: #409513)
+  * Add a way to disable the .location detection code completely for the cases
+    we can't work around. (Closes: #406272)
+
+ -- Sjoerd Simons <sjoerd at debian.org>  Sun,  4 Mar 2007 20:52:53 +0100
+
 avahi (0.6.16-2) unstable; urgency=low
 
   * debian/patches/02_avahi-daemon-init-unicast-disable.patch

Modified: packages/unstable/avahi/debian/rules
===================================================================
--- packages/unstable/avahi/debian/rules	2007-03-03 02:55:22 UTC (rev 1245)
+++ packages/unstable/avahi/debian/rules	2007-03-04 20:09:05 UTC (rev 1246)
@@ -52,6 +52,8 @@
 		debian/$(cdbs_curpkg)/etc/network/if-up.d/avahi-daemon
 	install -D -o root -g root -m 755 debian/avahi-daemon.resolvconf \
 		debian/$(cdbs_curpkg)/etc/resolvconf/update-libc.d/avahi-daemon
+	install -D -o root -g root -m 755 debian/avahi-daemon-check-dns.sh \
+		debian/$(cdbs_curpkg)/usr/lib/avahi/avahi-daemon-check-dns.sh
 
 common-install-impl::
 	mv $(DEB_DESTDIR)/etc/dhcp3/dhclient-exit-hooks.d/avahi-autoipd \




More information about the Pkg-utopia-commits mailing list