Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
Index: Makefile
===================================================================
--- Makefile	(nonexistent)
+++ Makefile	(revision 5)
@@ -0,0 +1,56 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../build-system/constants.mk
+
+
+url         = $(DOWNLOAD_SERVER)/sources/packages/n/icmpinfo
+
+versions    = 1.11
+pkgname     = icmpinfo
+suffix      = tar.gz
+
+tarballs    = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s       = $(addsuffix .sha1sum, $(tarballs))
+
+patches     = $(CURDIR)/patches/icmpinfo-1.11.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+	@echo -e "\n======= Downloading source tarballs =======" ; \
+	 for tarball in $(tarballs) ; do \
+	   echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+	 done ; wait
+
+$(sha1s): $(tarballs)
+	@for sha in $@ ; do \
+	   echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+	   echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+	   touch $$sha ; \
+	   echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+	   sha1sum --check $$sha ; ret="$$?" ; \
+	   if [ "$$ret" == "1" ]; then \
+	     echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+	     exit 1 ; \
+	   fi ; \
+	 done
+
+$(patches): $(sha1s)
+	@echo -e "\n======= Create Patches =======\n" ; \
+	 ( cd create-1.11-patch ; ./create.patch.sh ) ; \
+	 echo -e "\n"
+
+download_clean:
+	@rm -f $(tarballs) $(sha1s) $(patches)
Index: create-1.11-patch/create.patch.sh
===================================================================
--- create-1.11-patch/create.patch.sh	(nonexistent)
+++ create-1.11-patch/create.patch.sh	(revision 5)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=1.11
+
+tar --files-from=file.list -xzvf ../icmpinfo-$VERSION.tar.gz
+mv icmpinfo-$VERSION icmpinfo-$VERSION-orig
+
+cp -rf ./icmpinfo-$VERSION-new ./icmpinfo-$VERSION
+
+diff --unified -Nr  icmpinfo-$VERSION-orig  icmpinfo-$VERSION > icmpinfo-$VERSION.patch
+
+mv icmpinfo-$VERSION.patch ../patches
+
+rm -rf ./icmpinfo-$VERSION
+rm -rf ./icmpinfo-$VERSION-orig

