Hi,

On Sun, May 10, 2009 at 06:06:10PM +0200, Kern Sibbald wrote:
> On Sunday 10 May 2009 16:59:36 Davíð Steinn Geirsson wrote:
> > Hi all,
> >
> > I am in the migrating my services to IPv6. I have pretty much everything
> > moved except for bacula.
> >
> > I have convinced the fd, sd and director to listen on :: and am able to
> > connect to them through their v6 addresses. However, it seems that when
> > a host has both A and AAAA records in DNS, bacula prefers the A record
> > and hence falls back to IPv4.
> >
> > I found one message to bacula-user from january 2008 at
> > http://marc.info/?l=bacula-users&m=119945566132053&w=2 that confirms
> > this behavior. There was no discussion as to why this was so.
> 
> Yes, there was a discussion about it, but perhaps it is in the bug report 
> that 
> is open on that subject (I think it is 1029).
> 
> >
> > In my opinion this behavior is broken and prevents proper migration.
> > However, I assume there must be some reason why this behavior was
> > chosen, so I am interested in hearing it's rationale.
> 
> Yes, I think it is an undesirable behavior.  I suspect that the person who 
> implemented it either wanted it that way or didn't realize it is not ideal.  
> Unfortunately, I don't have IPv6 running here or the time to work on it, so 
> it is an item that has been pending for a long time.
> 
> >
> > I intend to patch this behavior and deploy the patched versions to my
> > hosts. If there is consensus that this behavior is undesireable, or no
> > reply is received, I will submit the patch here for discussion.
> 
> Yes, I definitely would like to resolve this problem (and close the bug 
> report).  If you have a test environment as well as the time and energy, we 
> would really appreciate a patch -- IPv6 is going to become important in the 
> next couple of years.

The attached patch should solve this issue. With it, bacula will try the
host's AAAA record first, and fall back to the A record if it is
unreachable.

I've performed some testing and it seems to work well with both v6 and
v4 hosts. My environment is now v6-only as far as bacula is concerned.

> 
> Regards,
> 
> Kern
> 

Kind regards,
Davíð Steinn Geirsson
[email protected]
--- ../../bacula-svn-orig/bacula/src/lib/bnet.c	2009-05-10 18:18:44.000000000 +0000
+++ src/lib/bnet.c	2009-05-12 21:08:03.000000000 +0000
@@ -495,13 +495,11 @@
             return 0;
          }
       } else {
-         errmsg = resolv_host(AF_INET, host, addr_list);
 #ifdef HAVE_IPV6
-         if (errmsg) {
-            errmsg = resolv_host(AF_INET6, host, addr_list);
-         }
+         errmsg = resolv_host(AF_INET6, host, addr_list);
 #endif
-         if (errmsg) {
+         errmsg = resolv_host(AF_INET, host, addr_list);
+         if ((addr_list->size() == 0) &&errmsg) {
             *errstr = errmsg;
             free_addresses(addr_list);
             return 0;

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to