resolver problem with shared linked programs

2001-02-28 Thread John Hay

I noticed that sendmail started to complain of a failed reverse lookup
when starting:

Feb 28 11:40:43 beast sendmail[276]: 
gethostbyaddr(3ffe:2900:fffa:2:2a0:c9ff:fe8d:7c5f) failed: 2

At first I thought something is wrong with my ipv6 dns setup, but it turned
out that if a program is linked shared the first getipnodebyaddr() it does
will succeed, but the rest fail. For a staticly linked program all of
them will succeed:


beast:~/try  cc -Wall -static -O -o tstgetipnodebyaddr.static-c tstgetipnodebyaddr.c
beast:~/try  cc -Wall -O -o tstgetipnodebyaddr tstgetipnodebyaddr.c 
beast:~/try  ./tstgetipnodebyaddr.static-c And 
the answer is: beast.icomtek.csir.co.za
And the answer is: beast.icomtek.csir.co.za
beast:~/try  ./tstgetipnodebyaddr
And the answer is: beast.icomtek.csir.co.za
Oops: 2.
getipnodebyaddr: Host name lookup failure
beast:~/try 


My test program is at the end of the email. Maybe I (and sendmail) have
done something wrong?

John
-- 
John Hay -- [EMAIL PROTECTED]


#include sys/types.h
#include sys/socket.h
#include netinet/in.h
#include arpa/inet.h
#include netdb.h
#include stdio.h

int main(int argc, char **argv)
{
struct hostent *he;
int h_err;
u_char ipnum[16];
char *astr1;

astr1 = "146.64.24.3";
h_err = inet_pton(AF_INET, astr1, ipnum);
if(h_err == 0) {
printf("conversion error with inet_pton()\n");
exit(1);
}

he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
if(he == NULL) {
printf("Oops: %d.\n", h_err);
herror("getipnodebyaddr");
} else
printf("And the answer is: %s\n", he-h_name);

he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
if(he == NULL) {
printf("Oops: %d.\n", h_err);
herror("getipnodebyaddr");
} else
printf("And the answer is: %s\n", he-h_name);

return 0;
}

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: resolver problem with shared linked programs

2001-02-28 Thread Matthew Thyer

John Hay wrote:
 
 I noticed that sendmail started to complain of a failed reverse lookup
 when starting:
 
 Feb 28 11:40:43 beast sendmail[276]: 
gethostbyaddr(3ffe:2900:fffa:2:2a0:c9ff:fe8d:7c5f) failed: 2
 
 At first I thought something is wrong with my ipv6 dns setup, but it turned
 out that if a program is linked shared the first getipnodebyaddr() it does
 will succeed, but the rest fail. For a staticly linked program all of
 them will succeed:

So it's in -CURRENT too.  -STABLE users have been complaining of a
similar problem since about the 20th/21st of Feb.

I was damned lucky that I skimmed:
http://www.mail-archive.com/freebsd-stable%40freebsd.org/
before I built a -STABLE system today.

I'm cross posting to stable so others can try your program.

And I wont install my -CURRENT buildworld.

 
 #include sys/types.h
 #include sys/socket.h
 #include netinet/in.h
 #include arpa/inet.h
 #include netdb.h
 #include stdio.h
 
 int main(int argc, char **argv)
 {
 struct hostent *he;
 int h_err;
 u_char ipnum[16];
 char *astr1;
 
 astr1 = "146.64.24.3";
 h_err = inet_pton(AF_INET, astr1, ipnum);
 if(h_err == 0) {
 printf("conversion error with inet_pton()\n");
 exit(1);
 }
 
 he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
 if(he == NULL) {
 printf("Oops: %d.\n", h_err);
 herror("getipnodebyaddr");
 } else
 printf("And the answer is: %s\n", he-h_name);
 
 he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
 if(he == NULL) {
 printf("Oops: %d.\n", h_err);
 herror("getipnodebyaddr");
 } else
 printf("And the answer is: %s\n", he-h_name);
 
 return 0;
 }

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: resolver problem with shared linked programs

2001-02-28 Thread Larry Rosenman

* Matthew Thyer [EMAIL PROTECTED] [010228 07:26]:
 John Hay wrote:
  
  I noticed that sendmail started to complain of a failed reverse lookup
  when starting:
  
  Feb 28 11:40:43 beast sendmail[276]: 
gethostbyaddr(3ffe:2900:fffa:2:2a0:c9ff:fe8d:7c5f) failed: 2
  
  At first I thought something is wrong with my ipv6 dns setup, but it turned
  out that if a program is linked shared the first getipnodebyaddr() it does
  will succeed, but the rest fail. For a staticly linked program all of
  them will succeed:
 
 So it's in -CURRENT too.  -STABLE users have been complaining of a
 similar problem since about the 20th/21st of Feb.
 
 I was damned lucky that I skimmed:
 http://www.mail-archive.com/freebsd-stable%40freebsd.org/
 before I built a -STABLE system today.
 
 I'm cross posting to stable so others can try your program.
Bingo.  It breaks on -STABLE too.  

LER
$ uname -a
FreeBSD lerbsd.lerctr.org 4.2-STABLE FreeBSD 4.2-STABLE #108: Tue Feb
27 22:28:4
0 CST 2001 [EMAIL PROTECTED]:/usr/src/sys/compile/LERBSD  i386
$ cc -O -static -o x x.c
$ ./x
And the answer is: beast.icomtek.csir.co.za
And the answer is: beast.icomtek.csir.co.za
$ cc -O -o x x.c
$ time ./x
And the answer is: beast.icomtek.csir.co.za
Oops: 2.
getipnodebyaddr: Host name lookup failure
   81.12s real 0.00s user 0.00s system