Property changes on: create-1.11-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: create-1.11-patch/file.list
===================================================================
--- create-1.11-patch/file.list	(nonexistent)
+++ create-1.11-patch/file.list	(revision 5)
@@ -0,0 +1,8 @@
+icmpinfo-1.11/Makefile
+icmpinfo-1.11/defs.h
+icmpinfo-1.11/err.c
+icmpinfo-1.11/icmpinfo.c
+icmpinfo-1.11/icmpinfo.man
+icmpinfo-1.11/linux_ip_icmp.h
+icmpinfo-1.11/print.c
+icmpinfo-1.11/recvping.c
Index: create-1.11-patch/icmpinfo-1.11-new/Makefile
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/Makefile	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/Makefile	(revision 5)
@@ -0,0 +1,41 @@
+#
+# Minimal makefile for 'icmpinfo'
+#   a tool to look at the icmp you receive
+#   modified from BSD ping by Laurent Demailly
+#				<dl@hplyot.obspm.fr>
+#
+# see man page & README (Installation section at least)
+
+VERS = 1.11
+
+# You may need to add libraries here :
+# like for Solaris, uncomment next line :
+#LDLIBS= -lsocket -lnsl
+
+# To override default compiler flags :
+#CFLAGS=-O2 -s
+
+# To change default compiler
+#CC=gcc
+
+RM = rm -f
+
+LDFLAGS= $(CFLAGS)
+
+OBJECTS= recvping.o print.o err.o icmpinfo.o pid.o
+TARGET = icmpinfo
+
+$(TARGET):  $(OBJECTS)
+	$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
+
+tgz: clean
+	rm -f CHECKSUMS.asc
+	md5sum * > ../CHECKSUMS
+	mv ../CHECKSUMS .
+	pgp -asw CHECKSUMS
+	chmod 444 CHECKSUMS.asc
+	cd .. ; tar cvf icmpinfo-$(VERS).tar icmpinfo-$(VERS) ; gzip icmpinfo-$(VERS).tar
+
+clean:
+	$(RM) $(OBJECTS) $(TARGET) core *~
+
Index: create-1.11-patch/icmpinfo-1.11-new/defs.h
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/defs.h	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/defs.h	(revision 5)
@@ -0,0 +1,78 @@
+/*
+ * Includes, defines and global variables used between functions.
+ */
+
+#include <stdio.h>
+#include <stdlib.h> /* exit */
+#include <errno.h>
+extern int	errno;
+
+#include <time.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/file.h>
+
+/* On Linux you might also need to symlink /usr/include/netinet/in_system.h
+   to /usr/src/linux/include/linux/in_system.h */
+#include <netinet/in_systm.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+/* maybe change this when linux will include a complete include tree : */
+#ifdef linux
+#include "linux_ip_icmp.h"
+#else
+#include <netinet/ip_icmp.h>
+#endif
+#include <netinet/tcp.h>
+#include <netdb.h>
+
+#include <syslog.h>
+#include <unistd.h>
+
+/*
+ * Beware that the outgoing packet starts with the ICMP header and
+ * does not include the IP header (the kernel prepends that for us).
+ * But, the received packet includes the IP header.
+ */
+
+#define	MAXPACKET	4096	/* max packet size */
+
+#ifndef DCLARE
+#define DCLARE extern
+#endif
+
+DCLARE int		verbose;	/* enables additional error messages */
+
+DCLARE u_char		recvpack[MAXPACKET];	/* the received packet */
+
+DCLARE int			sockfd;	/* socket file descriptor */
+
+char		*inet_ntoa();	/* BSD library routine */
+
+DCLARE int     nonamequery;  /*  flag for query/noquery of ip -> name */
+DCLARE int     showsrcip;    /*  flag for showing or not src ip */
+DCLARE int     syslogdoutput; /* flag for stdoutput / syslogd output */
+DCLARE int     noportquery;   /* flag for query/noquery of port -> serv name */
+
+/* on some hosts (linux) netinet/ip_icmp.h is missing/empty : */
+#ifndef ICMP_MINLEN
+int bug=You_need_an_non_empty_netinet_ip_icmp_h;
+#endif
+
+/*
+  pid.c:
+ */
+extern void pid_file(void);
+extern void pid_kill(void);
+
+/*
+  err.c:
+ */
+extern int err_quit(char *str);
+extern int err_sys(char *str);
+extern int err_ret(char *str);
+
+/*
+  recvping.c:
+ */
+extern int recv_ping(void);
Index: create-1.11-patch/icmpinfo-1.11-new/err.c
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/err.c	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/err.c	(revision 5)
@@ -0,0 +1,25 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+extern char *pname;
+
+int err_quit(str)
+	char *str;
+{
+  fprintf(stderr,"%s: %s\n",pname,str);
+  exit(1);
+}
+int err_sys(str)
+        char *str;
+{
+  perror(pname);
+  fprintf(stderr,"\t%s\n",str);
+  exit(2);
+}
+int err_ret(str)
+	char *str;
+{
+  fprintf(stderr,"%s: %s\n",pname,str);
+  return 0;
+}
Index: create-1.11-patch/icmpinfo-1.11-new/icmpinfo.c
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/icmpinfo.c	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/icmpinfo.c	(revision 5)
@@ -0,0 +1,146 @@
+/*
+ * icmpinfo
+ *    It is a tool to look at the icmp you receive
+ *    Its source comes from a modified BSD ping source by Laurent Demailly
+ *
+ *              it comes AS IS - no warranty, etc...
+ *                    <dl@hplyot.obspm.fr>
+ *
+ * see the README for usage infos...etc...
+ *
+ */
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1987 Regents of the University of California.\n\
+ All rights reserved.\n augmented 4/94 by dl\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)ping.c	4.10 (Berkeley) 10/10/88 - $Author: icmpinfo-1.11- Laurent Demailly <dl@hplyot.obspm.fr>$";
+#endif /* not lint */
+
+#define DCLARE /* def : */
+
+#include  <stdlib.h>
+#include  "defs.h"
+
+/*
+ *			P I N G . C
+ *
+ * Using the InterNet Control Message Protocol (ICMP) "ECHO" facility,
+ * measure round-trip-delays and packet loss across network paths.
+ *
+ * Author -
+ *	Mike Muuss
+ *	U. S. Army Ballistic Research Laboratory
+ *	December, 1983
+ * Modified at Uc Berkeley
+ *
+ * Status -
+ *	Public Domain.  Distribution Unlimited.
+ *
+ * Bugs -
+ *	More statistics could always be gathered.
+ *	This program has to run SUID to ROOT to access the ICMP socket.
+ */
+
+char	usage[] = "Usage:  icmpinfo [-v[v[v]]] [-s] [-n] [-p] [-l] [-k]\n   -v : more and more info\n   -s : show local interface address\n   -n : no name query (dot ip only)\n   -p : no port -> service name query\n   -l : fork + syslog output\n   -k : kill background process\nv1.11 - 8/1995 - dl";
+char	*pname;
+
+int main(argc, argv)
+int	argc;
+char	**argv;
+{
+	int			sockoptions, on;
+	struct protoent		*proto;
+
+	on = 1;
+	pname = argv[0];
+	argc--;
+	argv++;
+
+	sockoptions=nonamequery=noportquery=syslogdoutput=showsrcip=0;
+	while (argc > 0 && *argv[0] == '-') {
+		while (*++argv[0]) switch (*argv[0]) {
+			case 'd':
+				sockoptions |= SO_DEBUG;
+				break;
+			case 'r':
+				sockoptions |= SO_DONTROUTE;
+				break;
+			case 'v':
+				verbose++;
+				break;
+			case 'n':
+				nonamequery++;
+				break;
+			case 'p':
+				noportquery++;
+				break;
+			case 'l':
+				syslogdoutput++;
+				break;
+			case 's':
+				showsrcip++;
+				break;
+			case 'k':
+				pid_kill();
+				exit(0);
+				break;
+			case 'h':
+		        default :
+				err_quit(usage);
+		}
+		argc--, argv++;
+	}
+	if (argc!=0) err_quit(usage);
+	if ( (proto = getprotobyname("icmp")) == NULL)
+		err_quit("unknown protocol: icmp");
+	if ( (sockfd = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0)
+		err_sys("can't create raw socket (root and/or bit s needed)");
+	if (sockoptions & SO_DEBUG)
+		if (setsockopt(sockfd, SOL_SOCKET, SO_DEBUG, &on,
+								sizeof(on)) < 0)
+			err_sys("setsockopt SO_DEBUG error");
+	if (sockoptions & SO_DONTROUTE)
+		if (setsockopt(sockfd, SOL_SOCKET, SO_DONTROUTE, &on,
+								sizeof(on)) < 0)
+			err_sys("setsockopt SO_DONTROUTE error");
+
+	if (syslogdoutput) {
+	  if (getuid()!=0)
+	    err_quit("You need root id to use the syslog/daemon -l option");
+	  if (fork()) {exit(0);}
+	  /* Can't check openlog & syslog retcodes 'cause lot of
+             unixes have void openlog(); and void syslog(); !! */
+	  openlog("icmpinfo",0,LOG_DAEMON);
+	  syslog(LOG_NOTICE,"started, PID=%d.",getpid());
+	  setsid();
+	  pid_file();
+	  close(0);
+	  close(1);
+	  close(2);
+	} else {
+	    printf("icmpinfo: Icmp monitoring in progress...\n");
+	}
+	recv_ping();	/* and start the receive */
+	/* NOTREACHED */
+	return(0);
+}
Index: create-1.11-patch/icmpinfo-1.11-new/icmpinfo.man
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/icmpinfo.man	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/icmpinfo.man	(revision 5)
@@ -0,0 +1,76 @@
+.TH ICMPINFO 1 "V1.11 - 17 August 1995" "dl's free utilities"
+.SH NAME
+
+icmpinfo \- interpret ICMP messages
+
+.SH SYNOPSIS
+
+.B icmpinfo
+[\-v[v[v]]] [\-n] [\-p] [\-s] [\-l] [\-k]
+
+.SH DESCRIPTION
+.BR Icmpinfo
+is a tool for looking at the ICMP messages received
+on the running host.
+It can be used to detect and record 'bombs'
+as well as various network problems.
+
+The output format is as follows (all on one line):
+
+  MMM DD HH:MM:SS ICMP_type[sub-type]
+.br
+	< sender_ip [sender_name] > unreach_ip [unreach_name]
+.br
+	sp=source_port dp=dest_port seq=sequence sz=packet_size
+
+In normal operation,
+.B icmpinfo
+will only report on "weird" packets, mainly icmp_unreachable.
+
+.SH OPTIONS
+.TP
+.I "\-v"
+Give information about all icmp packets, excepts pings.
+
+.TP
+.I "\-vv"
+Give about pings too (i.e. icmp_echo_reply).
+
+.TP
+.I "\-vvv"
+Include an ascii/hex dump of each packet
+
+.TP
+.I "\-n"
+Avoid name queries - just give IP addresses.
+(use this option when running unattended on name server hosts (to avoid
+possible looping))
+
+.TP
+.I "\-p"
+Avoid port number to service name decoding.
+
+.TP
+.I "\-s"
+Show the interface ip that received the packet. Usefull only if your
+host has several network interfaces. In this case an '- my_ip
+[my_name]' is added between the sender and unreach ip and name fields.
+
+.TP
+.I "\-l"
+Forks and use the syslog(3) facility to record events (recomended use).
+(root only option).
+
+.TP
+.I "\-k"
+Kills the background process started with the
+.I "\-l"
+option.
+
+.SH WARNINGS
+The packet decoding is planned for ICMP Unreachable outputs and might
+not be significant for all other Icmp types. Output can be shorter
+when implied by the packet size or the icmp type.
+
+.SH AUTHOR
+Laurent Demailly <dl@hplyot.obspm.fr>. Free software.
Index: create-1.11-patch/icmpinfo-1.11-new/linux_ip_icmp.h
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/linux_ip_icmp.h	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/linux_ip_icmp.h	(revision 5)
@@ -0,0 +1,107 @@
+/* stolen from tcpdump */
+
+#ifndef _netinet_ip_icmp_h
+#define _netinet_ip_icmp_h
+
+#include <netinet/ip.h>
+
+struct icmp {
+	u_char	icmp_type;		/* type of message, see below */
+	u_char	icmp_code;		/* type sub code */
+	u_short	icmp_cksum;		/* ones complement cksum of struct */
+	union {
+		u_char ih_pptr;			/* ICMP_PARAMPROB */
+		struct in_addr ih_gwaddr;	/* ICMP_REDIRECT */
+		struct ih_idseq {
+			n_short	icd_id;
+			n_short	icd_seq;
+		} ih_idseq;
+		int ih_void;
+	} icmp_hun;
+#define	icmp_pptr	icmp_hun.ih_pptr
+#define	icmp_gwaddr	icmp_hun.ih_gwaddr
+#define	icmp_id		icmp_hun.ih_idseq.icd_id
+#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
+#define	icmp_void	icmp_hun.ih_void
+
+#if 0
+struct ip {
+        u_char  ip_hl:4,                /* header length */
+        ip_v:4;                 /* version */
+        u_char  ip_tos;                 /* type of service */
+        short   ip_len;                 /* total length */
+        u_short ip_id;                  /* identification */
+        short   ip_off;                 /* fragment offset field */
+#define IP_DF 0x4000                    /* dont fragment flag */
+#define IP_MF 0x2000                    /* more fragments flag */
+        u_char  ip_ttl;                 /* time to live */
+        u_char  ip_p;                   /* protocol */
+        u_short ip_sum;                 /* checksum */
+        struct  in_addr ip_src,ip_dst;  /* source and dest address */
+      };
+#endif
+
+
+	union {
+		struct id_ts {
+			n_time its_otime;
+			n_time its_rtime;
+			n_time its_ttime;
+		} id_ts;
+		struct id_ip  {
+			struct ip idi_ip;
+			/* options and then 64 bits of data */
+		} id_ip;
+		u_long	id_mask;
+		char	id_data[1];
+	} icmp_dun;
+#define	icmp_otime	icmp_dun.id_ts.its_otime
+#define	icmp_rtime	icmp_dun.id_ts.its_rtime
+#define	icmp_ttime	icmp_dun.id_ts.its_ttime
+#define	icmp_ip		icmp_dun.id_ip.idi_ip
+#define	icmp_mask	icmp_dun.id_mask
+#define	icmp_data	icmp_dun.id_data
+};
+
+#define	ICMP_MINLEN	8				/* abs minimum */
+#define	ICMP_TSLEN	(8 + 3 * sizeof (n_time))	/* timestamp */
+#define	ICMP_MASKLEN	12				/* address mask */
+#define	ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)	/* min */
+#define	ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+	/* N.B.: must separately check that ip_hl >= 5 */
+
+#define	ICMP_ECHOREPLY		0		/* echo reply */
+#define	ICMP_UNREACH		3		/* dest unreachable, codes: */
+#define		ICMP_UNREACH_NET	0		/* bad net */
+#define		ICMP_UNREACH_HOST	1		/* bad host */
+#define		ICMP_UNREACH_PROTOCOL	2		/* bad protocol */
+#define		ICMP_UNREACH_PORT	3		/* bad port */
+#define		ICMP_UNREACH_NEEDFRAG	4		/* IP_DF caused drop */
+#define		ICMP_UNREACH_SRCFAIL	5		/* src route failed */
+#define	ICMP_SOURCEQUENCH	4		/* packet lost, slow down */
+#define	ICMP_REDIRECT		5		/* shorter route, codes: */
+#define		ICMP_REDIRECT_NET	0		/* for network */
+#define		ICMP_REDIRECT_HOST	1		/* for host */
+#define		ICMP_REDIRECT_TOSNET	2		/* for tos and net */
+#define		ICMP_REDIRECT_TOSHOST	3		/* for tos and host */
+#define	ICMP_ECHO		8		/* echo service */
+#define	ICMP_TIMXCEED		11		/* time exceeded, code: */
+#define		ICMP_TIMXCEED_INTRANS	0		/* ttl==0 in transit */
+#define		ICMP_TIMXCEED_REASS	1		/* ttl==0 in reass */
+#define	ICMP_PARAMPROB		12		/* ip header bad */
+#define	ICMP_TSTAMP		13		/* timestamp request */
+#define	ICMP_TSTAMPREPLY	14		/* timestamp reply */
+#define	ICMP_IREQ		15		/* information request */
+#define	ICMP_IREQREPLY		16		/* information reply */
+#define	ICMP_MASKREQ		17		/* address mask request */
+#define	ICMP_MASKREPLY		18		/* address mask reply */
+
+#define	ICMP_MAXTYPE		18
+
+#define	ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#endif /*!_netinet_ip_icmp_h*/
Index: create-1.11-patch/icmpinfo-1.11-new/pid.c
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/pid.c	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/pid.c	(revision 5)
@@ -0,0 +1,56 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#define PIDFILE                 "/var/run/icmpinfo.pid"
+
+extern char *pname;
+
+void sig_handler(int);
+void pid_file(void);
+void pid_kill(void);
+
+void pid_file(void)
+{
+    FILE *fp;
+
+    if ((fp = fopen(PIDFILE, "w")) != (FILE *)NULL) {
+        fprintf(fp, "%d\n", getpid());
+        fclose(fp);
+    }
+    else
+    {
+        fprintf(stderr, "\n%s: Could not write PID file `%s', terminating.\n",
+            pname, PIDFILE);
+        exit(1);
+    }
+    signal(SIGHUP, sig_handler);
+    signal(SIGINT, sig_handler);
+    signal(SIGTERM, sig_handler);
+}
+
+void sig_handler(int sig)
+{
+    unlink(PIDFILE);
+    exit(0);
+}
+
+void pid_kill(void)
+{
+    FILE *fp;
+    int pid;
+
+    if ((fp = fopen(PIDFILE, "r")) != (FILE *)NULL)
+    {
+        if (fscanf(fp, "%d", &pid) == 1)
+        {
+            kill(pid, SIGHUP);
+            sleep(1);
+        }
+        fclose(fp);
+    }
+}
+
Index: create-1.11-patch/icmpinfo-1.11-new/print.c
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/print.c	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/print.c	(revision 5)
@@ -0,0 +1,286 @@
+/*
+ * Show ICMP packets incoming (and detect bombs)
+ *   modified from ping
+ *   1994/1995 - Laurent Demailly - <dl@hplyot.obspm.fr>
+ */
+
+/* note : the original bsd code was *very* buggy !!!
+          it should be ok, now */
+
+/*
+ * Print out the packet, if it came from us.  This logic is necessary
+ * because ALL readers of the ICMP socket get a copy of ALL ICMP packets
+ * which arrive ('tis only fair).  This permits multiple copies of this
+ * program to be run without having intermingled output (or statistics!).
+ */
+
+#include <string.h>
+#include <stddef.h> /* offsetof */
+#include	"defs.h"
+
+#ifndef ANSI_OFFSETOF
+#ifndef offsetof
+#        define offsetof(t,m)  (int)((&((t *)0L)->m))
+#endif
+#endif
+
+char to_hex(a)
+  int a;
+{
+  return ((char)(a <= 9 ? a + '0' : (a -10) + 'A'));
+}
+
+int pr_pack(buf, cc, from)
+char			*buf;	/* ptr to start of IP header */
+int			cc;	/* total size of received packet */
+struct sockaddr_in	*from;	/* address of sender */
+{
+  int			iphdrlen,doipdecoding=1;
+  struct ip		*ip;	/* ptr to IP header */
+  register struct icmp	*icp;	/* ptr to ICMP header */
+  struct tcphdr 	*tp;    /* ptr to TCP header */
+  time_t			t;
+  char			*pr_type(),*pr_subtype(),*strtime;
+  struct hostent	*hostent=NULL;
+  struct servent	*servent=NULL;
+  static char prbuf[1024];	/* provide enough room for even the longest hosts*/
+	
+  /*
+   * We have to look at the IP header, to get its length.
+   * We also verify that what follows the IP header contains at
+   * least an ICMP header (8 bytes minimum).
+   */
+  ip = (struct ip *) buf;
+  iphdrlen = ip->ip_hl << 2;	/* convert # 16-bit words to #bytes */
+  if (cc < iphdrlen + ICMP_MINLEN) {
+    sprintf(prbuf,"packet too short (%d bytes) from %s", cc,
+	    inet_ntoa(from->sin_addr));
+    if (syslogdoutput) {
+      syslog(LOG_WARNING,"%s",prbuf);
+      } else {
+	puts(prbuf);
+	fflush(stdout);
+      }
+    return -1;
+  }
+  cc -= iphdrlen;
+
+  icp = (struct icmp *)(buf + iphdrlen);
+  switch (icp->icmp_type) 
+    {
+    case ICMP_ECHO :
+    case ICMP_ECHOREPLY :
+      doipdecoding=0;
+      if (verbose<2) break;
+    case ICMP_SOURCEQUENCH :
+    case ICMP_TIMXCEED : 
+    case ICMP_REDIRECT :
+      if (!verbose) break;
+    default :
+      if (!nonamequery) {
+	hostent=gethostbyaddr((char*)&(from->sin_addr.s_addr),
+			      sizeof (struct in_addr),
+			      AF_INET);
+      }
+      if (!syslogdoutput) {
+	t=time((time_t *)NULL); strtime=(char *)ctime(&t);
+	strtime+=4;		/* skip day name */
+	strtime[15]=0;		/* keep MMM DD HH:MM:SS */
+        printf("%s ",strtime);
+      }
+      sprintf(prbuf,hostent?"ICMP_%s%s < %s [%s]":"ICMP_%s%s < %s",
+	      pr_type(icp->icmp_type),
+	      icp->icmp_type==ICMP_UNREACH?pr_subtype(icp->icmp_code):"",
+	      inet_ntoa(from->sin_addr),
+	      hostent?hostent->h_name:NULL
+	      );
+      if ( doipdecoding && 
+           ( cc >= offsetof(struct icmp,icmp_ip.ip_src)+sizeof(icp->icmp_ip.ip_dst) ) )
+	{
+	  if (showsrcip) 
+	    { /*  icp->icmp_ip.ip_src.s_addr == local host, show it
+		  only if requested (might be usefull for host with several
+		  interfaces */
+	      if (!nonamequery) {
+		hostent=gethostbyaddr((char*)&(icp->icmp_ip.ip_src.s_addr),
+				      sizeof (struct in_addr),
+				      AF_INET);
+	      }
+	      sprintf(prbuf+strlen(prbuf),hostent?" - %s [%s]":" - %s",
+		      inet_ntoa(icp->icmp_ip.ip_src),
+		      hostent?hostent->h_name:NULL);
+	    }
+	  if (cc>=offsetof(struct icmp,icmp_ip.ip_dst)+sizeof(icp->icmp_ip.ip_dst))
+	    {
+	      if (!nonamequery) {
+		hostent=gethostbyaddr((char*)&(icp->icmp_ip.ip_dst.s_addr),
+				      sizeof (struct in_addr),
+				      AF_INET);
+	      }
+	      sprintf(prbuf+strlen(prbuf),hostent?" > %s [%s]":" > %s",
+		      inet_ntoa(icp->icmp_ip.ip_dst),
+		      hostent?hostent->h_name:NULL);
+	      tp = (struct tcphdr *)((char *)&(icp->icmp_dun)+sizeof(struct ip)) ;
+#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+	      if (cc>=offsetof(struct icmp,icmp_dun)+sizeof(struct ip)+offsetof(struct tcphdr,seq)+sizeof(tp->seq))
+		{
+		  if (noportquery) {
+		      sprintf(prbuf+strlen(prbuf)," sp=%d dp=%d seq=0x%8.8x",
+			  ntohs(tp->source),ntohs(tp->dest),
+                          ntohl(tp->seq));
+		  } else {
+		    if ((servent=getservbyport(ntohs(tp->source),NULL))) 
+		      sprintf(prbuf+strlen(prbuf)," sp=%d [%s]",
+			      ntohs(tp->source),servent->s_name);
+		    else
+		      sprintf(prbuf+strlen(prbuf)," sp=%d",tp->source);
+		    if ((servent=getservbyport(ntohs(tp->dest),NULL))) 
+		      sprintf(prbuf+strlen(prbuf)," dp=%d [%s] seq=0x%8.8x",
+			      ntohs(tp->dest),servent->s_name,
+			      ntohl(tp->seq));
+		    else
+		      sprintf(prbuf+strlen(prbuf)," dp=%d seq=0x%8.8x",
+			      ntohs(tp->dest),ntohl(tp->seq));
+		  }
+		}
+#else
+	      if (cc>=offsetof(struct icmp,icmp_dun)+sizeof(struct ip)+offsetof(struct tcphdr,th_seq)+sizeof(tp->th_seq))
+		{
+		  if (noportquery) {
+		      sprintf(prbuf+strlen(prbuf)," sp=%d dp=%d seq=0x%8.8x",
+			  ntohs(tp->th_sport),ntohs(tp->th_dport),
+                          ntohl(tp->th_seq));
+		  } else {
+		    if ((servent=getservbyport(ntohs(tp->th_sport),NULL))) 
+		      sprintf(prbuf+strlen(prbuf)," sp=%d [%s]",
+			      ntohs(tp->th_sport),servent->s_name);
+		    else
+		      sprintf(prbuf+strlen(prbuf)," sp=%d",tp->th_sport);
+		    if ((servent=getservbyport(ntohs(tp->th_dport),NULL))) 
+		      sprintf(prbuf+strlen(prbuf)," dp=%d [%s] seq=0x%8.8x",
+			      ntohs(tp->th_dport),servent->s_name,
+			      ntohl(tp->th_seq));
+		    else
+		      sprintf(prbuf+strlen(prbuf)," dp=%d seq=0x%8.8x",
+			      ntohs(tp->th_dport),ntohl(tp->th_seq));
+		  }
+		}
+#endif
+	    }
+	}
+      sprintf(prbuf+strlen(prbuf)," sz=%d(+%d)",cc,iphdrlen);
+      if (syslogdoutput) {
+	  syslog(LOG_NOTICE,"%s",prbuf);
+	} else {
+	  puts(prbuf);
+	  fflush(stdout);
+	  if (verbose>2) {	/* hexa dump adapted from a file dump by dl (me!) */
+	    /* certainly not the smartest around, but it works !*/
+	    static char	h[] = "                                          ";
+	    static char	a[] = "                ";
+	    int	i,j,b,n, flagNEof;
+	    unsigned char	*pbuf=(unsigned char *)buf;
+	
+	    n = 0;
+	    flagNEof = 1;
+	    while (flagNEof) {
+	      i = j = 0;
+	      while (i < 16 && (flagNEof = cc--)) {
+		b= (int)(*(pbuf++));
+		h[j++] = to_hex(b >> 4);
+		h[j++] = to_hex(b & 0x0F);
+		j += i % 2 + ((i == 7) << 1);
+		a[i++] = (b > 31 && b < 127) ? b : '.';
+	      }
+	      if (i==0) break;
+	      while (i < 16) {
+		h[j++] = ' ';
+		h[j++] = ' ';
+		j += i % 2 + ((i == 7) << 1);
+		a[i++] = ' ';
+	      }
+	      printf("%04X :  %s   %s\n", n, h, a);
+	      n += 16;
+	    }
+	  }
+	}
+    }
+  return 0;
+}
+
+/*
+ * Convert an ICMP "type" field to a printable string.
+ * This is called for ICMP packets that are received that are not
+ * ICMP_ECHOREPLY packets.
+ */
+
+char *
+pr_type(t)
+register int t;
+{
+	static char	*ttab[] = {
+		"Echo_Reply",
+		"1",
+		"2",
+		"Dest_Unreachable",
+		"Source_Quench",
+		"Redirect",
+		"6",
+		"7",
+		"Echo",
+		"RouterAdvert",
+		"Router_Solicit",
+		"Time_Exceeded",
+		"Parameter_Problem",
+		"Timestamp",
+		"Timestamp_Reply",
+		"Info_Request",
+		"Info_Reply",
+		"Mask_Request",
+		"Mask_Reply"
+	};
+
+	if (t < 0 || t > 18) {
+	  static char buf[80];
+	  sprintf(buf,"OUT_OF_RANGE(%d)",t);
+	  return(buf);
+	}
+	return(ttab[t]);
+}
+
+/*
+ * Convert an ICMP UNREACH sub-"type" field to a printable string.
+ */
+
+char *
+pr_subtype(t)
+register int t;
+{
+	static char	*ttab[] = {
+	  "Net",
+	  "Host",
+	  "Protocol",
+	  "Port",
+	  "Frag",
+	  "Source",
+	  "DestNet",
+	  "DestHost",
+	  "Isolated",
+	  "AuthNet",
+	  "AuthHost",
+	  "NetSvc",
+	  "HostSvc",
+	  "Filtered",
+	  "PrecdViolation",
+	  "PrecdCut"
+	  };
+	static char buf[80];
+	
+	if (t < 0 || t > 15) {
+	  sprintf(buf,"[OUT_OF_RANGE(%d)]",t);
+	} else {
+	  sprintf(buf,"[%s]",ttab[t]);
+        }
+	return(buf);
+}
+
Index: create-1.11-patch/icmpinfo-1.11-new/recvping.c
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new/recvping.c	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new/recvping.c	(revision 5)
@@ -0,0 +1,32 @@
+/*
+ * Infinite loop to receive every ICMP packet received on the socket.
+ * For every packet that's received, we just call pr_pack() to look
+ * at it and print it.
+ */
+
+#include	"defs.h"
+
+int recv_ping()
+{
+	register int		n;
+#if !defined(__GLIBC__)
+	int			fromlen;
+#else /* __GLIBC__ */
+	socklen_t		fromlen;
+#endif /* __GLIBC__ */
+	struct sockaddr_in	from;
+
+	for ( ; ; ) {
+		fromlen = sizeof(from);
+		if ( (n = recvfrom(sockfd, recvpack, sizeof(recvpack), 0,
+				(struct sockaddr *) &from, &fromlen)) < 0) {
+			if (errno == EINTR)
+				continue;	/* normal */
+			err_ret("recvfrom error");
+			continue;
+		}
+
+		pr_pack(recvpack, n, &from);
+
+	}
+}
Index: create-1.11-patch/icmpinfo-1.11-new
===================================================================
--- create-1.11-patch/icmpinfo-1.11-new	(nonexistent)
+++ create-1.11-patch/icmpinfo-1.11-new	(revision 5)

Property changes on: create-1.11-patch/icmpinfo-1.11-new
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-1.11-patch
===================================================================
--- create-1.11-patch	(nonexistent)
+++ create-1.11-patch	(revision 5)

Property changes on: create-1.11-patch
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: patches/README
===================================================================
--- patches/README	(nonexistent)
+++ patches/README	(revision 5)
@@ -0,0 +1,6 @@
+
+/* begin *
+
+   TODO: Leave some comment here.
+
+ * end */
Index: patches
===================================================================
--- patches	(nonexistent)
+++ patches	(revision 5)

Property changes on: patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: .
===================================================================
--- .	(nonexistent)
+++ .	(revision 5)

Property changes on: .
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~