gethostbyname misbehavior - what am i doing wrong.

gethostbyname misbehavior - what am i doing wrong.

Post by joe use » Mon, 25 Feb 2002 20:38:51



I recently noticed (using ethereal) that I was getting unexpected
DNS queries when I started ssh.  I wrote this following program
to try to isolate the problem.

It doesnt work correctly, I cant see why, please advise.


addresses for pages.ebay.com
alias: www.ebay.com
addr: ? x

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
extern int h_errno;

struct hostent *hent;

int main(int argc, char **argv)
{
   char **addr;
   char *p;
   int err;

   if (argc>1) {
     hent = gethostbyname(argv[1]);
     // hent = getipnodebyname(argv[1], AF_INET, 0, &err);
   }
   printf("addresses for %s\n", hent->h_name);

   for (addr = hent->h_aliases; *addr; addr++) {
     printf("alias: %s\n", *addr);
   }
   for (addr = hent->h_addr_list; *addr; addr++) {
     printf("addr: %s\n", *addr);
     /*
     for (p = *addr; *p; p++) {
       printf("%c,", *p);
     }
     printf("\n");
     */
   }
   // printf("addr: %s\n", hent->h_addr);

Quote:}

 
 
 

gethostbyname misbehavior - what am i doing wrong.

Post by Karl Heye » Tue, 26 Feb 2002 01:16:56



> I recently noticed (using ethereal) that I was getting unexpected
> DNS queries when I started ssh.  I wrote this following program
> to try to isolate the problem.

> It doesnt work correctly, I cant see why, please advise.


> addresses for pages.ebay.com
> alias: www.ebay.com
> addr: ? x

what is the question?  it seems to be doing what is expected from your
description.   The addr is supposed to be numeric no chars but that is
only a display bug.

Are you seeing traffic that shouldn't be there?

karl.

 
 
 

1. Dual Homed Linux - what am I doing wrong?

I have a RH 5.0 Linux PC setup with two Ethernet interfaces configured and
connected to two different LANs. Each LAN has a way out to the Internet, and
I've disabled IP forwarding on Linux to prevent the PC from routing between
the two LANs (which is my intention). The routing table entries for the first
LAN (eth0) simply has the usual loopback and LAN entries, and a default route
pointing to the gateway to the Internet. This works just fine.

On the eth1 interface, I have set up the Cisco router on the second LAN to use
RIP to broadcast routes on the second LAN. I then configure Linux to run
routed with -q (listen only) so that it can pick up the RIP routes and know to
use the second interface for routes to networks serviced by the Cisco. This
isn't working.

When I start routed -q, I end up with a route to the serial side of the Cisco
(that's good) and a second default route pointing to the Cisco on eth1 is
created (not good). With two default routes, Linux seems to pick the first
available default route when it doesn't know where to go - hence, all my
traffic continues out the eth0 interface when a better path is available on
eth1.

The route table never fills with routes known by the Cisco, so my question is
what am I doing wrong? Is this a known problem with Linux? Why is it creating
a second (and useless) default route instead of filling up with routes learned
via RIP?

Dan Peterka

2. IDE drive problem?

3. Am I doing something wrong?? - (SAMBA)

4. ADVERTISE TO OVER 100 MILLION PEOPLE FOR FREE!!!

5. One more question - What am I doing wrong?

6. patch for "Calibrating delay loop" ...

7. KNode (No Caching) - What am I doing no wrong

8. Access Restrictions!!

9. What am I doing wrong?????

10. Ip-Masquerade and games over the net...what am I doing wrong????????

11. What I am doing wrong?

12. sendmail config -- what am I doing wrong?

13. What am I doing wrong?