iputils: unbreak musl build; patches from Alpine.

This commit is contained in:
Juan RP 2014-11-10 16:59:51 +01:00
parent b6de55a4f2
commit 3dec450589
7 changed files with 355 additions and 1 deletions

View File

@ -0,0 +1,94 @@
diff -Naur iputils-s20121221.orig/clockdiff.c iputils-s20121221/clockdiff.c
--- iputils-s20121221.orig/clockdiff.c 2014-01-24 15:32:49.111934548 +0000
+++ iputils-s20121221/clockdiff.c 2014-01-24 15:32:14.438932610 +0000
@@ -23,6 +23,8 @@
#include <sys/capability.h>
#endif
+#include "types.h"
+
void usage(void) __attribute__((noreturn));
#define MAX_HOSTNAMELEN NI_MAXHOST
diff -Naur iputils-s20121221.orig/ping.c iputils-s20121221/ping.c
--- iputils-s20121221.orig/ping.c 2014-01-24 15:32:49.111934548 +0000
+++ iputils-s20121221/ping.c 2014-01-24 15:32:14.459932611 +0000
@@ -59,6 +59,7 @@
*/
#include "ping_common.h"
+#include "types.h"
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
diff -Naur iputils-s20121221.orig/ping6.c iputils-s20121221/ping6.c
--- iputils-s20121221.orig/ping6.c 2014-01-24 15:32:49.112934549 +0000
+++ iputils-s20121221/ping6.c 2014-01-24 15:32:14.439932610 +0000
@@ -67,6 +67,7 @@
* This program has to run SUID to ROOT to access the ICMP socket.
*/
#include "ping_common.h"
+#include "types.h"
#include <linux/filter.h>
#include <netinet/ip6.h>
diff -Naur iputils-s20121221.orig/ping_common.c iputils-s20121221/ping_common.c
--- iputils-s20121221.orig/ping_common.c 2014-01-24 15:32:49.112934549 +0000
+++ iputils-s20121221/ping_common.c 2014-01-24 15:32:14.439932610 +0000
@@ -1,4 +1,5 @@
#include "ping_common.h"
+#include "types.h"
#include <ctype.h>
#include <sched.h>
#include <math.h>
diff -Naur iputils-s20121221.orig/ping_common.h iputils-s20121221/ping_common.h
--- iputils-s20121221.orig/ping_common.h 2014-01-24 15:32:14.419932609 +0000
+++ iputils-s20121221/ping_common.h 2014-01-24 15:33:08.206935616 +0000
@@ -35,6 +35,7 @@
#include <linux/errqueue.h>
#include "SNAPSHOT.h"
+#include "types.h"
#define DEFDATALEN (64 - 8) /* default data length */
diff -Naur iputils-s20121221.orig/rdisc.c iputils-s20121221/rdisc.c
--- iputils-s20121221.orig/rdisc.c 2014-01-24 15:32:49.113934549 +0000
+++ iputils-s20121221/rdisc.c 2014-01-24 15:32:14.450932610 +0000
@@ -62,6 +62,7 @@
#include <syslog.h>
#include "SNAPSHOT.h"
+#include "types.h"
struct interface
{
diff -Naur iputils-s20121221.orig/traceroute6.c iputils-s20121221/traceroute6.c
--- iputils-s20121221.orig/traceroute6.c 2014-01-24 15:32:49.113934549 +0000
+++ iputils-s20121221/traceroute6.c 2014-01-24 15:32:14.440932610 +0000
@@ -267,6 +267,7 @@
#include <string.h>
#include <unistd.h>
+#include "types.h"
#include "SNAPSHOT.h"
#ifndef SOL_IPV6
diff -Naur iputils-s20121221.orig/types.h iputils-s20121221/types.h
--- iputils-s20121221.orig/types.h 1970-01-01 00:00:00.000000000 +0000
+++ iputils-s20121221/types.h 2014-01-24 15:32:14.440932610 +0000
@@ -0,0 +1,14 @@
+/* This is a small version of <bits/types.h> from glibc
+ * to take care of type u_char.
+ *
+ * Anthony G. Basile <blueness@gentoo.org>
+ */
+#ifndef _BITS_TYPES_H
+#define _BITS_TYPES_H 1
+
+typedef unsigned char u_char;
+typedef unsigned short int u_short;
+typedef unsigned int u_int;
+typedef unsigned long int u_long;
+
+#endif /* mini <bits/types.h> */

View File

@ -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

View File

@ -0,0 +1,23 @@
diff -Naur iputils-s20121221.orig/ping.c iputils-s20121221/ping.c
--- iputils-s20121221.orig/ping.c 2014-01-24 15:05:02.082841335 +0000
+++ iputils-s20121221/ping.c 2014-01-24 15:17:12.975882203 +0000
@@ -774,9 +774,16 @@
do {
static struct iovec iov = {outpack, 0};
- static struct msghdr m = { &whereto, sizeof(whereto),
- &iov, 1, &cmsg, 0, 0 };
- m.msg_controllen = cmsg_len;
+ static struct msghdr m;
+
+ m.msg_name = &whereto;
+ m.msg_namelen = sizeof(whereto);
+ m.msg_iov = &iov;
+ m.msg_iovlen = 1;
+ m.msg_control = &cmsg;
+ m.msg_controllen = sizeof(cmsg);
+ m.msg_flags = 0;
+
iov.iov_len = cc;
i = sendmsg(icmp_sock, &m, confirm);

View File

@ -0,0 +1,108 @@
diff -Naur iputils-s20121221.orig/arping.c iputils-s20121221/arping.c
--- iputils-s20121221.orig/arping.c 2012-12-21 14:01:07.000000000 +0000
+++ iputils-s20121221/arping.c 2014-01-23 21:19:57.091268011 +0000
@@ -16,7 +16,7 @@
#include <linux/sockios.h>
#include <sys/file.h>
#include <sys/time.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/if_packet.h>
--- iputils-s20121221.orig/clockdiff.c 2012-12-21 14:01:07.000000000 +0000
+++ iputils-s20121221/clockdiff.c 2014-01-23 21:19:57.093268011 +0000
@@ -14,7 +14,6 @@
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#define TSPTYPES
-#include <protocols/timed.h>
#include <fcntl.h>
#include <netdb.h>
#include <arpa/inet.h>
diff -Naur iputils-s20121221.orig/ping_common.h iputils-s20121221/ping_common.h
--- iputils-s20121221.orig/ping_common.h 2012-12-21 14:01:07.000000000 +0000
+++ iputils-s20121221/ping_common.h 2014-01-23 21:27:07.677292088 +0000
@@ -7,16 +7,17 @@
#include <linux/sockios.h>
#include <sys/file.h>
#include <sys/time.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <sys/uio.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <setjmp.h>
+#include <asm-generic/param.h>
#ifdef CAPABILITIES
#include <sys/prctl.h>
--- iputils-s20121221.orig/rarpd.c 2014-01-24 13:38:46.816551953 +0000
+++ iputils-s20121221/rarpd.c 2014-01-24 13:36:51.833545524 +0000
@@ -19,16 +19,17 @@
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <sys/errno.h>
-#include <sys/fcntl.h>
+#include <poll.h>
+#include <errno.h>
+#include <fcntl.h>
#include <sys/socket.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <linux/if.h>
#include <linux/if_arp.h>
#include <netinet/in.h>
#include <linux/if_packet.h>
#include <linux/filter.h>
+#include <sys/types.h>
int do_reload = 1;
--- iputils-s20121221.orig/tracepath.c 2014-01-24 13:38:46.865551956 +0000
+++ iputils-s20121221/tracepath.c 2014-01-23 21:19:57.109268012 +0000
@@ -23,6 +23,8 @@
#include <sys/time.h>
#include <sys/uio.h>
#include <arpa/inet.h>
+#include <sys/types.h>
+#include <limits.h>
#ifdef USE_IDN
#include <idna.h>
#include <locale.h>
--- iputils-s20121221.orig/tracepath6.c 2014-01-24 13:38:46.865551956 +0000
+++ iputils-s20121221/tracepath6.c 2014-01-23 21:20:40.316270428 +0000
@@ -25,6 +25,7 @@
#include <sys/time.h>
#include <sys/uio.h>
#include <arpa/inet.h>
+#include <limits.h>
#ifdef USE_IDN
#include <idna.h>
--- a/tracepath.c.orig 2014-11-10 16:57:16.549029140 +0100
+++ b/tracepath.c 2014-11-10 16:57:37.996240185 +0100
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <linux/types.h>
#include <linux/errqueue.h>
#include <errno.h>
@@ -23,7 +24,6 @@
#include <sys/time.h>
#include <sys/uio.h>
#include <arpa/inet.h>
-#include <sys/types.h>
#include <limits.h>
#ifdef USE_IDN
#include <idna.h>

View File

@ -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

View File

@ -0,0 +1,30 @@
diff -Naur iputils-s20121221.orig/rdisc.c iputils-s20121221/rdisc.c
--- iputils-s20121221.orig/rdisc.c 2014-01-24 14:59:29.937822762 +0000
+++ iputils-s20121221/rdisc.c 2014-01-23 21:25:58.760288234 +0000
@@ -115,26 +114,7 @@
#define MAXIFS 32
-#if !defined(__GLIBC__) || __GLIBC__ < 2
-/* For router advertisement */
-struct icmp_ra
-{
- 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 */
- u_char icmp_num_addrs;
- u_char icmp_wpa; /* Words per address */
- short icmp_lifetime;
-};
-
-struct icmp_ra_addr
-{
- __u32 ira_addr;
- __u32 ira_preference;
-};
-#else
#define icmp_ra icmp
-#endif
/* Router constants */
#define MAX_INITIAL_ADVERT_INTERVAL 16

View File

@ -1,7 +1,7 @@
# Template file for 'iputils'
pkgname=iputils
version=20121221
revision=4
revision=5
patch_args="-Np1"
wrksrc="${pkgname}-s${version}"
makedepends="libressl-devel libcap-devel"