Amanda-Users

Re: Invalid value for ai_flags

2007-05-04 14:11:36
Subject: Re: Invalid value for ai_flags
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Richard Stockton <amanda AT richardleestockton DOT org>
Date: Fri, 04 May 2007 14:10:45 -0400
Richard,

Could you try this simpler patch instead of the previous one?

Jean-Louis

Richard Stockton wrote:
OS: FreeBSD 6.2

amcheck displays this;
====================================================================
Amanda Tape Server Host Check
-----------------------------
ERROR: Cannot resolve `localhost': Invalid value for ai_flags
read label `VOL130', date `20070504193456'
NOTE: skipping tape-writable test
Tape VOL130 label ok
NOTE: conf info dir /work/amanda/bak13/curinfo does not exist
NOTE: it will be created on the next run.
NOTE: index dir /work/amanda/bak13/index does not exist
NOTE: it will be created on the next run.
Server check took 0.081 seconds

Amanda Backup Client Hosts Check
--------------------------------
WARNING: bak-05: selfcheck request failed: getaddrinfo(bak-05): Invalid value for ai_flags

Client check: 1 host checked in 10.003 seconds, 1 problem found

(brought to you by Amanda 2.5.2)
======================================================================


My /etc/hosts file looks like this;
======================================================================
::1                     localhost.adhost.com localhost
127.0.0.1               localhost.adhost.com localhost
10.211.1.105            bak-05.adhost.com bak-05
10.211.1.105            bak-05.adhost.com.
=======================================================================


So why is amanda unable to resolve "localhost"?

TIA.
 - Richard


diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/common-src/bsd-security.c 
amanda-2.5.2.ai_flags/common-src/bsd-security.c
--- amanda-2.5.2/common-src/bsd-security.c      2007-04-28 16:37:55.000000000 
-0400
+++ amanda-2.5.2.ai_flags/common-src/bsd-security.c     2007-05-04 
14:02:46.000000000 -0400
@@ -165,6 +165,7 @@ bsd_connect(
     result = getaddrinfo(hostname, NULL, &hints, &res);
 #ifdef WORKING_IPV6
     if (result != 0) {
+       hints.ai_flags = AI_CANONNAME;
        hints.ai_family = AF_UNSPEC;
        result = getaddrinfo(hostname, NULL, &hints, &res);
     }
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/common-src/bsdtcp-security.c 
amanda-2.5.2.ai_flags/common-src/bsdtcp-security.c
--- amanda-2.5.2/common-src/bsdtcp-security.c   2007-04-03 09:08:41.000000000 
-0400
+++ amanda-2.5.2.ai_flags/common-src/bsdtcp-security.c  2007-05-04 
14:02:34.000000000 -0400
@@ -139,6 +139,13 @@ bsdtcp_connect(
     hints.ai_canonname = NULL;
     hints.ai_next = NULL;
     result = getaddrinfo(hostname, NULL, &hints, &res);
+#ifdef WORKING_IPV6
+    if (result != 0) {
+       hints.ai_flags = AI_CANONNAME;
+       hints.ai_family = AF_UNSPEC;
+       result = getaddrinfo(hostname, NULL, &hints, &res);
+    }
+#endif
     if(result != 0) {
         dbprintf(("getaddrinfo(%s): %s\n", hostname, gai_strerror(result)));
        security_seterror(&rh->sech, "getaddrinfo(%s): %s\n", hostname,
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/common-src/bsdudp-security.c 
amanda-2.5.2.ai_flags/common-src/bsdudp-security.c
--- amanda-2.5.2/common-src/bsdudp-security.c   2007-04-28 16:37:55.000000000 
-0400
+++ amanda-2.5.2.ai_flags/common-src/bsdudp-security.c  2007-05-04 
14:02:52.000000000 -0400
@@ -145,6 +145,7 @@ bsdudp_connect(
     result = getaddrinfo(hostname, NULL, &hints, &res);
 #ifdef WORKING_IPV6
     if (result != 0) {
+       hints.ai_flags = AI_CANONNAME;
        hints.ai_family = AF_UNSPEC;
        result = getaddrinfo(hostname, NULL, &hints, &res);
     }
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/common-src/krb5-security.c 
amanda-2.5.2.ai_flags/common-src/krb5-security.c
--- amanda-2.5.2/common-src/krb5-security.c     2007-04-10 09:06:11.000000000 
-0400
+++ amanda-2.5.2.ai_flags/common-src/krb5-security.c    2007-05-04 
14:03:08.000000000 -0400
@@ -273,6 +273,13 @@ krb5_connect(
     hints.ai_canonname = NULL;
     hints.ai_next = NULL;
     result = getaddrinfo(hostname, NULL, &hints, &res);
+#ifdef WORKING_IPV6
+    if (result != 0) {
+       hints.ai_flags = AI_CANONNAME;
+       hints.ai_family = AF_UNSPEC;
+       result = getaddrinfo(hostname, NULL, &hints, &res);
+    }
+#endif
     if(result != 0) {
        dbprintf(("krb5_connect: getaddrinfo(%s): %s\n", hostname, 
gai_strerror(result)));
        security_seterror(&rh->sech, "getaddrinfo(%s): %s\n", hostname,
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/amcheck.c 
amanda-2.5.2.ai_flags/server-src/amcheck.c
--- amanda-2.5.2/server-src/amcheck.c   2007-04-27 07:04:00.000000000 -0400
+++ amanda-2.5.2.ai_flags/server-src/amcheck.c  2007-05-04 14:06:52.000000000 
-0400
@@ -685,7 +685,15 @@ start_server_check(
        hints.ai_addr = NULL;
        hints.ai_canonname = NULL;
        hints.ai_next = NULL;
-       if ((res = getaddrinfo("localhost", NULL, &hints, &gaires)) != 0) {
+       res = getaddrinfo("localhost", NULL, &hints, &gaires);
+#ifdef WORKING_IPV6
+       if (res != 0) {
+           hints.ai_flags = AI_CANONNAME;
+           hints.ai_family = AF_UNSPEC;
+           res = getaddrinfo("localhost", NULL, &hints, &gaires);
+       }
+#endif
+       if (res != 0) {
            fprintf(outf, _("ERROR: Cannot resolve `localhost': %s\n"), 
gai_strerror(res));
        }
        if (gaires) freeaddrinfo(gaires);
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/dumper.c 
amanda-2.5.2.ai_flags/server-src/dumper.c
--- amanda-2.5.2/server-src/dumper.c    2007-04-13 10:10:19.000000000 -0400
+++ amanda-2.5.2.ai_flags/server-src/dumper.c   2007-05-04 14:07:09.000000000 
-0400
@@ -477,7 +477,15 @@ main(
            hints.ai_addr = NULL;
            hints.ai_canonname = NULL;
            hints.ai_next = NULL;
-           if ((res = getaddrinfo("localhost", NULL, &hints, &gaires)) != 0) {
+           res = getaddrinfo("localhost", NULL, &hints, &gaires);
+#ifdef WORKING_IPV6
+           if (res != 0) {
+               hints.ai_flags = AI_CANONNAME;
+               hints.ai_family = AF_UNSPEC;
+               res = getaddrinfo("localhost", NULL, &hints, &gaires);
+           }
+#endif
+           if (res != 0) {
                errstr = newvstralloc(errstr,
                                     _("could not resolve localhost: "),
                                     gai_strerror(res), NULL);
<Prev in Thread] Current Thread [Next in Thread>