Commit 886cdb13 authored by Francesco Colista's avatar Francesco Colista

main/iputils: fixes compilation with musl

parent 0a7a893f
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iputils
pkgver=20121221
pkgrel=1
pkgrel=2
pkgdesc="IP Configuration Utilities (and Ping)"
url="http://www.linuxfoundation.org/en/Net:Iputils"
arch="all"
......@@ -10,9 +10,28 @@ install=""
depends=""
makedepends="libcap-dev openssl-dev"
replaces="bbsuid"
source="http://www.skbuff.net/$pkgname/$pkgname-s$pkgver.tar.bz2"
source="http://www.skbuff.net/$pkgname/$pkgname-s$pkgver.tar.bz2
net-misc_iputils_files_iputils-20121221-add-bits_types_h.patch
net-misc_iputils_files_iputils-20121221-crypto-build.patch
net-misc_iputils_files_iputils-20121221-fix-init-elemnt.patch
net-misc_iputils_files_iputils-20121221-fix-musl-headers.patch
net-misc_iputils_files_iputils-20121221-makefile.patch
net-misc_iputils_files_iputils-20121221-openssl.patch
net-misc_iputils_files_iputils-20121221-printf-size.patch
net-misc_iputils_files_iputils-20121221-remove-rdisc-glibc-assumption.patch"
_builddir="$srcdir"/$pkgname-s$pkgver
prepare() {
local i
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
build() {
cd "$_builddir"
make USE_GNUTLS=no KERNEL_INCLUDE=/usr/include || return 1
......@@ -28,6 +47,30 @@ package() {
done
}
md5sums="6072aef64205720dd1893b375e184171 iputils-s20121221.tar.bz2"
sha256sums="450f549fc5b620c23c5929aa6d54b7ddfc7ee1cb1e8efdc5e8bb21d8d0c5319f iputils-s20121221.tar.bz2"
sha512sums="693d240becd766c345c3af2053fc0699b9358e54d667d40738c21d731b70e779112d81476a220d8300ca54250120385414a13610d445996f95a90571047389f4 iputils-s20121221.tar.bz2"
md5sums="6072aef64205720dd1893b375e184171 iputils-s20121221.tar.bz2
2b31520b0d939e0b82e6a6a3bba0dfcc net-misc_iputils_files_iputils-20121221-add-bits_types_h.patch
8ea6b0b6f2598fadfb0e505998c554de net-misc_iputils_files_iputils-20121221-crypto-build.patch
1cb3cb8c34e3a20e3722393aa61c1869 net-misc_iputils_files_iputils-20121221-fix-init-elemnt.patch
c47ac7ec21ba9bcaa0311c692ccd14d6 net-misc_iputils_files_iputils-20121221-fix-musl-headers.patch
c1e5dab42e18b35a00ed7b3755c24e4e net-misc_iputils_files_iputils-20121221-makefile.patch
1c6c476e3b4850754a2cd91fd53f0cfd net-misc_iputils_files_iputils-20121221-openssl.patch
4c35d6b1d9c0727b9647860a5334ae0f net-misc_iputils_files_iputils-20121221-printf-size.patch
d4b0a95e52532070a8b45fba46112f66 net-misc_iputils_files_iputils-20121221-remove-rdisc-glibc-assumption.patch"
sha256sums="450f549fc5b620c23c5929aa6d54b7ddfc7ee1cb1e8efdc5e8bb21d8d0c5319f iputils-s20121221.tar.bz2
e198400f387fa4140c7c6a75089b570ea24d044cf6fd55b1f37f239bb018969e net-misc_iputils_files_iputils-20121221-add-bits_types_h.patch
cafc281c70d46f2964489b4c19c981bcf203b4c6266d4f49437c3fe67e2027b2 net-misc_iputils_files_iputils-20121221-crypto-build.patch
302b1118596befdad56d23769e36fc0960d807230bc5c6ad4ad59d00fb78560b net-misc_iputils_files_iputils-20121221-fix-init-elemnt.patch
bdd3992ed19d625cfd08563ef46ab22f25ca46390ad4603e501f9c66d2508bcc net-misc_iputils_files_iputils-20121221-fix-musl-headers.patch
779632822e3440f3b898a50955cb8fb72177f0d1623c9da7c0a8afa68313435f net-misc_iputils_files_iputils-20121221-makefile.patch
cc1af5ccdd593b4fa43273cf7de8b9552f0a5d33a72a35fcc4f94cf2c6fc9a44 net-misc_iputils_files_iputils-20121221-openssl.patch
a1ed939d0e008bca06208ae34e3f17a0ddc66b50f1679f82a630b52cdfbd111a net-misc_iputils_files_iputils-20121221-printf-size.patch
0639fca129c3e2ca57a7e0f0d3392474665e11f139cfa9362a365b3fca9593b2 net-misc_iputils_files_iputils-20121221-remove-rdisc-glibc-assumption.patch"
sha512sums="693d240becd766c345c3af2053fc0699b9358e54d667d40738c21d731b70e779112d81476a220d8300ca54250120385414a13610d445996f95a90571047389f4 iputils-s20121221.tar.bz2
666c1711c5a5c829246a0f9a3d9afbb0ceb43e172b907230b856dbc0a330814d0c562e1894ee3b6051c01b54469fafd429c4236954967691b12744cacc844dab net-misc_iputils_files_iputils-20121221-add-bits_types_h.patch
922daa01f00c19f8237515b2d3ab73b87daa957cfc491382def2ce1c098ffed943ad4952c94134f3155570f64353abf5348523ea773ce7eb457578f975cc92d2 net-misc_iputils_files_iputils-20121221-crypto-build.patch
15cc4a96851eaa77f08e3914139925cecc50ff7161a693e86cb6f5ae09da5c2d232325f922c1cf4af20d639ed89071314092f31fa55e23bc5033bfb74eeda7a3 net-misc_iputils_files_iputils-20121221-fix-init-elemnt.patch
82b88635e5fec34b4175c74d25b821d3b76b899c48aa87b7035ae8702a3ede3abaebb3d9be32cb7e853186d78db5e9c03cdd14cfc1ce9481f6ae65466815bdac net-misc_iputils_files_iputils-20121221-fix-musl-headers.patch
5899942b73d4d13e0ff85f22a81e9107b2a04c82cac6b59559a521c5d0bf25007e34b61b2dfdb40c21b221a108f6ba72c1a51fa59359a400ad045c9394c176db net-misc_iputils_files_iputils-20121221-makefile.patch
05240c00d0a1f9f878a9826d54cbd0128c2ed5ce7cab4685907956156c3cf2131ccd563812b64490bf915a75f52851396966a590027fc4c1886b2d19f421718b net-misc_iputils_files_iputils-20121221-openssl.patch
ff5491ad5a0396bee41fcbfc1384699d396c24da093bd2209dead67f52efcec462dbfb4a43008083742d0139da7bd52e922499b5f7eae028384c74930453dd33 net-misc_iputils_files_iputils-20121221-printf-size.patch
2ed65a0c0188cf6e06bfb5e3795fa720f7e7040533adbc1ce0c5ded435b823792790890826fc4250a6b2fba16576dc024c50d1faf9598f2fe36aadda77db8a36 net-misc_iputils_files_iputils-20121221-remove-rdisc-glibc-assumption.patch"
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> */
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 -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);
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,7 @@
#include <sys/time.h>
#include <sys/uio.h>
#include <arpa/inet.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>
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
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
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 -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment