summaryrefslogtreecommitdiff
path: root/net-misc/iputils
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-misc/iputils
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.xz
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-misc/iputils')
-rw-r--r--net-misc/iputils/Manifest2
-rw-r--r--net-misc/iputils/files/021109-uclibc-no-ether_ntohost.patch24
-rw-r--r--net-misc/iputils/files/iputils-20071127-nonroot-floodping.patch11
-rw-r--r--net-misc/iputils/files/iputils-20100418-so_mark.patch22
-rw-r--r--net-misc/iputils/files/iputils-20121221-crypto-build.patch35
-rw-r--r--net-misc/iputils/files/iputils-20121221-makefile.patch61
-rw-r--r--net-misc/iputils/files/iputils-20121221-openssl.patch92
-rw-r--r--net-misc/iputils/files/iputils-20121221-owl-pingsock.diff224
-rw-r--r--net-misc/iputils/files/iputils-20121221-parallel-doc.patch74
-rw-r--r--net-misc/iputils/files/iputils-20121221-printf-size.patch64
-rw-r--r--net-misc/iputils/files/iputils-20121221-strtod.patch45
-rw-r--r--net-misc/iputils/files/iputils-20121221-tftpd-setid.patch34
-rw-r--r--net-misc/iputils/files/iputils-20121221-tftpd-syslog.patch38
-rw-r--r--net-misc/iputils/files/iputils-99999999-openssl.patch97
-rw-r--r--net-misc/iputils/files/iputils-99999999-tftpd-syslog.patch38
-rw-r--r--net-misc/iputils/files/rarpd.conf.d8
-rwxr-xr-xnet-misc/iputils/files/rarpd.init.d20
-rw-r--r--net-misc/iputils/iputils-20121221-r1.ebuild104
-rw-r--r--net-misc/iputils/iputils-20121221-r2.ebuild151
-rw-r--r--net-misc/iputils/iputils-20121221.ebuild98
-rw-r--r--net-misc/iputils/iputils-99999999.ebuild146
-rw-r--r--net-misc/iputils/metadata.xml18
22 files changed, 1406 insertions, 0 deletions
diff --git a/net-misc/iputils/Manifest b/net-misc/iputils/Manifest
new file mode 100644
index 00000000000..40e0b48a681
--- /dev/null
+++ b/net-misc/iputils/Manifest
@@ -0,0 +1,2 @@
+DIST iputils-s20121221-manpages.tar.bz2 23778 SHA256 6fc7ed7d281b7a2ee00e4f75e5465c90498c685bcc988afdff74db4eaa736d1c SHA512 006be62e61bf1555c99dbd5aac270cbd8d1074a3016fdde3aeed47e5c9b1acd326aa30a596c532d6688827f7f61966a6e3141eaa3b6f4f943eb21ac227282d8c WHIRLPOOL da0ccb577c4b2189553419df2c093404752fb2865eb3e0bfececfc242d930ceb44f96b32d945cfdd0c9ca060359651b2ec8479db5cc9220cda412dfeee5e910d
+DIST iputils-s20121221.tar.bz2 155344 SHA256 450f549fc5b620c23c5929aa6d54b7ddfc7ee1cb1e8efdc5e8bb21d8d0c5319f SHA512 693d240becd766c345c3af2053fc0699b9358e54d667d40738c21d731b70e779112d81476a220d8300ca54250120385414a13610d445996f95a90571047389f4 WHIRLPOOL 64529180eb4b8e2f7a60c18df7cac49e10a4b7702514252d418b16dcdc10a85ccb0a7f8beb51274cc9d708be2026c4c136e720986795fd39d314e4f9d5590ec9
diff --git a/net-misc/iputils/files/021109-uclibc-no-ether_ntohost.patch b/net-misc/iputils/files/021109-uclibc-no-ether_ntohost.patch
new file mode 100644
index 00000000000..e790d2b5103
--- /dev/null
+++ b/net-misc/iputils/files/021109-uclibc-no-ether_ntohost.patch
@@ -0,0 +1,24 @@
+--- iputils/rarpd.c.mps 2004-06-10 15:27:01.000000000 +0200
++++ iputils/rarpd.c 2004-06-10 15:26:29.000000000 +0200
+@@ -42,7 +42,9 @@ int listen_arp;
+ char *ifname;
+ char *tftp_dir = "/etc/tftpboot";
+
++#ifndef __UCLIBC__
+ extern int ether_ntohost(char *name, unsigned char *ea);
++#endif
+ void usage(void) __attribute__((noreturn));
+
+ struct iflink
+@@ -305,7 +307,11 @@ struct rarp_map *rarp_lookup(int ifindex
+ 6,
+ };
+
++#ifndef __UCLIBC__
+ if (ether_ntohost(ename, lladdr) != 0 ||
++#else
++ if (
++#endif
+ (hp = gethostbyname(ename)) == NULL) {
+ if (verbose)
+ syslog(LOG_INFO, "not found in /etc/ethers");
diff --git a/net-misc/iputils/files/iputils-20071127-nonroot-floodping.patch b/net-misc/iputils/files/iputils-20071127-nonroot-floodping.patch
new file mode 100644
index 00000000000..cae87791dc2
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20071127-nonroot-floodping.patch
@@ -0,0 +1,11 @@
+--- iputils-s20071127/ping_common.h.orig 2008-06-10 11:16:06.000000000 +0100
++++ iputils-s20071127/ping_common.h 2008-06-10 11:16:18.000000000 +0100
+@@ -28,7 +28,7 @@
+
+ #define MAXWAIT 10 /* max seconds to wait for response */
+ #define MININTERVAL 10 /* Minimal interpacket gap */
+-#define MINUSERINTERVAL 200 /* Minimal allowed interval for non-root */
++#define MINUSERINTERVAL 0 /* Minimal allowed interval for non-root */
+
+ #define SCHINT(a) (((a) <= MININTERVAL) ? MININTERVAL : (a))
+
diff --git a/net-misc/iputils/files/iputils-20100418-so_mark.patch b/net-misc/iputils/files/iputils-20100418-so_mark.patch
new file mode 100644
index 00000000000..ad92254d6f8
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20100418-so_mark.patch
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/335347
+
+fix building with older linux headers that don't define SO_MARK
+
+--- ping_common.c
++++ ping_common.c
+@@ -485,6 +485,7 @@
+ fprintf(stderr, "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP\n");
+ }
+ #endif
++#ifdef SO_MARK
+ if (options & F_MARK) {
+ if (setsockopt(icmp_sock, SOL_SOCKET, SO_MARK,
+ &mark, sizeof(mark)) == -1) {
+@@ -494,6 +495,7 @@
+ fprintf(stderr, "Warning: Failed to set mark %d\n", mark);
+ }
+ }
++#endif
+
+ /* Set some SNDTIMEO to prevent blocking forever
+ * on sends, when device is too slow or stalls. Just put limit
diff --git a/net-misc/iputils/files/iputils-20121221-crypto-build.patch b/net-misc/iputils/files/iputils-20121221-crypto-build.patch
new file mode 100644
index 00000000000..1ec3c101d52
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-crypto-build.patch
@@ -0,0 +1,35 @@
+From 568e990d30fc7e9416e0a6f8c74ea5013921eaec Mon Sep 17 00:00:00 2001
+From: Arjan van de Ven <arjanvandeven@gmail.com>
+Date: Wed, 16 Jan 2013 03:12:15 +0900
+Subject: [PATCH [iputils]] ping6: Fix build command line argument with gnutls.
+
+The ping6 command can use either openssl or gnutls...
+and the Makefile has a bunch of setup for defining which of the two to use.
+
+Unfortunately, the final -D define on the commandline to enable gnutls
+inside the ping6.c file didn't actually make it onto the gcc
+commandline.
+This patch adds the $(DEF_CRYPTO) Makefile variable to fix this gap.
+
+Signed-off-by: Arjan van de Ven <arjanvandeven@gmail.com>
+Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index c62d9df..89249f5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -149,7 +149,7 @@ LIB_clockdiff = $(LIB_CAP)
+ DEF_ping_common = $(DEF_CAP) $(DEF_IDN)
+ DEF_ping = $(DEF_CAP) $(DEF_IDN) $(DEF_WITHOUT_IFADDRS)
+ LIB_ping = $(LIB_CAP) $(LIB_IDN)
+-DEF_ping6 = $(DEF_CAP) $(DEF_IDN) $(DEF_WITHOUT_IFADDRS) $(DEF_ENABLE_PING6_RTHDR)
++DEF_ping6 = $(DEF_CAP) $(DEF_IDN) $(DEF_WITHOUT_IFADDRS) $(DEF_ENABLE_PING6_RTHDR) $(DEF_CRYPTO)
+ LIB_ping6 = $(LIB_CAP) $(LIB_IDN) $(LIB_RESOLV) $(LIB_CRYPTO)
+
+ ping: ping_common.o
+--
+1.8.0.2
+
diff --git a/net-misc/iputils/files/iputils-20121221-makefile.patch b/net-misc/iputils/files/iputils-20121221-makefile.patch
new file mode 100644
index 00000000000..66424c85cf8
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-makefile.patch
@@ -0,0 +1,61 @@
+From c66609d2c830d6fe06f48f5d38c54eb5cc6f2975 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 24 Jan 2013 23:36:16 -0500
+Subject: [PATCH [iputils]] fix handling of CFLAGS
+
+This defaults CFLAGS to -O3 without clobbering settings people have set
+up in the environment already.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 13 +++++--------
+ 1 file changed, 5 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 2c49940..ecabac3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,8 +2,6 @@
+ # Configuration
+ #
+
+-# CC
+-CC=gcc
+ # Path to parent kernel include files directory
+ LIBC_INCLUDE=/usr/include
+ # Libraries
+@@ -48,11 +46,10 @@ ENABLE_RDISC_SERVER=no
+
+ # -------------------------------------
+ # What a pity, all new gccs are buggy and -Werror does not work. Sigh.
+-# CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g
+-CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -g
+-CCOPTOPT=-O3
+-GLIBCFIX=-D_GNU_SOURCE
+-DEFINES=
++# CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g
++CFLAGS?=-O3 -g
++CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall
++CPPFLAGS+=-D_GNU_SOURCE
+ LDLIB=
+
+ FUNC_LIB = $(if $(filter static,$(1)),$(LDFLAG_STATIC) $(2) $(LDFLAG_DYNAMIC),$(2))
+@@ -113,7 +110,6 @@ IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
+ IPV6_TARGETS=tracepath6 traceroute6 ping6
+ TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
+
+-CFLAGS=$(CCOPTOPT) $(CCOPT) $(GLIBCFIX) $(DEFINES)
+ LDLIBS=$(LDLIB) $(ADDLIB)
+
+ UNAME_N:=$(shell uname -n)
+@@ -132,6 +128,7 @@ all: $(TARGETS)
+ $(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -S -o $@
+ %.o: %.c
+ $(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -o $@
++LINK.o += $(CFLAGS)
+ $(TARGETS): %: %.o
+ $(LINK.o) $^ $(LIB_$@) $(LDLIBS) -o $@
+
+--
+1.8.0.2
+
diff --git a/net-misc/iputils/files/iputils-20121221-openssl.patch b/net-misc/iputils/files/iputils-20121221-openssl.patch
new file mode 100644
index 00000000000..1c6ba81dab8
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-openssl.patch
@@ -0,0 +1,92 @@
+From b57d77dcfa5cb363b7eba5b331324669a8505ac4 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 24 Jan 2013 23:32:39 -0500
+Subject: [PATCH [iputils]] ping6: allow disabling of openssl support
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 5 ++++-
+ ping6.c | 14 +++++++++++++-
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 89249f5..2c49940 100644
+--- a/Makefile
++++ b/Makefile
+@@ -36,7 +36,7 @@ ARPING_DEFAULT_DEVICE=
+
+ # GNU TLS library for ping6 [yes|no|static]
+ USE_GNUTLS=yes
+-# Crypto library for ping6 [shared|static]
++# Crypto library for ping6 [shared|static|no]
+ USE_CRYPTO=shared
+ # Resolv library for ping6 [yes|static]
+ USE_RESOLV=yes
+@@ -63,7 +63,10 @@ ifneq ($(USE_GNUTLS),no)
+ LIB_CRYPTO = $(call FUNC_LIB,$(USE_GNUTLS),$(LDFLAG_GNUTLS))
+ DEF_CRYPTO = -DUSE_GNUTLS
+ else
++ifneq ($(USE_CRYPTO),no)
+ LIB_CRYPTO = $(call FUNC_LIB,$(USE_CRYPTO),$(LDFLAG_CRYPTO))
++ DEF_CRYPTO = -DUSE_OPENSSL
++endif
+ endif
+
+ # USE_RESOLV: LIB_RESOLV
+diff --git a/ping6.c b/ping6.c
+index c39864d..f2f90af 100644
+--- a/ping6.c
++++ b/ping6.c
+@@ -168,8 +168,10 @@ static int icmp_sock;
+
+ #ifdef USE_GNUTLS
+ # include <gnutls/openssl.h>
+-#else
++# define USE_CRYPTO
++#elif defined USE_OPENSSL
+ # include <openssl/md5.h>
++# define USE_CRYPTO
+ #endif
+
+ /* Node Information query */
+@@ -326,6 +328,7 @@ static void niquery_init_nonce(void)
+ #if !PING6_NONCE_MEMORY
+ static int niquery_nonce(__u8 *nonce, int fill)
+ {
++# ifdef USE_CRYPTO
+ static __u8 digest[MD5_DIGEST_LENGTH];
+ static int seq = -1;
+
+@@ -348,6 +351,10 @@ static int niquery_nonce(__u8 *nonce, int fill)
+ return -1;
+ return ntohsp((__u16 *)nonce);
+ }
++# else
++ fprintf(stderr, "ping6: function not available; crypto disabled\n");
++ exit(3);
++# endif
+ }
+ #endif
+
+@@ -502,6 +509,7 @@ static int niquery_option_subject_addr_handler(int index, const char *arg)
+
+ static int niquery_option_subject_name_handler(int index, const char *arg)
+ {
++#ifdef USE_CRYPTO
+ static char nigroup_buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ];
+ unsigned char *dnptrs[2], **dpp, **lastdnptr;
+ int n;
+@@ -627,6 +635,10 @@ errexit:
+ free(idn);
+ free(name);
+ exit(1);
++#else
++ fprintf(stderr, "ping6: function not available; crypto disabled\n");
++ exit(3);
++#endif
+ }
+
+ int niquery_option_help_handler(int index, const char *arg)
+--
+1.8.0.2
+
diff --git a/net-misc/iputils/files/iputils-20121221-owl-pingsock.diff b/net-misc/iputils/files/iputils-20121221-owl-pingsock.diff
new file mode 100644
index 00000000000..283aa989f32
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-owl-pingsock.diff
@@ -0,0 +1,224 @@
+http://openwall.info/wiki/people/segoon/ping
+
+--- iputils-s20101006/ping.c
++++ iputils-s20101006/ping.c
+@@ -88,6 +88,7 @@ struct sockaddr_in whereto; /* who to pi
+ int optlen = 0;
+ int settos = 0; /* Set TOS, Precendence or other QOS options */
+ int icmp_sock; /* socket file descriptor */
++int using_ping_socket = 0;
+ u_char outpack[0x10000];
+ int maxpacket = sizeof(outpack);
+
+@@ -123,7 +124,11 @@ main(int argc, char **argv)
+ char *target, hnamebuf[MAX_HOSTNAMELEN];
+ char rspace[3 + 4 * NROUTES + 1]; /* record route space */
+
+- icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
++ icmp_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
++ if (icmp_sock != -1)
++ using_ping_socket = 1;
++ else
++ icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+ socket_errno = errno;
+
+ uid = getuid();
+@@ -377,13 +382,35 @@ main(int argc, char **argv)
+ }
+ }
+
+- if ((options&F_STRICTSOURCE) &&
+- bind(icmp_sock, (struct sockaddr*)&source, sizeof(source)) == -1) {
+- perror("bind");
+- exit(2);
++ if (!using_ping_socket) {
++ if ((options&F_STRICTSOURCE) &&
++ bind(icmp_sock, (struct sockaddr*)&source, sizeof(source)) == -1) {
++ perror("bind");
++ exit(2);
++ }
++ } else {
++ struct sockaddr_in sa;
++ socklen_t sl;
++
++ sa.sin_family = AF_INET;
++ sa.sin_port = 0;
++ sa.sin_addr.s_addr = (options&F_STRICTSOURCE) ?
++ source.sin_addr.s_addr : 0;
++ sl = sizeof(sa);
++
++ if (bind(icmp_sock, (struct sockaddr *) &sa, sl) == -1) {
++ perror("bind");
++ exit(2);
++ }
++
++ if (getsockname(icmp_sock, (struct sockaddr *) &sa, &sl) == -1) {
++ perror("getsockname");
++ exit(2);
++ }
++ ident = sa.sin_port;
+ }
+
+- if (1) {
++ if (!using_ping_socket) {
+ struct icmp_filter filt;
+ filt.data = ~((1<<ICMP_SOURCE_QUENCH)|
+ (1<<ICMP_DEST_UNREACH)|
+@@ -398,6 +425,12 @@ main(int argc, char **argv)
+ hold = 1;
+ if (setsockopt(icmp_sock, SOL_IP, IP_RECVERR, (char *)&hold, sizeof(hold)))
+ fprintf(stderr, "WARNING: your kernel is veeery old. No problems.\n");
++ if (using_ping_socket) {
++ if (setsockopt(icmp_sock, SOL_IP, IP_RECVTTL, (char *)&hold, sizeof(hold)))
++ perror("WARNING: setsockopt(IP_RECVTTL)");
++ if (setsockopt(icmp_sock, SOL_IP, IP_RETOPTS, (char *)&hold, sizeof(hold)))
++ perror("WARNING: setsockopt(IP_RETOPTS)");
++ }
+
+ /* record route option */
+ if (options & F_RROUTE) {
+@@ -566,6 +599,7 @@ int receive_error_msg()
+ nerrors++;
+ } else if (e->ee_origin == SO_EE_ORIGIN_ICMP) {
+ struct sockaddr_in *sin = (struct sockaddr_in*)(e+1);
++ int error_pkt;
+
+ if (res < sizeof(icmph) ||
+ target.sin_addr.s_addr != whereto.sin_addr.s_addr ||
+@@ -576,9 +610,18 @@ int receive_error_msg()
+ goto out;
+ }
+
+- acknowledge(ntohs(icmph.un.echo.sequence));
++ error_pkt = (e->ee_type != ICMP_REDIRECT &&
++ e->ee_type != ICMP_SOURCE_QUENCH);
++ if (error_pkt) {
++ acknowledge(ntohs(icmph.un.echo.sequence));
++ net_errors++;
++ nerrors++;
++ }
++ else {
++ saved_errno = 0;
++ }
+
+- if (!working_recverr) {
++ if (!using_ping_socket && !working_recverr) {
+ struct icmp_filter filt;
+ working_recverr = 1;
+ /* OK, it works. Add stronger filter. */
+@@ -589,15 +632,14 @@ int receive_error_msg()
+ perror("\rWARNING: setsockopt(ICMP_FILTER)");
+ }
+
+- net_errors++;
+- nerrors++;
+ if (options & F_QUIET)
+ goto out;
+ if (options & F_FLOOD) {
+- write_stdout("\bE", 2);
++ if (error_pkt)
++ write_stdout("\bE", 2);
+ } else {
+ print_timestamp();
+- printf("From %s icmp_seq=%u ", pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
++ printf("From %s: icmp_seq=%u ", pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
+ pr_icmph(e->ee_type, e->ee_code, e->ee_info, NULL);
+ fflush(stdout);
+ }
+@@ -695,15 +737,41 @@ parse_reply(struct msghdr *msg, int cc,
+ struct iphdr *ip;
+ int hlen;
+ int csfailed;
++ struct cmsghdr *cmsg;
++ int ttl;
++ __u8 *opts;
++ int optlen;
+
+ /* Check the IP header */
+ ip = (struct iphdr *)buf;
+- hlen = ip->ihl*4;
+- if (cc < hlen + 8 || ip->ihl < 5) {
+- if (options & F_VERBOSE)
+- fprintf(stderr, "ping: packet too short (%d bytes) from %s\n", cc,
+- pr_addr(from->sin_addr.s_addr));
+- return 1;
++ if (!using_ping_socket) {
++ hlen = ip->ihl*4;
++ if (cc < hlen + 8 || ip->ihl < 5) {
++ if (options & F_VERBOSE)
++ fprintf(stderr, "ping: packet too short (%d bytes) from %s\n", cc,
++ pr_addr(from->sin_addr.s_addr));
++ return 1;
++ }
++ ttl = ip->ttl;
++ opts = buf + sizeof(struct iphdr);
++ optlen = hlen - sizeof(struct iphdr);
++ } else {
++ hlen = 0;
++ ttl = 0;
++ opts = buf;
++ optlen = 0;
++ for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
++ if (cmsg->cmsg_level != SOL_IP)
++ continue;
++ if (cmsg->cmsg_type == IP_TTL) {
++ if (cmsg->cmsg_len < sizeof(int))
++ continue;
++ ttl = *(int *) CMSG_DATA(cmsg);
++ } else if (cmsg->cmsg_type == IP_RETOPTS) {
++ opts = (__u8 *) CMSG_DATA(cmsg);
++ optlen = cmsg->cmsg_len;
++ }
++ }
+ }
+
+ /* Now the ICMP part */
+@@ -716,7 +784,7 @@ parse_reply(struct msghdr *msg, int cc,
+ return 1; /* 'Twas not our ECHO */
+ if (gather_statistics((__u8*)icp, sizeof(*icp), cc,
+ ntohs(icp->un.echo.sequence),
+- ip->ttl, 0, tv, pr_addr(from->sin_addr.s_addr),
++ ttl, 0, tv, pr_addr(from->sin_addr.s_addr),
+ pr_echo_reply))
+ return 0;
+ } else {
+@@ -807,7 +875,7 @@ parse_reply(struct msghdr *msg, int cc,
+ }
+
+ if (!(options & F_FLOOD)) {
+- pr_options(buf + sizeof(struct iphdr), hlen);
++ pr_options(opts, optlen + sizeof(struct iphdr));
+
+ if (options & F_AUDIBLE)
+ putchar('\a');
+@@ -916,8 +984,7 @@ void pr_icmph(__u8 type, __u8 code, __u3
+ printf("Redirect, Bad Code: %d", code);
+ break;
+ }
+- if (icp)
+- printf("(New nexthop: %s)\n", pr_addr(icp->un.gateway));
++ printf("(New nexthop: %s)\n", pr_addr(icp ? icp->un.gateway : info));
+ if (icp && (options & F_VERBOSE))
+ pr_iph((struct iphdr*)(icp + 1));
+ break;
+@@ -1217,7 +1284,7 @@ void install_filter(void)
+ insns
+ };
+
+- if (once)
++ if (once || using_ping_socket)
+ return;
+ once = 1;
+
+--- iputils-s20101006/ping_common.c
++++ iputils-s20101006/ping_common.c
+@@ -515,7 +515,8 @@ void setup(int icmp_sock)
+ *p++ = i;
+ }
+
+- ident = htons(getpid() & 0xFFFF);
++ if (!ident)
++ ident = htons(getpid() & 0xFFFF);
+
+ set_signal(SIGINT, sigexit);
+ set_signal(SIGALRM, sigexit);
diff --git a/net-misc/iputils/files/iputils-20121221-parallel-doc.patch b/net-misc/iputils/files/iputils-20121221-parallel-doc.patch
new file mode 100644
index 00000000000..22bfb8811ed
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-parallel-doc.patch
@@ -0,0 +1,74 @@
+From 4e322b85a12ba3ef5e8118724e3442b2ebb0f6d6 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 1 Aug 2012 11:43:34 -0400
+Subject: [PATCH iputils] doc: fix parallel build of html/man pages
+
+The use of the same tempdir prevents building of these files in parallel.
+So build all of them in unique tempdirs so we can do them in parallel.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ doc/Makefile | 37 ++++++++++++++++++++++++-------------
+ 1 file changed, 24 insertions(+), 13 deletions(-)
+
+diff --git a/doc/Makefile b/doc/Makefile
+index 7ec4f1c..4f930a3 100644
+--- a/doc/Makefile
++++ b/doc/Makefile
+@@ -12,29 +12,40 @@ man: $(MANFILES)
+ # lots of some strange temporary junk directories and files.
+ # So, scope it to a temporary dir and clean all after each run.
+
+-$(HTMLFILES): index.db
+- @-rm -rf tmp.db2html
+- @mkdir tmp.db2html
+- @set -e; cd tmp.db2html; docbook2html ../$< ; mv *.html ..
+- @-rm -rf tmp.db2html
++SETUP_TMPDIR = \
++ t="tmp.db2html.$@"; \
++ rm -rf $$t; \
++ mkdir $$t; \
++ cd $$t
++CLEAN_TMPDIR = \
++ cd ..; \
++ rm -rf $$t
++
++MAKE_HTML = \
++ @set -e; \
++ $(SETUP_TMPDIR); \
++ docbook2html ../$<; \
++ mv *.html ..; \
++ $(CLEAN_TMPDIR)
+
++$(HTMLFILES): index.db
++ $(MAKE_HTML)
+ iputils.html: iputils.db
+- @-rm -rf tmp.db2html
+- @mkdir tmp.db2html
+- @set -e; cd tmp.db2html; docbook2html -u -o html ../$< ; mv html/$@ ..
+- @-rm -rf tmp.db2html
++ $(MAKE_HTML)
+
+ # docbook2man produces utterly ugly output and I did not find
+ # any way to customize this but hacking backend perl script a little.
+ # Well, hence...
+
+ $(MANFILES): index.db
+- @-mkdir tmp.db2man
+- @set -e; cd tmp.db2man; nsgmls ../$< | sgmlspl ../docbook2man-spec.pl ; mv $@ ..
+- @-rm -rf tmp.db2man
++ @set -e; \
++ $(SETUP_TMPDIR); \
++ nsgmls ../$< | sgmlspl ../docbook2man-spec.pl; \
++ mv $@ ..; \
++ $(CLEAN_TMPDIR)
+
+ clean:
+- @rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html tmp.db2man
++ @rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html* tmp.db2man*
+
+ snapshot:
+ @date "+%y%m%d" > snapshot.db
+--
+2.3.5
+
diff --git a/net-misc/iputils/files/iputils-20121221-printf-size.patch b/net-misc/iputils/files/iputils-20121221-printf-size.patch
new file mode 100644
index 00000000000..6d6c3b7d258
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-printf-size.patch
@@ -0,0 +1,64 @@
+From 23fcb10ae15a96aa9e5a823cfe0b612d9522691c Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 14 Aug 2010 01:16:42 -0400
+Subject: [PATCH [iputils]] tracepath: re-use printf return in print_host
+
+Since the printf funcs already return the length of chars displayed,
+use that value instead of re-calculating the length with strlen.
+
+This also fixes the handling of the strlen return -- it's a size_t,
+not an int.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ tracepath.c | 11 ++++-------
+ tracepath6.c | 11 ++++-------
+ 2 files changed, 8 insertions(+), 14 deletions(-)
+
+diff --git a/tracepath.c b/tracepath.c
+index 8a08f1d..f155816 100644
+--- a/tracepath.c
++++ b/tracepath.c
+@@ -73,13 +73,10 @@ void data_wait(int fd)
+
+ void print_host(const char *a, const char *b, int both)
+ {
+- int plen = 0;
+- printf("%s", a);
+- plen = strlen(a);
+- if (both) {
+- printf(" (%s)", b);
+- plen += strlen(b) + 3;
+- }
++ int plen;
++ plen = printf("%s", a);
++ if (both)
++ plen += printf(" (%s)", b);
+ if (plen >= HOST_COLUMN_SIZE)
+ plen = HOST_COLUMN_SIZE - 1;
+ printf("%*s", HOST_COLUMN_SIZE - plen, "");
+diff --git a/tracepath6.c b/tracepath6.c
+index 126fadf..bee95c3 100644
+--- a/tracepath6.c
++++ b/tracepath6.c
+@@ -86,13 +86,10 @@ void data_wait(int fd)
+
+ void print_host(const char *a, const char *b, int both)
+ {
+- int plen = 0;
+- printf("%s", a);
+- plen = strlen(a);
+- if (both) {
+- printf(" (%s)", b);
+- plen += strlen(b) + 3;
+- }
++ int plen;
++ plen = printf("%s", a);
++ if (both)
++ plen += printf(" (%s)", b);
+ if (plen >= HOST_COLUMN_SIZE)
+ plen = HOST_COLUMN_SIZE - 1;
+ printf("%*s", HOST_COLUMN_SIZE - plen, "");
+--
+1.8.0.2
+
diff --git a/net-misc/iputils/files/iputils-20121221-strtod.patch b/net-misc/iputils/files/iputils-20121221-strtod.patch
new file mode 100644
index 00000000000..303acf5c42c
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-strtod.patch
@@ -0,0 +1,45 @@
+https://bugs.gentoo.org/472592
+
+From dd0aa192626f94d08e399fc2a743ee72c50853fb Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 24 Apr 2015 20:41:31 -0400
+Subject: [PATCH iputils] ping: fix -i number parsing in locales
+
+Always use #.# format for the -i flag even when the current locale uses
+a different separator. Locale de_DE which uses #,# normally.
+
+Simple testcase:
+$ make USE_IDN=1
+$ LANG=de_DE.UTF8 ./ping -i 0.5 localhost
+
+Reported-by: Sergey Fionov <fionov@gmail.com>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ ping_common.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/ping_common.c b/ping_common.c
+index 62f53a6..0a37e09 100644
+--- a/ping_common.c
++++ b/ping_common.c
+@@ -269,9 +269,17 @@ void common_options(int ch)
+ double dbl;
+ char *ep;
+
++#ifdef USE_IDN
++ setlocale(LC_ALL, "C");
++#endif
++
+ errno = 0;
+ dbl = strtod(optarg, &ep);
+
++#ifdef USE_IDN
++ setlocale(LC_ALL, "");
++#endif
++
+ if (errno || *ep != '\0' ||
+ !finite(dbl) || dbl < 0.0 || dbl >= (double)INT_MAX / 1000 - 1.0) {
+ fprintf(stderr, "ping: bad timing interval\n");
+--
+2.3.5
+
diff --git a/net-misc/iputils/files/iputils-20121221-tftpd-setid.patch b/net-misc/iputils/files/iputils-20121221-tftpd-setid.patch
new file mode 100644
index 00000000000..0ea56685d26
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-tftpd-setid.patch
@@ -0,0 +1,34 @@
+From d81a44625b04d487c895473aa77af13420b7afdd Mon Sep 17 00:00:00 2001
+From: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
+Date: Thu, 19 Jun 2014 17:25:49 +0900
+Subject: [PATCH iputils] tftpd: Exit if setuid()/setgid() failed.
+
+Signed-off-by: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
+---
+ tftpd.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/tftpd.c b/tftpd.c
+index 2a39ec4..e3af2f4 100644
+--- a/tftpd.c
++++ b/tftpd.c
+@@ -111,8 +111,14 @@ int main(int ac, char **av)
+
+ /* Sanity. If parent forgot to setuid() on us. */
+ if (geteuid() == 0) {
+- setgid(65534);
+- setuid(65534);
++ if (setgid(65534)) {
++ syslog(LOG_ERR, "setgid");
++ exit(1);
++ }
++ if (setuid(65534)) {
++ syslog(LOG_ERR, "setuid");
++ exit(1);
++ }
+ }
+
+ ac--; av++;
+--
+2.3.5
+
diff --git a/net-misc/iputils/files/iputils-20121221-tftpd-syslog.patch b/net-misc/iputils/files/iputils-20121221-tftpd-syslog.patch
new file mode 100644
index 00000000000..ad34f3b5f64
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20121221-tftpd-syslog.patch
@@ -0,0 +1,38 @@
+From e88ed3752872d7c7ca37d95eb4d434ca4d3c4eae Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 19 Apr 2014 10:39:39 -0400
+Subject: [PATCH iputils] tftpd: fix syslog setup
+
+Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking
+the set*id calls, but would call syslog() before it had called openlog().
+Move the call up earlier to fix that.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ tftpd.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tftpd.c b/tftpd.c
+index e3af2f4..7ddc8eb 100644
+--- a/tftpd.c
++++ b/tftpd.c
+@@ -109,6 +109,8 @@ int main(int ac, char **av)
+ register int n = 0;
+ int on = 1;
+
++ openlog("tftpd", LOG_PID, LOG_DAEMON);
++
+ /* Sanity. If parent forgot to setuid() on us. */
+ if (geteuid() == 0) {
+ if (setgid(65534)) {
+@@ -125,7 +127,6 @@ int main(int ac, char **av)
+ while (ac-- > 0 && n < MAXARG)
+ dirs[n++] = *av++;
+
+- openlog("tftpd", LOG_PID, LOG_DAEMON);
+ if (ioctl(0, FIONBIO, &on) < 0) {
+ syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
+ exit(1);
+--
+2.3.5
+
diff --git a/net-misc/iputils/files/iputils-99999999-openssl.patch b/net-misc/iputils/files/iputils-99999999-openssl.patch
new file mode 100644
index 00000000000..13f5639a6fb
--- /dev/null
+++ b/net-misc/iputils/files/iputils-99999999-openssl.patch
@@ -0,0 +1,97 @@
+From 321d64b9f94653322e678e34ac214ddb73a71db8 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 24 Jan 2013 23:32:39 -0500
+Subject: [PATCH iputils] ping6: allow disabling of openssl support
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 5 ++++-
+ iputils_md5dig.h | 4 +++-
+ ping6.c | 10 ++++++++++
+ 3 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 54e5a6d..7147f08 100644
+--- a/Makefile
++++ b/Makefile
+@@ -36,7 +36,7 @@ ARPING_DEFAULT_DEVICE=
+
+ # Libgcrypt (for MD5) for ping6 [yes|no|static]
+ USE_GCRYPT=yes
+-# Crypto library for ping6 [shared|static]
++# Crypto library for ping6 [shared|static|no]
+ USE_CRYPTO=shared
+ # Resolv library for ping6 [yes|static]
+ USE_RESOLV=yes
+@@ -63,7 +63,10 @@ ifneq ($(USE_GCRYPT),no)
+ LIB_CRYPTO = $(call FUNC_LIB,$(USE_GCRYPT),$(LDFLAG_GCRYPT))
+ DEF_CRYPTO = -DUSE_GCRYPT
+ else
++ifneq ($(USE_CRYPTO),no)
+ LIB_CRYPTO = $(call FUNC_LIB,$(USE_CRYPTO),$(LDFLAG_CRYPTO))
++ DEF_CRYPTO = -DUSE_OPENSSL
++endif
+ endif
+
+ # USE_RESOLV: LIB_RESOLV
+diff --git a/iputils_md5dig.h b/iputils_md5dig.h
+index 4cec866..d6c4d46 100644
+--- a/iputils_md5dig.h
++++ b/iputils_md5dig.h
+@@ -5,8 +5,10 @@
+ # include <stdlib.h>
+ # include <gcrypt.h>
+ # define IPUTILS_MD5DIG_LEN 16
+-#else
++# define USE_CRYPTO
++#elif defined(USE_OPENSSL)
+ # include <openssl/md5.h>
++# define USE_CRYPTO
+ #endif
+
+ #ifdef USE_GCRYPT
+diff --git a/ping6.c b/ping6.c
+index 7085f31..7b7c1af 100644
+--- a/ping6.c
++++ b/ping6.c
+@@ -324,6 +324,7 @@ static void niquery_init_nonce(void)
+ #if !PING6_NONCE_MEMORY
+ static int niquery_nonce(__u8 *nonce, int fill)
+ {
++# ifdef USE_CRYPTO
+ static __u8 digest[MD5_DIGEST_LENGTH];
+ static int seq = -1;
+
+@@ -346,6 +347,10 @@ static int niquery_nonce(__u8 *nonce, int fill)
+ return -1;
+ return ntohsp((__u16 *)nonce);
+ }
++# else
++ fprintf(stderr, "ping6: function not available; crypto disabled\n");
++ exit(3);
++# endif
+ }
+ #endif
+
+@@ -500,6 +505,7 @@ static int niquery_option_subject_addr_handler(int index, const char *arg)
+
+ static int niquery_option_subject_name_handler(int index, const char *arg)
+ {
++#ifdef USE_CRYPTO
+ static char nigroup_buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ];
+ unsigned char *dnptrs[2], **dpp, **lastdnptr;
+ int n;
+@@ -625,6 +631,10 @@ errexit:
+ free(idn);
+ free(name);
+ exit(1);
++#else
++ fprintf(stderr, "ping6: function not available; crypto disabled\n");
++ exit(3);
++#endif
+ }
+
+ int niquery_option_help_handler(int index, const char *arg)
+--
+2.3.5
+
diff --git a/net-misc/iputils/files/iputils-99999999-tftpd-syslog.patch b/net-misc/iputils/files/iputils-99999999-tftpd-syslog.patch
new file mode 100644
index 00000000000..ad34f3b5f64
--- /dev/null
+++ b/net-misc/iputils/files/iputils-99999999-tftpd-syslog.patch
@@ -0,0 +1,38 @@
+From e88ed3752872d7c7ca37d95eb4d434ca4d3c4eae Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 19 Apr 2014 10:39:39 -0400
+Subject: [PATCH iputils] tftpd: fix syslog setup
+
+Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking
+the set*id calls, but would call syslog() before it had called openlog().
+Move the call up earlier to fix that.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ tftpd.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tftpd.c b/tftpd.c
+index e3af2f4..7ddc8eb 100644
+--- a/tftpd.c
++++ b/tftpd.c
+@@ -109,6 +109,8 @@ int main(int ac, char **av)
+ register int n = 0;
+ int on = 1;
+
++ openlog("tftpd", LOG_PID, LOG_DAEMON);
++
+ /* Sanity. If parent forgot to setuid() on us. */
+ if (geteuid() == 0) {
+ if (setgid(65534)) {
+@@ -125,7 +127,6 @@ int main(int ac, char **av)
+ while (ac-- > 0 && n < MAXARG)
+ dirs[n++] = *av++;
+
+- openlog("tftpd", LOG_PID, LOG_DAEMON);
+ if (ioctl(0, FIONBIO, &on) < 0) {
+ syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
+ exit(1);
+--
+2.3.5
+
diff --git a/net-misc/iputils/files/rarpd.conf.d b/net-misc/iputils/files/rarpd.conf.d
new file mode 100644
index 00000000000..ef7fc48e17b
--- /dev/null
+++ b/net-misc/iputils/files/rarpd.conf.d
@@ -0,0 +1,8 @@
+# Config file for /etc/init.d/rarpd
+
+# You probably want to select the interface for this to listen on.
+# By default it uses loopback which most likely won't help.
+RARPD_IFACE="lo"
+
+# See the rarpd(8) manpage for more info.
+RARPD_OPTS="-b /tftpboot"
diff --git a/net-misc/iputils/files/rarpd.init.d b/net-misc/iputils/files/rarpd.init.d
new file mode 100755
index 00000000000..155b0d10f14
--- /dev/null
+++ b/net-misc/iputils/files/rarpd.init.d
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+pidfile="/var/run/rarpd.pid"
+command="/usr/sbin/rarpd"
+# The -d option keeps it from forking. This way s-s-d can do the fork and
+# set up the pidfile with the right value below.
+command_args="-d ${RARPD_OPTS} ${RARPD_IFACE}"
+start_stop_daemon_args="--background --make-pidfile"
+
+start_pre() {
+ if [ ! -f /etc/ethers ] ; then
+ eerror "Please create /etc/ethers with the following content:"
+ eerror "[MAC address] [name or IP]"
+ return 1
+ fi
+ return 0
+}
diff --git a/net-misc/iputils/iputils-20121221-r1.ebuild b/net-misc/iputils/iputils-20121221-r1.ebuild
new file mode 100644
index 00000000000..93ec07836f3
--- /dev/null
+++ b/net-misc/iputils/iputils-20121221-r1.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# For released versions, we precompile the man/html pages and store
+# them in a tarball on our mirrors. This avoids ugly issues while
+# building stages, and when the jade/sgml packages are broken (which
+# seems to be more common than would be nice).
+
+EAPI="4"
+
+inherit flag-o-matic eutils toolchain-funcs fcaps
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://www.linux-ipv6.org/gitroot/iputils"
+ inherit git-2
+else
+ SRC_URI="http://www.skbuff.net/iputils/iputils-s${PV}.tar.bz2
+ mirror://gentoo/iputils-s${PV}-manpages.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="Network monitoring tools including ping and ping6"
+HOMEPAGE="http://www.linuxfoundation.org/collaborate/workgroups/networking/iputils"
+
+LICENSE="BSD-4"
+SLOT="0"
+IUSE="caps doc gnutls idn ipv6 SECURITY_HAZARD ssl static"
+
+LIB_DEPEND="caps? ( sys-libs/libcap[static-libs(+)] )
+ idn? ( net-dns/libidn[static-libs(+)] )
+ ipv6? ( ssl? (
+ gnutls? (
+ net-libs/gnutls[openssl(+)]
+ net-libs/gnutls[static-libs(+)]
+ )
+ !gnutls? ( dev-libs/openssl:0[static-libs(+)] )
+ ) )"
+RDEPEND="!net-misc/rarpd
+ !static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+DEPEND="${RDEPEND}
+ static? ( ${LIB_DEPEND} )
+ virtual/os-headers"
+if [[ ${PV} == "99999999" ]] ; then
+ DEPEND+="
+ app-text/openjade
+ dev-perl/SGMLSpm
+ app-text/docbook-sgml-dtd
+ app-text/docbook-sgml-utils
+ "
+fi
+
+S=${WORKDIR}/${PN}-s${PV}
+
+src_prepare() {
+ epatch "${FILESDIR}"/021109-uclibc-no-ether_ntohost.patch
+ epatch "${FILESDIR}"/${PN}-20121221-openssl.patch #335436
+ epatch "${FILESDIR}"/${PN}-20121221-crypto-build.patch
+ epatch "${FILESDIR}"/${PN}-20100418-so_mark.patch #335347
+ epatch "${FILESDIR}"/${PN}-20121221-makefile.patch
+ epatch "${FILESDIR}"/${PN}-20121221-printf-size.patch
+ epatch "${FILESDIR}"/${PN}-20121221-owl-pingsock.diff
+ use SECURITY_HAZARD && epatch "${FILESDIR}"/${PN}-20071127-nonroot-floodping.patch
+ use static && append-ldflags -static
+}
+
+src_compile() {
+ tc-export CC
+ emake \
+ USE_CAP=$(usex caps) \
+ USE_IDN=$(usex idn) \
+ USE_GNUTLS=$(usex gnutls) \
+ USE_CRYPTO=$(usex ssl) \
+ $(use ipv6 || echo IPV6_TARGETS=)
+
+ if [[ ${PV} == "99999999" ]] ; then
+ emake -j1 html man
+ fi
+}
+
+ipv6() { usex ipv6 "$*" '' ; }
+
+src_install() {
+ into /
+ dobin arping ping $(ipv6 ping6)
+ into /usr
+ dobin clockdiff
+ dosbin rarpd rdisc ipg tftpd tracepath $(ipv6 tracepath6)
+
+ dodoc INSTALL RELNOTES
+ use ipv6 \
+ && dosym ping.8 /usr/share/man/man8/ping6.8 \
+ || rm -f doc/*6.8
+ rm -f doc/{setkey,traceroute6}.8
+ doman doc/*.8
+
+ use doc && dohtml doc/*.html
+}
+
+pkg_postinst() {
+ fcaps cap_net_raw \
+ bin/{ar,}ping \
+ $(ipv6 bin/ping6) \
+ usr/bin/clockdiff
+}
diff --git a/net-misc/iputils/iputils-20121221-r2.ebuild b/net-misc/iputils/iputils-20121221-r2.ebuild
new file mode 100644
index 00000000000..965b833c24c
--- /dev/null
+++ b/net-misc/iputils/iputils-20121221-r2.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# For released versions, we precompile the man/html pages and store
+# them in a tarball on our mirrors. This avoids ugly issues while
+# building stages, and when the jade/sgml packages are broken (which
+# seems to be more common than would be nice).
+
+EAPI="4"
+
+inherit flag-o-matic eutils toolchain-funcs fcaps
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://www.linux-ipv6.org/gitroot/iputils"
+ inherit git-2
+else
+ SRC_URI="http://www.skbuff.net/iputils/iputils-s${PV}.tar.bz2
+ mirror://gentoo/iputils-s${PV}-manpages.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="Network monitoring tools including ping and ping6"
+HOMEPAGE="http://www.linuxfoundation.org/collaborate/workgroups/networking/iputils"
+
+LICENSE="BSD-4"
+SLOT="0"
+IUSE="arping caps clockdiff doc gnutls idn ipv6 rarpd rdisc SECURITY_HAZARD ssl static tftpd tracepath traceroute"
+
+LIB_DEPEND="caps? ( sys-libs/libcap[static-libs(+)] )
+ idn? ( net-dns/libidn[static-libs(+)] )
+ ipv6? ( ssl? (
+ gnutls? (
+ net-libs/gnutls[openssl(+)]
+ net-libs/gnutls[static-libs(+)]
+ )
+ !gnutls? ( dev-libs/openssl:0[static-libs(+)] )
+ ) )"
+RDEPEND="arping? ( !net-misc/arping )
+ rarpd? ( !net-misc/rarpd )
+ traceroute? ( !net-misc/traceroute )
+ !static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+DEPEND="${RDEPEND}
+ static? ( ${LIB_DEPEND} )
+ virtual/os-headers"
+if [[ ${PV} == "99999999" ]] ; then
+ DEPEND+="
+ app-text/openjade
+ dev-perl/SGMLSpm
+ app-text/docbook-sgml-dtd
+ app-text/docbook-sgml-utils
+ "
+fi
+
+S=${WORKDIR}/${PN}-s${PV}
+
+src_prepare() {
+ epatch "${FILESDIR}"/021109-uclibc-no-ether_ntohost.patch
+ epatch "${FILESDIR}"/${PN}-20121221-openssl.patch #335436
+ epatch "${FILESDIR}"/${PN}-20121221-crypto-build.patch
+ epatch "${FILESDIR}"/${PN}-20100418-so_mark.patch #335347
+ epatch "${FILESDIR}"/${PN}-20121221-tftpd-setid.patch
+ epatch "${FILESDIR}"/${PN}-20121221-tftpd-syslog.patch
+ epatch "${FILESDIR}"/${PN}-20121221-makefile.patch
+ epatch "${FILESDIR}"/${PN}-20121221-parallel-doc.patch
+ epatch "${FILESDIR}"/${PN}-20121221-printf-size.patch
+ epatch "${FILESDIR}"/${PN}-20121221-owl-pingsock.diff
+ epatch "${FILESDIR}"/${PN}-20121221-strtod.patch #472592
+ use SECURITY_HAZARD && epatch "${FILESDIR}"/${PN}-20071127-nonroot-floodping.patch
+}
+
+src_configure() {
+ use static && append-ldflags -static
+
+ IPV4_TARGETS=(
+ ping
+ $(for v in arping clockdiff rarpd rdisc tftpd tracepath ; do usev ${v} ; done)
+ )
+ IPV6_TARGETS=(
+ ping6
+ $(usex tracepath 'tracepath6' '')
+ $(usex traceroute 'traceroute6' '')
+ )
+ use ipv6 || IPV6_TARGETS=()
+}
+
+src_compile() {
+ tc-export CC
+ emake \
+ USE_CAP=$(usex caps) \
+ USE_IDN=$(usex idn) \
+ USE_GNUTLS=$(usex gnutls) \
+ USE_CRYPTO=$(usex ssl) \
+ IPV4_TARGETS="${IPV4_TARGETS[*]}" \
+ IPV6_TARGETS="${IPV6_TARGETS[*]}"
+
+ if [[ ${PV} == "99999999" ]] ; then
+ emake html man
+ fi
+}
+
+src_install() {
+ into /
+ dobin ping $(usex ipv6 'ping6' '')
+ use ipv6 && dosym ping.8 "${EPREFIX}"/usr/share/man/man8/ping6.8
+ doman doc/ping.8
+
+ if use arping ; then
+ dobin arping
+ doman doc/arping.8
+ fi
+
+ into /usr
+
+ local u
+ for u in clockdiff rarpd rdisc tftpd tracepath ; do
+ if use ${u} ; then
+ case ${u} in
+ clockdiff) dobin ${u};;
+ *) dosbin ${u};;
+ esac
+ doman doc/${u}.8
+ fi
+ done
+
+ if use tracepath && use ipv6 ; then
+ dosbin tracepath6
+ dosym tracepath.8 "${EPREFIX}"/usr/share/man/man8/tracepath6.8
+ fi
+
+ if use traceroute && use ipv6 ; then
+ dosbin traceroute6
+ doman doc/traceroute6.8
+ fi
+
+ if use rarpd ; then
+ newinitd "${FILESDIR}"/rarpd.init.d rarpd
+ newconfd "${FILESDIR}"/rarpd.conf.d rarpd
+ fi
+
+ dodoc INSTALL RELNOTES
+
+ use doc && dohtml doc/*.html
+}
+
+pkg_postinst() {
+ fcaps cap_net_raw \
+ bin/ping \
+ $(usex ipv6 'bin/ping6' '') \
+ $(usex arping 'bin/arping' '') \
+ $(usex clockdiff 'usr/bin/clockdiff' '')
+}
diff --git a/net-misc/iputils/iputils-20121221.ebuild b/net-misc/iputils/iputils-20121221.ebuild
new file mode 100644
index 00000000000..be378b2b235
--- /dev/null
+++ b/net-misc/iputils/iputils-20121221.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# For released versions, we precompile the man/html pages and store
+# them in a tarball on our mirrors. This avoids ugly issues while
+# building stages, and when the jade/sgml packages are broken (which
+# seems to be more common than would be nice).
+
+EAPI="4"
+
+inherit flag-o-matic eutils toolchain-funcs
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://www.linux-ipv6.org/gitroot/iputils"
+ inherit git-2
+else
+ SRC_URI="http://www.skbuff.net/iputils/iputils-s${PV}.tar.bz2
+ mirror://gentoo/iputils-s${PV}-manpages.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="Network monitoring tools including ping and ping6"
+HOMEPAGE="http://www.linuxfoundation.org/collaborate/workgroups/networking/iputils"
+
+LICENSE="BSD-4"
+SLOT="0"
+IUSE="caps doc gnutls idn ipv6 SECURITY_HAZARD ssl static"
+
+LIB_DEPEND="caps? ( sys-libs/libcap[static-libs(+)] )
+ idn? ( net-dns/libidn[static-libs(+)] )
+ ipv6? (
+ gnutls? ( net-libs/gnutls[static-libs(+)] )
+ ssl? ( dev-libs/openssl:0[static-libs(+)] )
+ )"
+RDEPEND="!net-misc/rarpd
+ !static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+DEPEND="${RDEPEND}
+ static? ( ${LIB_DEPEND} )
+ virtual/os-headers"
+if [[ ${PV} == "99999999" ]] ; then
+ DEPEND+="
+ app-text/openjade
+ dev-perl/SGMLSpm
+ app-text/docbook-sgml-dtd
+ app-text/docbook-sgml-utils
+ "
+fi
+
+S=${WORKDIR}/${PN}-s${PV}
+
+src_prepare() {
+ epatch "${FILESDIR}"/021109-uclibc-no-ether_ntohost.patch
+ epatch "${FILESDIR}"/${PN}-20121221-openssl.patch #335436
+ epatch "${FILESDIR}"/${PN}-20121221-crypto-build.patch
+ epatch "${FILESDIR}"/${PN}-20100418-so_mark.patch #335347
+ epatch "${FILESDIR}"/${PN}-20121221-makefile.patch
+ epatch "${FILESDIR}"/${PN}-20121221-printf-size.patch
+ epatch "${FILESDIR}"/${PN}-20121221-owl-pingsock.diff
+ use SECURITY_HAZARD && epatch "${FILESDIR}"/${PN}-20071127-nonroot-floodping.patch
+ use static && append-ldflags -static
+}
+
+src_compile() {
+ tc-export CC
+ emake \
+ USE_CAP=$(usex caps) \
+ USE_IDN=$(usex idn) \
+ USE_GNUTLS=$(usex gnutls) \
+ USE_CRYPTO=$(usex ssl) \
+ $(use ipv6 || echo IPV6_TARGETS=)
+
+ if [[ ${PV} == "99999999" ]] ; then
+ emake -j1 html man
+ fi
+}
+
+src_install() {
+ into /
+ dobin ping
+ use ipv6 && dobin ping6
+ dosbin arping
+ into /usr
+ dosbin tracepath
+ use ipv6 && dosbin trace{path,route}6
+ dosbin clockdiff rarpd rdisc ipg tftpd
+
+ fperms 4711 /bin/ping
+ use ipv6 && fperms 4711 /bin/ping6 /usr/sbin/traceroute6
+
+ dodoc INSTALL RELNOTES
+ use ipv6 \
+ && dosym ping.8 /usr/share/man/man8/ping6.8 \
+ || rm -f doc/*6.8
+ rm -f doc/setkey.8
+ doman doc/*.8
+
+ use doc && dohtml doc/*.html
+}
diff --git a/net-misc/iputils/iputils-99999999.ebuild b/net-misc/iputils/iputils-99999999.ebuild
new file mode 100644
index 00000000000..3957639d062
--- /dev/null
+++ b/net-misc/iputils/iputils-99999999.ebuild
@@ -0,0 +1,146 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# For released versions, we precompile the man/html pages and store
+# them in a tarball on our mirrors. This avoids ugly issues while
+# building stages, and when the jade/sgml packages are broken (which
+# seems to be more common than would be nice).
+
+EAPI="4"
+
+inherit flag-o-matic eutils toolchain-funcs fcaps
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://www.linux-ipv6.org/gitroot/iputils"
+ inherit git-2
+else
+ SRC_URI="http://www.skbuff.net/iputils/iputils-s${PV}.tar.bz2
+ mirror://gentoo/iputils-s${PV}-manpages.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="Network monitoring tools including ping and ping6"
+HOMEPAGE="http://www.linuxfoundation.org/collaborate/workgroups/networking/iputils"
+
+LICENSE="BSD-4"
+SLOT="0"
+IUSE="arping caps clockdiff doc gnutls idn ipv6 rarpd rdisc SECURITY_HAZARD ssl static tftpd tracepath traceroute"
+
+LIB_DEPEND="caps? ( sys-libs/libcap[static-libs(+)] )
+ idn? ( net-dns/libidn[static-libs(+)] )
+ ipv6? ( ssl? (
+ gnutls? (
+ net-libs/gnutls[openssl(+)]
+ net-libs/gnutls[static-libs(+)]
+ )
+ !gnutls? ( dev-libs/openssl:0[static-libs(+)] )
+ ) )"
+RDEPEND="arping? ( !net-misc/arping )
+ rarpd? ( !net-misc/rarpd )
+ traceroute? ( !net-misc/traceroute )
+ !static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+DEPEND="${RDEPEND}
+ static? ( ${LIB_DEPEND} )
+ virtual/os-headers"
+if [[ ${PV} == "99999999" ]] ; then
+ DEPEND+="
+ app-text/openjade
+ dev-perl/SGMLSpm
+ app-text/docbook-sgml-dtd
+ app-text/docbook-sgml-utils
+ "
+fi
+
+S=${WORKDIR}/${PN}-s${PV}
+
+src_prepare() {
+ epatch "${FILESDIR}"/021109-uclibc-no-ether_ntohost.patch
+ epatch "${FILESDIR}"/${PN}-99999999-openssl.patch #335436
+ epatch "${FILESDIR}"/${PN}-99999999-tftpd-syslog.patch
+ epatch "${FILESDIR}"/${PN}-20121221-makefile.patch
+ epatch "${FILESDIR}"/${PN}-20121221-parallel-doc.patch
+ epatch "${FILESDIR}"/${PN}-20121221-strtod.patch #472592
+ use SECURITY_HAZARD && epatch "${FILESDIR}"/${PN}-20071127-nonroot-floodping.patch
+}
+
+src_configure() {
+ use static && append-ldflags -static
+
+ IPV4_TARGETS=(
+ ping
+ $(for v in arping clockdiff rarpd rdisc tftpd tracepath ; do usev ${v} ; done)
+ )
+ IPV6_TARGETS=(
+ ping6
+ $(usex tracepath 'tracepath6' '')
+ $(usex traceroute 'traceroute6' '')
+ )
+ use ipv6 || IPV6_TARGETS=()
+}
+
+src_compile() {
+ tc-export CC
+ emake \
+ USE_CAP=$(usex caps) \
+ USE_IDN=$(usex idn) \
+ USE_GNUTLS=$(usex gnutls) \
+ USE_CRYPTO=$(usex ssl) \
+ IPV4_TARGETS="${IPV4_TARGETS[*]}" \
+ IPV6_TARGETS="${IPV6_TARGETS[*]}"
+
+ if [[ ${PV} == "99999999" ]] ; then
+ emake html man
+ fi
+}
+
+src_install() {
+ into /
+ dobin ping $(usex ipv6 'ping6' '')
+ use ipv6 && dosym ping.8 "${EPREFIX}"/usr/share/man/man8/ping6.8
+ doman doc/ping.8
+
+ if use arping ; then
+ dobin arping
+ doman doc/arping.8
+ fi
+
+ into /usr
+
+ local u
+ for u in clockdiff rarpd rdisc tftpd tracepath ; do
+ if use ${u} ; then
+ case ${u} in
+ clockdiff) dobin ${u};;
+ *) dosbin ${u};;
+ esac
+ doman doc/${u}.8
+ fi
+ done
+
+ if use tracepath && use ipv6 ; then
+ dosbin tracepath6
+ dosym tracepath.8 "${EPREFIX}"/usr/share/man/man8/tracepath6.8
+ fi
+
+ if use traceroute && use ipv6 ; then
+ dosbin traceroute6
+ doman doc/traceroute6.8
+ fi
+
+ if use rarpd ; then
+ newinitd "${FILESDIR}"/rarpd.init.d rarpd
+ newconfd "${FILESDIR}"/rarpd.conf.d rarpd
+ fi
+
+ dodoc INSTALL RELNOTES
+
+ use doc && dohtml doc/*.html
+}
+
+pkg_postinst() {
+ fcaps cap_net_raw \
+ bin/ping \
+ $(usex ipv6 'bin/ping6' '') \
+ $(usex arping 'bin/arping' '') \
+ $(usex clockdiff 'usr/bin/clockdiff' '')
+}
diff --git a/net-misc/iputils/metadata.xml b/net-misc/iputils/metadata.xml
new file mode 100644
index 00000000000..dc01592f717
--- /dev/null
+++ b/net-misc/iputils/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <use>
+ <flag name="arping">Build and install arping -- tool for sending ARP requests to peers (see also <pkg>net-analyzer/arping</pkg>)</flag>
+ <flag name="clockdiff">Build and install clockdiff -- tool for comparing clocks via ICMP packets</flag>
+ <flag name="rarpd">Build and install rarpd -- server for handling RARP (reverse ARP) requests; generally only used by old systems</flag>
+ <flag name="rdisc">Build and install rdisc -- server for the client side of the ICMP router discover protocol</flag>
+ <flag name="tftpd">Build and install tftpd -- server for the Trivial File Transfer Protocol (see also <pkg>net-ftp/tftp-hpa</pkg>)</flag>
+ <flag name="tracepath">Build and install tracepath -- tool for tracing network paths for discovering MTU values</flag>
+ <flag name="traceroute">Build and install traceroute -- tool for tracing network paths (see also <pkg>net-analyzer/traceroute</pkg>)</flag>
+ <flag name="SECURITY_HAZARD">Allow non-root users to flood (ping -f). This is generally a very bad idea.</flag>
+ </use>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:skbuff:iputils</remote-id>
+ </upstream>
+</pkgmetadata>