Subject: Re: icmp problems

From: [email-masked]
Date: Tue, 20 Jul 1999 09:13:31 +0100

>    I'm having some problems with ICMP - if I try to ping my arm
>linux box it sends back a valid ARP reply, but the ECHO REPLY packet
>is corrupt. Also, if I try to ping from the arm linux box it just
>prints out "icmp: unknown protocol".

I had the same problem: In the ping program, there is a function called
getprotobyname ("protocol-name"). It is called like that:
     proto = getprotobyname("icmp") ; ( I think this is where your program
stops)
This function looks for the protocol icmp in the /etc/protocols file, and return
a struct with information comming from this file (name of the protocol, number
of the protocol, aliases). In this structure, the only useful information is the
number of the protocol. For icmp, it is 1 (see in /etc/protocols). It is just
used in the line below to open a socket.
     So, this function  didn't work ( and I still don't know why !!!), To get
ping working, I modify the proto->p_proto argument by 1 in the opening of the
socket ( very bad isn't it ?!!!).

     Well, all this story to tell you that I don't know how to solve neatly this
problem.

I have the same problem with ftp ( and so one...) because a lot of network
programs use an another function called getservbyname ( it is more or less the
same than getprotobyname, except looking in /etc/services). I tried to find
where these functions are defined, but they are both defined as "extern", and
there is no more definition. Does anybody know what does that mean ? It is
defined in a module that should be inserted in the kernel ?

cheers
Arnaud

PS: May be the getprotobyname doesn't look directly in /etc/protocols, but first
in /etc/nsswitch.conf ?

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: Philip Blundell <[email-masked]>
Date: Tue, 20 Jul 1999 09:58:45 +0100

>PS: May be the getprotobyname doesn't look directly in /etc/protocols, but 
>first in /etc/nsswitch.conf ?

If you are using libc 6 then yes, calls like getprotobyname use nsswitch.conf 
to determine where to look.  I don't think this is the case with libc 4, 
though I could be wrong about that.

You can probably find out what's going on by using strace on the failing 
program.

>defined in a module that should be inserted in the kernel ?

They are provided by the shared C library.  See the glibc manual.

p.