--- /dev/null
+
+ This patch can be applied to version 3.0.1 and fixes a
+ IP address resolution priorities between ipv4 and ipv6.
+ This should fix bug #1029
+
+ Apply it to version 3.0.1 with:
+
+ cd <bacula-source>
+ patch -p0 <3.0.1-ipv6-resolution-order.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/lib/bnet.c
+===================================================================
+--- src/lib/bnet.c     (rĂ©vision 8841)
++++ src/lib/bnet.c     (copie de travail)
+@@ -495,13 +495,16 @@
+             return 0;
+          }
+       } else {
+-         errmsg = resolv_host(AF_INET, host, addr_list);
+ #ifdef HAVE_IPV6
+-         if (errmsg) {
+-            errmsg = resolv_host(AF_INET6, host, addr_list);
+-         }
++         /* We try to resolv host for ipv6 and ipv4, the connection procedure
++          * will try to reach the host for each protocols. We report only "Host
++          * not found" ipv4 message (no need to have ipv6 and ipv4 messages).
++          */
++         resolv_host(AF_INET6, host, addr_list);
+ #endif
+-         if (errmsg) {
++         errmsg = resolv_host(AF_INET, host, addr_list);
++
++         if (addr_list->size() == 0) {
+             *errstr = errmsg;
+             free_addresses(addr_list);
+             return 0;