$
 
 And I wont install my -CURRENT buildworld.
 
  
  #include sys/types.h
  #include sys/socket.h
  #include netinet/in.h
  #include arpa/inet.h
  #include netdb.h
  #include stdio.h
  
  int main(int argc, char **argv)
  {
  struct hostent *he;
  int h_err;
  u_char ipnum[16];
  char *astr1;
  
  astr1 = "146.64.24.3";
  h_err = inet_pton(AF_INET, astr1, ipnum);
  if(h_err == 0) {
  printf("conversion error with inet_pton()\n");
  exit(1);
  }
  
  he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
  if(he == NULL) {
  printf("Oops: %d.\n", h_err);
  herror("getipnodebyaddr");
  } else
  printf("And the answer is: %s\n", he-h_name);
  
  he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
  if(he == NULL) {
  printf("Oops: %d.\n", h_err);
  herror("getipnodebyaddr");
  } else
  printf("And the answer is: %s\n", he-h_name);
  
  return 0;
  }
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with "unsubscribe freebsd-stable" in the body of the message
-- 
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: resolver problem with shared linked programs

2001-02-28 Thread Jonathan Lemon

In article 
local.mail.freebsd-current/[EMAIL PROTECTED] you 
write:
At first I thought something is wrong with my ipv6 dns setup, but it turned
out that if a program is linked shared the first getipnodebyaddr() it does
will succeed, but the rest fail. For a staticly linked program all of
them will succeed:

I just fixed this a few minutes ago.
--
Jonathan

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: resolver problem with shared linked programs

2001-02-28 Thread Larry Rosenman

* Larry Rosenman [EMAIL PROTECTED] [010228 09:37]:
 * Matthew Thyer [EMAIL PROTECTED] [010228 07:26]:
  John Hay wrote:
   
   I noticed that sendmail started to complain of a failed reverse lookup
   when starting:
   
   Feb 28 11:40:43 beast sendmail[276]: 
gethostbyaddr(3ffe:2900:fffa:2:2a0:c9ff:fe8d:7c5f) failed: 2
   
   At first I thought something is wrong with my ipv6 dns setup, but it turned
   out that if a program is linked shared the first getipnodebyaddr() it does
   will succeed, but the rest fail. For a staticly linked program all of
   them will succeed:
  
  So it's in -CURRENT too.  -STABLE users have been complaining of a
  similar problem since about the 20th/21st of Feb.
  
  I was damned lucky that I skimmed:
  http://www.mail-archive.com/freebsd-stable%40freebsd.org/
  before I built a -STABLE system today.
  
  I'm cross posting to stable so others can try your program.
 Bingo.  It breaks on -STABLE too.  
 
 LER
 $ uname -a
 FreeBSD lerbsd.lerctr.org 4.2-STABLE FreeBSD 4.2-STABLE #108: Tue Feb
 27 22:28:4
 0 CST 2001 [EMAIL PROTECTED]:/usr/src/sys/compile/LERBSD  i386
 $ cc -O -static -o x x.c
 $ ./x
 And the answer is: beast.icomtek.csir.co.za
 And the answer is: beast.icomtek.csir.co.za
 $ cc -O -o x x.c
 $ time ./x
 And the answer is: beast.icomtek.csir.co.za
 Oops: 2.
 getipnodebyaddr: Host name lookup failure
81.12s real 0.00s user 0.00s system
Jonathan Lemon's res_send.c fix fixes this:

Welcome to FreeBSD!
$ ./x
And the answer is: beast.icomtek.csir.co.za
And the answer is: beast.icomtek.csir.co.za
$ cc -O -o x x.c
$ ./x
And the answer is: beast.icomtek.csir.co.za
And the answer is: beast.icomtek.csir.co.za
$ time ./x
And the answer is: beast.icomtek.csir.co.za
And the answer is: beast.icomtek.csir.co.za
0.00s real 0.00s user 0.00s system
$

 $
  
  And I wont install my -CURRENT buildworld.
  
   
   #include sys/types.h
   #include sys/socket.h
   #include netinet/in.h
   #include arpa/inet.h
   #include netdb.h
   #include stdio.h
   
   int main(int argc, char **argv)
   {
   struct hostent *he;
   int h_err;
   u_char ipnum[16];
   char *astr1;
   
   astr1 = "146.64.24.3";
   h_err = inet_pton(AF_INET, astr1, ipnum);
   if(h_err == 0) {
   printf("conversion error with inet_pton()\n");
   exit(1);
   }
   
   he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
   if(he == NULL) {
   printf("Oops: %d.\n", h_err);
   herror("getipnodebyaddr");
   } else
   printf("And the answer is: %s\n", he-h_name);
   
   he = getipnodebyaddr(ipnum, 4, AF_INET, h_err);
   if(he == NULL) {
   printf("Oops: %d.\n", h_err);
   herror("getipnodebyaddr");
   } else
   printf("And the answer is: %s\n", he-h_name);
   
   return 0;
   }
  
  To Unsubscribe: send mail to [EMAIL PROTECTED]
  with "unsubscribe freebsd-stable" in the body of the message
 -- 
 Larry Rosenman http://www.lerctr.org/~ler
 Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
 US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with "unsubscribe freebsd-stable" in the body of the message
-- 
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message