From e6e5113cb91830bc97a778d98b3c551b25d8f5cb Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 30 Dec 2013 11:24:18 +0100 Subject: fix musl compile --- package/traceroute/Makefile | 4 +- package/traceroute/patches/patch-Make_rules | 14 +-- package/traceroute/patches/patch-traceroute_csum_c | 17 +++ .../patches/patch-traceroute_extension_c | 61 ++++++++++ .../traceroute/patches/patch-traceroute_mod-dccp_c | 55 +++++++++ .../traceroute/patches/patch-traceroute_mod-icmp_c | 22 ++++ .../traceroute/patches/patch-traceroute_mod-tcp_c | 126 +++++++++++++++++++++ .../traceroute/patches/patch-traceroute_mod-udp_c | 20 ++++ .../patches/patch-traceroute_traceroute_c | 34 ++++++ .../patches/patch-traceroute_traceroute_h | 11 ++ 10 files changed, 355 insertions(+), 9 deletions(-) create mode 100644 package/traceroute/patches/patch-traceroute_csum_c create mode 100644 package/traceroute/patches/patch-traceroute_extension_c create mode 100644 package/traceroute/patches/patch-traceroute_mod-dccp_c create mode 100644 package/traceroute/patches/patch-traceroute_mod-icmp_c create mode 100644 package/traceroute/patches/patch-traceroute_mod-tcp_c create mode 100644 package/traceroute/patches/patch-traceroute_mod-udp_c create mode 100644 package/traceroute/patches/patch-traceroute_traceroute_c create mode 100644 package/traceroute/patches/patch-traceroute_traceroute_h (limited to 'package/traceroute') diff --git a/package/traceroute/Makefile b/package/traceroute/Makefile index 31ee8bd4c..c908cc34d 100644 --- a/package/traceroute/Makefile +++ b/package/traceroute/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= traceroute -PKG_VERSION:= 2.0.18 +PKG_VERSION:= 2.0.19 PKG_RELEASE:= 1 -PKG_MD5SUM:= b7254149b7f081cce07f4b9e065ba5ef +PKG_MD5SUM:= dd15d563993020d088ba02e8f987deaf PKG_DESCR:= Utility to trace the route of IP packets PKG_SECTION:= net PKG_URL:= http://traceroute.sourceforge.net/ diff --git a/package/traceroute/patches/patch-Make_rules b/package/traceroute/patches/patch-Make_rules index 35f8b4003..5d347bc68 100644 --- a/package/traceroute/patches/patch-Make_rules +++ b/package/traceroute/patches/patch-Make_rules @@ -1,5 +1,5 @@ ---- traceroute-2.0.16.orig/Make.rules 2010-09-09 16:20:46.000000000 +0200 -+++ traceroute-2.0.16/Make.rules 2010-10-11 20:07:03.000000000 +0200 +--- traceroute-2.0.19.orig/Make.rules 2012-03-27 15:49:04.000000000 +0200 ++++ traceroute-2.0.19/Make.rules 2013-12-29 20:01:35.000000000 +0100 @@ -46,14 +46,14 @@ $(call set, INSTALL, cp) $(call set, INDENT, true) @@ -15,11 +15,11 @@ -prefix = /usr/local +prefix = /usr - exec_prefix = $(prefix) - bindir = $(exec_prefix)/bin -@@ -125,7 +125,7 @@ _libs = $(strip $(foreach lib,$(LIBDIRS) - $(wildcard $(srcdir)/$(lib)/$(lib).so \ - $(srcdir)/$(lib)/$(lib).a)))) + ifneq ($(wildcard /lib64/libc.* /usr/lib64/libc.*),) + lib := lib64 +@@ -131,7 +131,7 @@ _libs = $(strip $(foreach _lib,$(LIBDIRS + $(wildcard $(srcdir)/$(_lib)/$(_lib).so \ + $(srcdir)/$(_lib)/$(_lib).a)))) -override LIBS := $(_libs) -lm $(LIBS) +override LIBS := $(_libs) $(LIBS) diff --git a/package/traceroute/patches/patch-traceroute_csum_c b/package/traceroute/patches/patch-traceroute_csum_c new file mode 100644 index 000000000..8332de5e4 --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_csum_c @@ -0,0 +1,17 @@ +--- traceroute-2.0.19.orig/traceroute/csum.c 2007-07-19 16:47:55.000000000 +0200 ++++ traceroute-2.0.19/traceroute/csum.c 2013-12-29 20:01:35.000000000 +0100 +@@ -12,11 +12,11 @@ + #include "traceroute.h" + + +-u_int16_t in_csum (const void *ptr, size_t len) { +- const u_int16_t *p = (const u_int16_t *) ptr; ++uint16_t in_csum (const void *ptr, size_t len) { ++ const uint16_t *p = (const uint16_t *) ptr; + size_t nw = len / 2; + unsigned int sum = 0; +- u_int16_t res; ++ uint16_t res; + + while (nw--) sum += *p++; + diff --git a/package/traceroute/patches/patch-traceroute_extension_c b/package/traceroute/patches/patch-traceroute_extension_c new file mode 100644 index 000000000..94606f546 --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_extension_c @@ -0,0 +1,61 @@ +--- traceroute-2.0.19.orig/traceroute/extension.c 2010-07-14 16:29:08.000000000 +0200 ++++ traceroute-2.0.19/traceroute/extension.c 2013-12-29 20:01:35.000000000 +0100 +@@ -14,16 +14,16 @@ struct icmp_ext_header { + unsigned int reserved:4; + unsigned int version:4; + #endif +- u_int8_t reserved1; +- u_int16_t checksum; ++ uint8_t reserved1; ++ uint16_t checksum; + } __attribute__ ((packed)); + + + struct icmp_ext_object { +- u_int16_t length; +- u_int8_t class; +- u_int8_t c_type; +- u_int8_t data[0]; ++ uint16_t length; ++ uint8_t class; ++ uint8_t c_type; ++ uint8_t data[0]; + }; + + #define MPLS_CLASS 1 +@@ -49,7 +49,7 @@ static int try_extension (probe *pb, cha + if (iext->version != 2) return -1; + + if (iext->checksum && +- in_csum (iext, len) != (u_int16_t) ~0 ++ in_csum (iext, len) != (uint16_t) ~0 + ) return -1; + + buf += sizeof (*iext); +@@ -60,7 +60,7 @@ static int try_extension (probe *pb, cha + struct icmp_ext_object *obj = (struct icmp_ext_object *) buf; + size_t objlen = ntohs (obj->length); + size_t data_len; +- u_int32_t *ui = (u_int32_t *) obj->data; ++ uint32_t *ui = (uint32_t *) obj->data; + int i, n; + + if (objlen < sizeof (*obj) || +@@ -68,7 +68,7 @@ static int try_extension (probe *pb, cha + ) return -1; + + data_len = objlen - sizeof (*obj); +- if (data_len % sizeof (u_int32_t)) ++ if (data_len % sizeof (uint32_t)) + return -1; /* must be 32bit rounded... */ + + n = data_len / sizeof (*ui); +@@ -85,7 +85,7 @@ static int try_extension (probe *pb, cha + do_snprintf (curr, end, "MPLS:"); + + for (i = 0; i < n; i++, ui++) { +- u_int32_t mpls = ntohl (*ui); ++ uint32_t mpls = ntohl (*ui); + + do_snprintf (curr, end, "%sL=%u,E=%u,S=%u,T=%u", + i ? "/" : "", diff --git a/package/traceroute/patches/patch-traceroute_mod-dccp_c b/package/traceroute/patches/patch-traceroute_mod-dccp_c new file mode 100644 index 000000000..18dcbedaf --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_mod-dccp_c @@ -0,0 +1,55 @@ +--- traceroute-2.0.19.orig/traceroute/mod-dccp.c 2012-11-19 16:51:53.000000000 +0100 ++++ traceroute-2.0.19/traceroute/mod-dccp.c 2013-12-29 20:01:35.000000000 +0100 +@@ -30,7 +30,7 @@ static unsigned int dest_port = 0; + static int raw_sk = -1; + static int last_ttl = 0; + +-static u_int8_t buf[1024]; /* enough, enough... */ ++static uint8_t buf[1024]; /* enough, enough... */ + static size_t csum_len = 0; + static struct dccp_hdr *dh = NULL; + static struct dccp_hdr_ext *dhe = NULL; +@@ -51,8 +51,8 @@ static int dccp_init (const sockaddr_any + int af = dest->sa.sa_family; + sockaddr_any src; + socklen_t len; +- u_int8_t *ptr; +- u_int16_t *lenp; ++ uint8_t *ptr; ++ uint16_t *lenp; + + + dest_addr = *dest; +@@ -117,10 +117,10 @@ static int dccp_init (const sockaddr_any + ptr += len; + } + +- lenp = (u_int16_t *) ptr; +- ptr += sizeof (u_int16_t); +- *((u_int16_t *) ptr) = htons ((u_int16_t) IPPROTO_DCCP); +- ptr += sizeof (u_int16_t); ++ lenp = (uint16_t *) ptr; ++ ptr += sizeof (uint16_t); ++ *((uint16_t *) ptr) = htons ((uint16_t) IPPROTO_DCCP); ++ ptr += sizeof (uint16_t); + + + /* Construct DCCP header */ +@@ -153,7 +153,7 @@ static int dccp_init (const sockaddr_any + if (csum_len > sizeof (buf)) + error ("impossible"); /* paranoia */ + +- len = ptr - (u_int8_t *) dh; ++ len = ptr - (uint8_t *) dh; + if (len & 0x03) error ("impossible"); /* as >>2 ... */ + + *lenp = htons (len); +@@ -232,7 +232,7 @@ static probe *dccp_check_reply (int sk, + char *buf, size_t len) { + probe *pb; + struct dccp_hdr *ndh = (struct dccp_hdr *) buf; +- u_int16_t sport, dport; ++ uint16_t sport, dport; + + + if (len < 8) return NULL; /* too short */ diff --git a/package/traceroute/patches/patch-traceroute_mod-icmp_c b/package/traceroute/patches/patch-traceroute_mod-icmp_c new file mode 100644 index 000000000..13852be0b --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_mod-icmp_c @@ -0,0 +1,22 @@ +--- traceroute-2.0.19.orig/traceroute/mod-icmp.c 2011-08-18 17:12:00.000000000 +0200 ++++ traceroute-2.0.19/traceroute/mod-icmp.c 2013-12-29 20:01:35.000000000 +0100 +@@ -20,8 +20,8 @@ + + + static sockaddr_any dest_addr = {{ 0, }, }; +-static u_int16_t seq = 1; +-static u_int16_t ident = 0; ++static uint16_t seq = 1; ++static uint16_t ident = 0; + + static char *data; + static size_t *length_p; +@@ -173,7 +173,7 @@ static probe *icmp_check_reply (int sk, + char *buf, size_t len) { + int af = dest_addr.sa.sa_family; + int type; +- u_int16_t recv_id, recv_seq; ++ uint16_t recv_id, recv_seq; + probe *pb; + + diff --git a/package/traceroute/patches/patch-traceroute_mod-tcp_c b/package/traceroute/patches/patch-traceroute_mod-tcp_c new file mode 100644 index 000000000..9327a1b86 --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_mod-tcp_c @@ -0,0 +1,126 @@ +--- traceroute-2.0.19.orig/traceroute/mod-tcp.c 2012-03-27 16:01:15.000000000 +0200 ++++ traceroute-2.0.19/traceroute/mod-tcp.c 2013-12-29 20:16:23.000000000 +0100 +@@ -18,6 +18,24 @@ + #include + #include + ++#if !defined(__GLIBC__) ++# define TCPOPT_EOL 0 ++# define TCPOPT_NOP 1 ++# define TCPOPT_MAXSEG 2 ++# define TCPOLEN_MAXSEG 4 ++# define TCPOPT_WINDOW 3 ++# define TCPOLEN_WINDOW 3 ++# define TCPOPT_SACK_PERMITTED 4 /* Experimental */ ++# define TCPOLEN_SACK_PERMITTED 2 ++# define TCPOPT_SACK 5 /* Experimental */ ++# define TCPOPT_TIMESTAMP 8 ++# define TCPOLEN_TIMESTAMP 10 ++# define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ ++ ++# define TCPOPT_TSTAMP_HDR \ ++ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) ++#endif ++ + + #include "traceroute.h" + +@@ -33,11 +51,11 @@ static unsigned int dest_port = 0; + static int raw_sk = -1; + static int last_ttl = 0; + +-static u_int8_t buf[1024]; /* enough, enough... */ ++static uint8_t buf[1024]; /* enough, enough... */ + static size_t csum_len = 0; + static struct tcphdr *th = NULL; + +-#define TH_FLAGS(TH) (((u_int8_t *) (TH))[13]) ++#define TH_FLAGS(TH) (((uint8_t *) (TH))[13]) + #define TH_FIN 0x01 + #define TH_SYN 0x02 + #define TH_RST 0x04 +@@ -164,7 +182,7 @@ static CLIF_option tcp_options[] = { + static int check_sysctl (const char *name) { + int fd, res; + char buf[sizeof (SYSCTL_PREFIX) + strlen (name) + 1]; +- u_int8_t ch; ++ uint8_t ch; + + strcpy (buf, SYSCTL_PREFIX); + strcat (buf, name); +@@ -191,8 +209,8 @@ static int tcp_init (const sockaddr_any + sockaddr_any src; + int mtu; + socklen_t len; +- u_int8_t *ptr; +- u_int16_t *lenp; ++ uint8_t *ptr; ++ uint16_t *lenp; + + + dest_addr = *dest; +@@ -286,10 +304,10 @@ static int tcp_init (const sockaddr_any + ptr += len; + } + +- lenp = (u_int16_t *) ptr; +- ptr += sizeof (u_int16_t); +- *((u_int16_t *) ptr) = htons ((u_int16_t) IPPROTO_TCP); +- ptr += sizeof (u_int16_t); ++ lenp = (uint16_t *) ptr; ++ ptr += sizeof (uint16_t); ++ *((uint16_t *) ptr) = htons ((uint16_t) IPPROTO_TCP); ++ ptr += sizeof (uint16_t); + + + /* Construct TCP header */ +@@ -309,13 +327,13 @@ static int tcp_init (const sockaddr_any + + /* Build TCP options */ + +- ptr = (u_int8_t *) (th + 1); ++ ptr = (uint8_t *) (th + 1); + + if (flags & TH_SYN) { + *ptr++ = TCPOPT_MAXSEG; /* 2 */ + *ptr++ = TCPOLEN_MAXSEG; /* 4 */ +- *((u_int16_t *) ptr) = htons (mss ? mss : mtu); +- ptr += sizeof (u_int16_t); ++ *((uint16_t *) ptr) = htons (mss ? mss : mtu); ++ ptr += sizeof (uint16_t); + } + + if (flags & FL_TSTAMP) { +@@ -330,10 +348,10 @@ static int tcp_init (const sockaddr_any + *ptr++ = TCPOPT_TIMESTAMP; /* 8 */ + *ptr++ = TCPOLEN_TIMESTAMP; /* 10 */ + +- *((u_int32_t *) ptr) = random_seq (); /* really! */ +- ptr += sizeof (u_int32_t); +- *((u_int32_t *) ptr) = (flags & TH_ACK) ? random_seq () : 0; +- ptr += sizeof (u_int32_t); ++ *((uint32_t *) ptr) = random_seq (); /* really! */ ++ ptr += sizeof (uint32_t); ++ *((uint32_t *) ptr) = (flags & TH_ACK) ? random_seq () : 0; ++ ptr += sizeof (uint32_t); + } + else if (flags & FL_SACK) { + *ptr++ = TCPOPT_NOP; /* 1 */ +@@ -355,7 +373,7 @@ static int tcp_init (const sockaddr_any + if (csum_len > sizeof (buf)) + error ("impossible"); /* paranoia */ + +- len = ptr - (u_int8_t *) th; ++ len = ptr - (uint8_t *) th; + if (len & 0x03) error ("impossible"); /* as >>2 ... */ + + *lenp = htons (len); +@@ -436,7 +454,7 @@ static probe *tcp_check_reply (int sk, i + char *buf, size_t len) { + probe *pb; + struct tcphdr *tcp = (struct tcphdr *) buf; +- u_int16_t sport, dport; ++ uint16_t sport, dport; + + + if (len < 8) return NULL; /* too short */ diff --git a/package/traceroute/patches/patch-traceroute_mod-udp_c b/package/traceroute/patches/patch-traceroute_mod-udp_c new file mode 100644 index 000000000..1fcbf8b2b --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_mod-udp_c @@ -0,0 +1,20 @@ +--- traceroute-2.0.19.orig/traceroute/mod-udp.c 2010-12-14 16:51:44.000000000 +0100 ++++ traceroute-2.0.19/traceroute/mod-udp.c 2013-12-29 20:01:35.000000000 +0100 +@@ -71,7 +71,7 @@ static int udp_init (const sockaddr_any + dest_addr = *dest; + + if (!port_seq) port_seq = DEF_UDP_PORT; +- dest_addr.sin.sin_port = htons ((u_int16_t) port_seq); ++ dest_addr.sin.sin_port = htons ((uint16_t) port_seq); + + fill_data (packet_len_p); + +@@ -107,7 +107,7 @@ static int udplite_init (const sockaddr_ + dest_addr = *dest; + + if (!port_seq) port_seq = DEF_UDP_PORT; /* XXX: Hmmm... */ +- dest_addr.sin.sin_port = htons ((u_int16_t) port_seq); ++ dest_addr.sin.sin_port = htons ((uint16_t) port_seq); + + protocol = IPPROTO_UDPLITE; + diff --git a/package/traceroute/patches/patch-traceroute_traceroute_c b/package/traceroute/patches/patch-traceroute_traceroute_c new file mode 100644 index 000000000..b9b7f27d9 --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_traceroute_c @@ -0,0 +1,34 @@ +--- traceroute-2.0.19.orig/traceroute/traceroute.c 2012-11-19 17:12:04.000000000 +0100 ++++ traceroute-2.0.19/traceroute/traceroute.c 2013-12-30 11:22:50.000000000 +0100 +@@ -31,6 +31,13 @@ + #include "version.h" + #include "traceroute.h" + ++#ifndef AI_IDN ++# define AI_IDN 0 /* GNU/libc extension */ ++#endif ++ ++#ifndef NI_IDN ++# define NI_IDN 0 /* GNU/libc extension */ ++#endif + + #ifndef ICMP6_DST_UNREACH_BEYONDSCOPE + #ifdef ICMP6_DST_UNREACH_NOTNEIGHBOR +@@ -325,7 +332,7 @@ static void init_ip_options (void) { + rth->ip6r_type = ipv6_rthdr_type; + rth->ip6r_segleft = num_gateways; + +- *((u_int32_t *) (rth + 1)) = 0; ++ *((uint32_t *) (rth + 1)) = 0; + + in6 = (struct in6_addr *) (rtbuf + 8); + for (i = 0; i < num_gateways; i++) +@@ -606,7 +613,7 @@ int main (int argc, char *argv[]) { + htonl (((tos & 0xff) << 20) | (flow_label & 0x000fffff)); + + if (src_port) { +- src_addr.sin.sin_port = htons ((u_int16_t) src_port); ++ src_addr.sin.sin_port = htons ((uint16_t) src_port); + src_addr.sa.sa_family = af; + } + diff --git a/package/traceroute/patches/patch-traceroute_traceroute_h b/package/traceroute/patches/patch-traceroute_traceroute_h new file mode 100644 index 000000000..21efe3210 --- /dev/null +++ b/package/traceroute/patches/patch-traceroute_traceroute_h @@ -0,0 +1,11 @@ +--- traceroute-2.0.19.orig/traceroute/traceroute.h 2012-11-19 15:46:11.000000000 +0100 ++++ traceroute-2.0.19/traceroute/traceroute.h 2013-12-29 20:01:35.000000000 +0100 +@@ -92,7 +92,7 @@ const char *get_as_path (const char *que + int raw_can_connect (void); + + unsigned int random_seq (void); +-u_int16_t in_csum (const void *ptr, size_t len); ++uint16_t in_csum (const void *ptr, size_t len); + + + void tr_register_module (tr_module *module); -- cgit v1.2.3