[packages/avahi] - rel 4; from ubuntu (enable ipv6; avoid 100% cpu eating - ubuntu bug 1059286)

arekm arekm at pld-linux.org
Sat Oct 13 07:37:48 CEST 2012


commit 4a7813ac0b0e7b193dd47bc1f68db47c36ca03c1
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Oct 13 07:37:43 2012 +0200

    - rel 4; from ubuntu (enable ipv6; avoid 100% cpu eating - ubuntu bug 1059286)

 01_avahi-daemon.conf.patch                         | 16 ++++
 ...-space-for-record-data-when-size-estimate.patch | 91 ++++++++++++++++++++++
 avahi.spec                                         |  6 +-
 3 files changed, 112 insertions(+), 1 deletion(-)
---
diff --git a/avahi.spec b/avahi.spec
index 0fa5a53..b2bee6e 100644
--- a/avahi.spec
+++ b/avahi.spec
@@ -30,7 +30,7 @@ Summary:	Free mDNS/DNS-SD/Zeroconf implementation
 Summary(pl.UTF-8):	Wolna implementacja mDNS/DNS-SD/Zeroconf
 Name:		avahi
 Version:	0.6.31
-Release:	3
+Release:	4
 License:	LGPL v2.1+
 Group:		Applications
 Source0:	http://avahi.org/download/%{name}-%{version}.tar.gz
@@ -47,6 +47,8 @@ Patch3:		%{name}-mono-dir.patch
 Patch4:		nss-mdns-package.patch
 Patch5:		%{name}-dhclient_hooks.patch
 Patch6:		%{name}-autoipd-sbin_ip.patch
+Patch7:		01_avahi-daemon.conf.patch
+Patch8:		avahi-core-reserve-space-for-record-data-when-size-estimate.patch
 URL:		http://avahi.org/
 BuildRequires:	autoconf >= 2.63
 BuildRequires:	automake >= 1:1.11
@@ -648,6 +650,8 @@ Narzędzia linii poleceń korzystające z avahi-client.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
+%patch8 -p1
 
 %build
 %{__intltoolize}
diff --git a/01_avahi-daemon.conf.patch b/01_avahi-daemon.conf.patch
new file mode 100644
index 0000000..d8cf45e
--- /dev/null
+++ b/01_avahi-daemon.conf.patch
@@ -0,0 +1,16 @@
+Index: b/avahi-daemon/avahi-daemon.conf
+===================================================================
+--- a/avahi-daemon/avahi-daemon.conf	2010-06-29 02:19:57.000000000 +0200
++++ b/avahi-daemon/avahi-daemon.conf	2010-07-07 20:03:01.987655481 +0200
+@@ -21,9 +21,9 @@
+ [server]
+ #host-name=foo
+ #domain-name=local
+-browse-domains=0pointer.de, zeroconf.org
++#browse-domains=0pointer.de, zeroconf.org
+ use-ipv4=yes
+-use-ipv6=no
++use-ipv6=yes
+ #allow-interfaces=eth0
+ #deny-interfaces=eth1
+ #check-response-ttl=no
diff --git a/avahi-core-reserve-space-for-record-data-when-size-estimate.patch b/avahi-core-reserve-space-for-record-data-when-size-estimate.patch
new file mode 100644
index 0000000..5145b8c
--- /dev/null
+++ b/avahi-core-reserve-space-for-record-data-when-size-estimate.patch
@@ -0,0 +1,91 @@
+--- a/avahi-core/dns.c
++++ b/avahi-core/dns.c
+@@ -55,6 +55,7 @@
+ 
+     p->size = p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
+     p->max_size = max_size;
++    p->res_size = 0;
+     p->name_table = NULL;
+     p->data = NULL;
+ 
+@@ -833,6 +834,25 @@
+     return p->max_size - p->size;
+ }
+ 
++size_t avahi_dns_packet_reserve_size(AvahiDnsPacket *p, size_t res_size) {
++    assert(p);
++
++    assert(p->size + p->res_size <= p->max_size);
++
++    if ((p->size + p->res_size + res_size) <= p->max_size)
++	p->res_size += res_size;
++
++    return p->res_size;
++}
++
++size_t avahi_dns_packet_reserved_space(AvahiDnsPacket *p) {
++    assert(p);
++
++    assert(p->size + p->res_size <= p->max_size);
++
++    return p->max_size - p->size - p->res_size;
++}
++
+ int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size) {
+     int ret;
+     AvahiDnsPacket p;
+--- a/avahi-core/dns.h
++++ b/avahi-core/dns.h
+@@ -30,7 +30,7 @@
+ #define AVAHI_DNS_PACKET_SIZE_MAX (AVAHI_DNS_PACKET_HEADER_SIZE + 256 + 2 + 2 + 4 + 2 + AVAHI_DNS_RDATA_MAX)
+ 
+ typedef struct AvahiDnsPacket {
+-    size_t size, rindex, max_size;
++    size_t size, rindex, max_size, res_size;
+     AvahiHashmap *name_table; /* for name compression */
+     uint8_t *data;
+ } AvahiDnsPacket;
+@@ -78,6 +78,8 @@
+ 
+ int avahi_dns_packet_is_empty(AvahiDnsPacket *p);
+ size_t avahi_dns_packet_space(AvahiDnsPacket *p);
++size_t avahi_dns_packet_reserve_size(AvahiDnsPacket *p, size_t res_size);
++size_t avahi_dns_packet_reserved_space(AvahiDnsPacket *p);
+ 
+ #define AVAHI_DNS_FIELD_ID 0
+ #define AVAHI_DNS_FIELD_FLAGS 1
+--- a/avahi-core/probe-sched.c
++++ b/avahi-core/probe-sched.c
+@@ -179,7 +179,7 @@
+         avahi_record_get_estimate_size(pj->record);
+ 
+     /* Too large */
+-    if (size > avahi_dns_packet_space(p))
++    if (size > avahi_dns_packet_reserved_space(p))
+         return 0;
+ 
+     /* Create the probe query */
+@@ -189,6 +189,9 @@
+     b = !!avahi_dns_packet_append_key(p, k, 0);
+     assert(b);
+ 
++    /* reserve size for record data */
++    avahi_dns_packet_reserve_size(p, avahi_record_get_estimate_size(pj->record));
++
+     /* Mark this job for addition to the packet */
+     pj->chosen = 1;
+ 
+@@ -202,9 +205,12 @@
+             continue;
+ 
+         /* This job wouldn't fit in */
+-        if (avahi_record_get_estimate_size(pj->record) > avahi_dns_packet_space(p))
++        if (avahi_record_get_estimate_size(pj->record) > avahi_dns_packet_reserved_space(p))
+             break;
+ 
++	/* reserve size for record data */
++	avahi_dns_packet_reserve_size(p, avahi_record_get_estimate_size(pj->record));
++
+         /* Mark this job for addition to the packet */
+         pj->chosen = 1;
+     }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/avahi.git/commitdiff/4a7813ac0b0e7b193dd47bc1f68db47c36ca03c1



More information about the pld-cvs-commit mailing list