From: Daris Nevil <Daris.Nevil@snmc.com>
To: Tom Roberts <tjroberts@lucent.com>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Do you have your minimum ramdisk image which can provide basic network services ?
Date: Wed, 31 May 2000 10:35:32 -0500 [thread overview]
Message-ID: <39353143.DFE4BBB8@snmc.com> (raw)
In-Reply-To: 39351781.B4B61265@lucent.com
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@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/
prev parent reply other threads:[~2000-05-31 15:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-29 7:27 Do you have your minimum ramdisk image which can provide basic network services ? SangTae Ha
2000-05-29 7:56 ` Wolfgang Denk
2000-05-30 18:29 ` Tom Roberts
2000-05-30 18:39 ` Daris Nevil
2000-05-31 13:45 ` Tom Roberts
2000-05-31 15:35 ` Daris Nevil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39353143.DFE4BBB8@snmc.com \
--to=daris.nevil@snmc.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
--cc=tjroberts@lucent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.