[avahi] Patch for avahi-core/socket.c to accomodate RHEL AS4 x86_64

David C Thompson dcthomp at sandia.gov
Fri Sep 28 15:14:26 PDT 2007


Hi,

	We have some x86_64 machines running RHEL4, a 2.6.9 kernel, and Avahi
0.6.22. It doesn't work as distributed. In particular, I found that
running avahi-daemon in debug mode would generate many sendmsg() failed
errors. Because of this, none of the packets sent by the daemon actually
made it to the wire and so it could display cached results from other
machines but not publish itself or send queries when the cache TTL
expired. This is related to the (closed) tickets mentioned in this
thread:
  http://lists.freedesktop.org/archives/avahi/2006-April/000640.html
but either a regression has occurred or some changes in header files has
broken things on this platform. The patch below seems more correct (to
me) than what's there now and definitely fixes things for our machines
but I don't have all of the architectures mentioned in the previous
tickets to verify it doesn't break them. Could anyone verify that this
patch works on linux-ia64, sparc64, etc.? Might this patch be considered
for integration into a release down the road?

	Thanks,
	David

@@ -508,26 +508,24 @@
     if (interface > 0 || src_address) {
         struct in_pktinfo *pkti;
         
         memset(cmsg_data, 0, sizeof(cmsg_data));
         msg.msg_control = cmsg_data;
-        msg.msg_controllen = sizeof(cmsg_data);
+        msg.msg_controllen = CMSG_LEN(sizeof(struct in_pktinfo));
 
         cmsg = CMSG_FIRSTHDR(&msg);
-        cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
+        cmsg->cmsg_len = msg.msg_controllen;
         cmsg->cmsg_level = IPPROTO_IP;
         cmsg->cmsg_type = IP_PKTINFO;
 
         pkti = (struct in_pktinfo*) CMSG_DATA(cmsg);
 
         if (interface > 0) 
             pkti->ipi_ifindex = interface;
 
         if (src_address)
             pkti->ipi_spec_dst.s_addr = src_address->address;
-
-        msg.msg_controllen = cmsg->cmsg_len;
     }
 #elif defined(IP_SENDSRCADDR)
     if (src_address) {
         struct in_addr *addr;
 




More information about the avahi mailing list