aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriadne Conill <ariadne@dereferenced.org>2020-01-17 21:39:53 +0000
committerAriadne Conill <ariadne@dereferenced.org>2020-01-17 21:41:05 +0000
commit04c412846d31baf2118c7d65e903bbb3a368fbca (patch)
tree28b495962197b78bc66b4eec767f711a38843d28
parent65f8dc122b88efc95fc426f8bc38c093ba27bf2f (diff)
downloadaports-04c412846d31baf2118c7d65e903bbb3a368fbca.tar.bz2
aports-04c412846d31baf2118c7d65e903bbb3a368fbca.tar.xz
testing/paris-traceroute: new aport
-rw-r--r--testing/paris-traceroute/APKBUILD50
-rw-r--r--testing/paris-traceroute/clean-errno.patch23
-rw-r--r--testing/paris-traceroute/fix-idn.patch24
-rw-r--r--testing/paris-traceroute/in6-union.patch56
4 files changed, 153 insertions, 0 deletions
diff --git a/testing/paris-traceroute/APKBUILD b/testing/paris-traceroute/APKBUILD
new file mode 100644
index 0000000000..0408e1d41c
--- /dev/null
+++ b/testing/paris-traceroute/APKBUILD
@@ -0,0 +1,50 @@
+# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
+pkgname="paris-traceroute"
+pkgver="0.93"
+pkgrel=0
+pkgdesc="advanced traceroute utility"
+url="https://github.com/libparistraceroute/libparistraceroute"
+arch="all"
+license="GPL-3.0-only"
+depends=""
+depends_dev=""
+makedepends="$depends_dev autoconf automake libtool"
+install=""
+subpackages="$pkgname-dev $pkgname-doc $pkgname-ping $pkgname-dbg"
+source="https://github.com/libparistraceroute/libparistraceroute/archive/v$pkgver/libparistraceroute-$pkgver.tar.gz
+ in6-union.patch
+ fix-idn.patch
+ clean-errno.patch"
+builddir="$srcdir/libparistraceroute-$pkgver"
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+ sh autogen.sh
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make
+}
+
+package() {
+ make install DESTDIR="$pkgdir"
+}
+
+ping() {
+ pkgdesc="paris-traceroute ping utility"
+
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/ping "$subpkgdir"/usr/bin
+}
+
+sha512sums="505de465454c349adea936637a097bb3f812f010665825badfc97751e9219325d04d8af78ac6d107e66ff6ef02a8cda1559b8073906d36a745115cd54104a8b4 libparistraceroute-0.93.tar.gz
+64e48afad3ac389a13f96838f1de7a9174040cefde2843734daa33ad846340408e58a3792573422d3847718053ec9de62420f853caaf866eef0a4f3f26986e11 in6-union.patch
+37e1b50e323907695df55629f7457754f788edb2de180058b909d930b355e0647e363c9650cc182678616fc2001cafe7982803b0884e299232d8331cad537675 fix-idn.patch
+9b7ab98db5f8c4260d0879f59277066fe4d4beee91cb1627653447672111c64ab8a47d608492cc22b5884965ba14614bc69785df885202240a3aebd6a5663fec clean-errno.patch"
diff --git a/testing/paris-traceroute/clean-errno.patch b/testing/paris-traceroute/clean-errno.patch
new file mode 100644
index 0000000000..c2bd94e0f0
--- /dev/null
+++ b/testing/paris-traceroute/clean-errno.patch
@@ -0,0 +1,23 @@
+Hack to workaround buggy error handling code.
+
+Upstream-status: Not submitted
+--- libparistraceroute-0.93.orig/paris-traceroute/paris-traceroute.c
++++ libparistraceroute-0.93/paris-traceroute/paris-traceroute.c
+@@ -453,6 +453,7 @@
+ goto ERR_PT_LOOP;
+ }
+ exit_code = EXIT_SUCCESS;
++ errno = 0;
+
+ // Leave the program
+ ERR_PT_LOOP:
+--- libparistraceroute-0.93.orig/ping/ping.c
++++ libparistraceroute-0.93/ping/ping.c
+@@ -500,6 +500,7 @@
+ }
+
+ exit_code = EXIT_SUCCESS;
++ errno = 0;
+
+ // Leave the program
+ ERR_PT_LOOP:
diff --git a/testing/paris-traceroute/fix-idn.patch b/testing/paris-traceroute/fix-idn.patch
new file mode 100644
index 0000000000..3a6a650096
--- /dev/null
+++ b/testing/paris-traceroute/fix-idn.patch
@@ -0,0 +1,24 @@
+Only enable AI_IDN if it is actually defined.
+
+Upstream-status: Pending
+--- libparistraceroute-0.93.orig/libparistraceroute/address.c
++++ libparistraceroute-0.93/libparistraceroute/address.c
+@@ -37,8 +37,6 @@
+
+ #endif
+
+-#define AI_IDN 0x0040
+-
+ static void ip_dump(int family, const void * ip, char * buffer, size_t buffer_len) {
+ if (inet_ntop(family, ip, buffer, buffer_len)) {
+ printf("%s", buffer);
+@@ -58,7 +56,9 @@
+ // Initialize hints
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = family;
++#ifdef AI_IDN
+ hints.ai_flags = AI_IDN;
++#endif
+
+ // Convert string hostname / IP into a sequence of addrinfo instances
+ if ((ret = getaddrinfo(hostname, NULL, &hints, &res)) != 0) {
diff --git a/testing/paris-traceroute/in6-union.patch b/testing/paris-traceroute/in6-union.patch
new file mode 100644
index 0000000000..02eedc5037
--- /dev/null
+++ b/testing/paris-traceroute/in6-union.patch
@@ -0,0 +1,56 @@
+Fix various socket header usages on MUSL.
+
+Upstream-status: Cleanup needed
+--- libparistraceroute-0.93.orig/libparistraceroute/protocols/ipv6.c
++++ libparistraceroute-0.93/libparistraceroute/protocols/ipv6.c
+@@ -186,7 +186,7 @@
+ // If at least one byte of the src_ip is not null, we suppose
+ // that the src_ip has been set...
+ for (i = 0; i < 8 && !do_update_src_ip; i++) {
+- if (iph->ip6_src.__in6_u.__u6_addr16[i] != 0) {
++ if (iph->ip6_src.__in6_union.__s6_addr16[i] != 0) {
+ do_update_src_ip = false;
+ break;
+ }
+--- libparistraceroute-0.93.orig/libparistraceroute/protocols/tcp.c
++++ libparistraceroute-0.93/libparistraceroute/protocols/tcp.c
+@@ -77,6 +77,7 @@
+ #define TCP_FIELD_OPTIONS "options" // if data offset > 5, padded at the end with 0 if necessary
+
+ // BSD/Linux abstraction
++#define __FAVOR_BSD
+ #ifdef __FAVOR_BSD
+ # define SRC_PORT th_sport
+ # define DST_PORT th_dport
+@@ -308,10 +309,10 @@
+ memcpy(psh + size_ip, tcp_segment, size_tcp);
+
+ // Overrides the TCP checksum in psh with zeros
+- memset(psh + size_ip + offsetof(struct tcphdr, check), 0, sizeof(uint16_t));
++ memset(psh + size_ip + offsetof(struct tcphdr, CHECKSUM), 0, sizeof(uint16_t));
+
+ // Compute the checksum
+- tcp_header->check = csum((const uint16_t *) psh, size_psh);
++ tcp_header->CHECKSUM = csum((const uint16_t *) psh, size_psh);
+ free(psh);
+ return true;
+ }
+--- libparistraceroute-0.93.orig/libparistraceroute/protocols/udp.c
++++ libparistraceroute-0.93/libparistraceroute/protocols/udp.c
+@@ -32,6 +32,7 @@
+ // XXX UDP parsing missing
+
+ // BSD/Linux abstraction
++#define __FAVOR_BSD
+ #ifdef __FAVOR_BSD
+ # define SRC_PORT uh_sport
+ # define DST_PORT uh_dport
+@@ -147,7 +148,7 @@
+ memset(psh + size_ip + offsetof(struct udphdr, CHECKSUM), 0, sizeof(uint16_t));
+
+ // Compute the checksum
+- udp_header->check = csum((const uint16_t *) psh, size_psh);
++ udp_header->CHECKSUM = csum((const uint16_t *) psh, size_psh);
+ free(psh);
+ return true;
+ }