Package: dnsmasq
Severity: important
Tags: patch, ipv6
User: debian-...@lists.debian.org
Usertags: kfreebsd

Hi,

dnsmasq FTBFS on kfreebsd since the IPv6 support in dnsmasq is Linux-only.

Following a patch which fixes the FTBFS -- hopefully without changing
the build on Linux. I wasn't able to test the functionality of the
patch yet since I only have remote access to kfreebsd machines which
must not run DHCP servers.

diff -ru dnsmasq-2.51/src/forward.c dnsmasq-2.51+kbsd/src/forward.c
--- dnsmasq-2.51/src/forward.c  2009-10-13 18:41:27.000000000 +0200
+++ dnsmasq-2.51+kbsd/src/forward.c     2010-01-23 00:16:14.000000000 +0100
@@ -40,7 +40,11 @@
     char control[CMSG_SPACE(sizeof(struct in_addr))];
 #endif
 #ifdef HAVE_IPV6
+  #if defined(HAVE_LINUX_NETWORK)
     char control6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+  #elif defined(IP_SENDSRCADDR)
+    char control6[CMSG_SPACE(sizeof(struct in6_addr))];
+  #endif
 #endif
   } control_u;
   
@@ -82,12 +86,20 @@
       else
 #ifdef HAVE_IPV6
        {
+    #if defined(HAVE_LINUX_NETWORK)
          struct in6_pktinfo *pkt = (struct in6_pktinfo *)CMSG_DATA(cmptr);
          pkt->ipi6_ifindex = iface; /* Need iface for IPv6 to handle 
link-local addrs */
          pkt->ipi6_addr = source->addr.addr6;
          msg.msg_controllen = cmptr->cmsg_len = CMSG_LEN(sizeof(struct 
in6_pktinfo));
          cmptr->cmsg_type = IPV6_PKTINFO;
          cmptr->cmsg_level = IPV6_LEVEL;
+    #elif defined(IP_SENDSRCADDR)
+         struct in6_addr *a = (struct in6_addr *)CMSG_DATA(cmptr);
+         *a = source->addr.addr6;
+         msg.msg_controllen = cmptr->cmsg_len = CMSG_LEN(sizeof(struct 
in6_addr));
+         cmptr->cmsg_level = IPPROTO_IP;
+         cmptr->cmsg_type = IP_SENDSRCADDR;
+    #endif
        }
 #else
       iface = 0; /* eliminate warning */
@@ -575,7 +587,12 @@
   union {
     struct cmsghdr align; /* this ensures alignment */
 #ifdef HAVE_IPV6
+  #if defined(HAVE_LINUX_NETWORK)
     char control6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+  #elif defined(IP_RECVDSTADDR)
+    char control6[CMSG_SPACE(sizeof(struct in6_addr)) +
+                 CMSG_SPACE(sizeof(struct sockaddr_dl))];
+  #endif
 #endif
 #if defined(HAVE_LINUX_NETWORK)
     char control[CMSG_SPACE(sizeof(struct in_pktinfo))];
@@ -663,8 +680,12 @@
          for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, 
cmptr))
            if (cmptr->cmsg_level == IPV6_LEVEL && cmptr->cmsg_type == 
IPV6_PKTINFO)
              {
+  #if defined(HAVE_LINUX_NETWORK)
                dst_addr.addr.addr6 = ((struct in6_pktinfo 
*)CMSG_DATA(cmptr))->ipi6_addr;
                if_index =((struct in6_pktinfo 
*)CMSG_DATA(cmptr))->ipi6_ifindex;
+  #elif defined(IP_RECVDSTADDR) && defined(IP_RECVIF)
+               dst_addr.addr.addr6 = *((struct in6_addr *)CMSG_DATA(cmptr));
+  #endif
              }
        }
 #endif

Will test the functionality when I have access to an appropriate
machine in an appropriate network.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (600, 'testing'), (110, 'experimental')
Architecture: kfreebsd-i386 (i686)

Kernel: kFreeBSD 8.0-1-686-smp
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to