Do you have your minimum ramdisk image which can provide basic network services ?

Daris Nevil Daris.Nevil at snmc.com
Thu Jun 1 01:35:32 EST 2000


Tom,

I'm not sure what the Resolver Error 0 zero is either. I don't
remember seeing that one.

However, I do know that you don't need inetd for ping.  If you
want to use ping the way it is then you will need the nss
libraries in addition to your /etc/protocols file.  I cheated and
hacked ping.c and hard-coded the icmp protocol number.  The
patch for the hack is included below.

Daris Nevil
SiSIC Inc/SNMC

----------------------------------------------


Patch for ping.c that removes the need for /etc/protocols and nss
libraries.
By Daris Nevil (dnevil at snmc.com)
To patch:
        cd netkit-base-0.10/ping
        patch -Np1 < ping-no-protocols.patch


--- ping.old    Tue May 30 22:26:48 2000
+++ ping.c      Tue May 30 22:26:54 2000
@@ -87,6 +87,7 @@
  */
 #ifdef __linux__
 #define SAFE_TO_DROP_ROOT
+#define NO_PROTOCOLS   // Elimnates the need for /etc/protocols and nss
libs
 #endif

 #if defined(__GLIBC__) && (__GLIBC__ >= 2)
@@ -223,13 +224,16 @@
        /*
         * Pull this stuff up front so we can drop root if desired.
         */
+#ifdef NO_PROTOCOLS
        setprotoent(0);  // Leave the /etc/protocols file open

        if (!(proto = getprotobyname("icmp"))) {
                (void)fprintf(stderr, "ping: unknown protocol icmp.\n");
                exit(2);
        }
-
+#else
+       proto->p_proto = 1; // ICMP, from /etc/protocols
+#endif
        if ((s = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0) {
                if (errno==EPERM) {
                        fprintf(stderr, "ping: ping must run as root\n");


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list