aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/mtr/0001-dns-allow-disable-dns-during-compile-time.patch196
-rw-r--r--testing/mtr/APKBUILD14
2 files changed, 204 insertions, 6 deletions
diff --git a/testing/mtr/0001-dns-allow-disable-dns-during-compile-time.patch b/testing/mtr/0001-dns-allow-disable-dns-during-compile-time.patch
new file mode 100644
index 0000000000..46598c4976
--- /dev/null
+++ b/testing/mtr/0001-dns-allow-disable-dns-during-compile-time.patch
@@ -0,0 +1,196 @@
+From 32863554ab50dfee32a25e641399c31b7fe7357d Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Fri, 6 Jul 2012 13:33:54 +0000
+Subject: [PATCH] dns: allow disable dns during compile time
+
+---
+ configure.in | 14 +++++++++----
+ dns.c | 65 ++++++++++++++++++++++++++++++++++++------------------------
+ mtr.c | 10 +++++++++-
+ 3 files changed, 58 insertions(+), 31 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 8474543..1f53f74 100644
+--- a/configure.in
++++ b/configure.in
+@@ -72,10 +72,16 @@ AC_CHECK_FUNC(gethostbyname, ,
+ AC_CHECK_FUNCS(seteuid)
+ # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
+
+-AC_CHECK_FUNC(res_mkquery, ,
+- AC_CHECK_LIB(bind, res_mkquery, ,
+- AC_CHECK_LIB(resolv, res_mkquery, ,
+- AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
++AC_ARG_ENABLE([dns], AS_HELP_STRING([--disable-dns],[Disable use of DNS]))
++
++AS_IF([test "x$enable_dns" != "xno"],
++ AC_CHECK_FUNC(res_mkquery, ,
++ AC_CHECK_LIB(bind, res_mkquery, ,
++ AC_CHECK_LIB(resolv, res_mkquery, ,
++ AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found))))),
++ [AC_DEFINE([NO_DNS], [1], [Disable use of DNS])]
++)
++
+ # This next line would override the just detected-or-not -lresolv.
+ # This apparently hurts BSD. And it's bad practise. So it should go.
+ # However, it probably didn't get added for nothing..... Holler if
+diff --git a/dns.c b/dns.c
+index 512da97..e85fcb3 100644
+--- a/dns.c
++++ b/dns.c
+@@ -48,6 +48,7 @@
+ #include "mtr.h"
+ #include "dns.h"
+ #include "net.h"
++#include "config.h"
+
+ /* OSX Needs this. I don't know how to enable this for them automatically.
+ * Should be easy with autoconf. Please submit a patch if you know
+@@ -58,6 +59,11 @@
+ #endif
+
+
++extern int af;
++int use_dns = 1;
++
++#ifndef NO_DNS
++
+ #ifdef NO_STRERROR
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+@@ -69,7 +75,6 @@ extern char *sys_errlist[];
+ extern int errno;
+ #endif
+
+-extern int af;
+
+ /* Defines */
+
+@@ -307,8 +312,6 @@ char stackstring[1024+1];
+
+ char nullstring[] = "";
+
+-int use_dns = 1;
+-
+ #ifdef res_ninit
+ #define MY_RES_INIT() res_ninit(&myres);
+ #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
+@@ -451,18 +454,6 @@ void clearset(fd_set *set)
+ }
+
+
+-char *strlongip(ip_t * ip)
+-{
+-#ifdef ENABLE_IPV6
+- static char buf[INET6_ADDRSTRLEN];
+-
+- return (char *) inet_ntop( af, ip, buf, sizeof buf );
+-#else
+- return inet_ntoa( *ip );
+-#endif
+-}
+-
+-
+ int longipstr( char *s, ip_t *dst, int af )
+ {
+ #ifdef ENABLE_IPV6
+@@ -473,17 +464,6 @@ int longipstr( char *s, ip_t *dst, int af )
+ }
+
+
+-struct hostent * dns_forward(const char *name)
+-{
+- struct hostent *host;
+-
+- if ((host = gethostbyname(name)))
+- return host;
+- else
+- return NULL;
+-}
+-
+-
+ int dns_waitfd(void)
+ {
+ return resfd;
+@@ -1397,6 +1377,39 @@ void addr2ip6arpa( ip_t * ip, char * buf ) {
+ }
+ #endif
+
++#else /* NO_DNS */
++void dns_ack(void) {}
++void dns_events(double *sinterval) {}
++int dns_waitfd(void) { return 0; }
++void dns_open(void) { use_dns = dns = 0; }
++char *dns_lookup2(ip_t * ip) { return NULL; }
++char *dns_lookup(ip_t * ip) { return strlongip (ip); }
++
++#endif /* NO_DNS */
++
++struct hostent * dns_forward(const char *name)
++{
++ struct hostent *host;
++
++ if ((host = gethostbyname(name)))
++ return host;
++ else
++ return NULL;
++}
++
++
++char *strlongip(ip_t * ip)
++{
++#ifdef ENABLE_IPV6
++ static char buf[INET6_ADDRSTRLEN];
++
++ return (char *) inet_ntop( af, ip, buf, sizeof buf );
++#else
++ return inet_ntoa( *ip );
++#endif
++}
++
++
+ /* Resolve an IP address to a hostname. */
+ struct hostent *addr2host( const char *addr, int af ) {
+ int len = 0;
+diff --git a/mtr.c b/mtr.c
+index 5f1b651..1fc3873 100644
+--- a/mtr.c
++++ b/mtr.c
+@@ -143,7 +143,9 @@ void parse_arg (int argc, char **argv)
+ { "bitpattern", 1, 0, 'b' },/* overload b>255, ->rand(0,255) */
+ { "tos", 1, 0, 'Q' }, /* typeof service (0,255) */
+ { "mpls", 0, 0, 'e' },
++#ifndef NO_DNS
+ { "no-dns", 0, 0, 'n' },
++#endif
+ { "address", 1, 0, 'a' },
+ { "first-ttl", 1, 0, 'f' }, /* -f & -m are borrowed from traceroute */
+ { "max-ttl", 1, 0, 'm' },
+@@ -204,9 +206,11 @@ void parse_arg (int argc, char **argv)
+ case 'e':
+ enablempls = 1;
+ break;
++#ifndef NO_DNS
+ case 'n':
+ dns = 0;
+ break;
++#endif
+ case 'i':
+ WaitTime = atof (optarg);
+ if (WaitTime <= 0.0) {
+@@ -382,7 +386,11 @@ int main(int argc, char **argv)
+ if (PrintHelp) {
+ printf("usage: %s [-hvrwctglspniu46] [--help] [--version] [--report]\n"
+ "\t\t[--report-wide] [--report-cycles=COUNT] [--curses] [--gtk]\n"
+- "\t\t[--raw] [--split] [--mpls] [--no-dns] [--address interface]\n" /* BL */
++ "\t\t[--raw] [--split] [--mpls] "
++#ifndef NO_DNS
++ "[--no-dns] "
++#endif
++ "[--address interface]\n" /* BL */
+ "\t\t[--psize=bytes/-s bytes]\n" /* ok */
+ "\t\t[--report-wide|-w] [-u]\n" /* rew */
+ "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]);
+--
+1.7.11.1
+
diff --git a/testing/mtr/APKBUILD b/testing/mtr/APKBUILD
index d2c155906e..4e5a094273 100644
--- a/testing/mtr/APKBUILD
+++ b/testing/mtr/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: John Keith Hohm <john@hohm.net>
# Maintainer:
pkgname=mtr
-pkgver=0.80
+pkgver=0.82
pkgrel=0
pkgdesc="Full screen ncurses traceroute tool"
url="http://www.bitwizard.nl/mtr/"
@@ -9,14 +9,14 @@ arch="all"
license="GPL"
depends="ncurses"
depends_dev="ncurses-dev"
-makedepends="$depends_dev"
+makedepends="$depends_dev autoconf automake"
install=""
subpackages="$pkgname-doc"
source="ftp://ftp.bitwizard.nl/$pkgname/$pkgname-$pkgver.tar.gz
- mtr-res_mkquery.patch
+ 0001-dns-allow-disable-dns-during-compile-time.patch
"
-_builddir="src/$pkgname-$pkgver"
+_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
local i
cd "$_builddir"
@@ -25,6 +25,7 @@ prepare() {
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
+ aclocal && touch ChangeLog && autoreconf
}
build() {
@@ -35,6 +36,7 @@ build() {
--infodir=/usr/share/info \
--localstatedir=/var \
--without-gtk \
+ --disable-dns \
|| return 1
make || return 1
}
@@ -44,5 +46,5 @@ package() {
make DESTDIR="$pkgdir" install || return 1
}
-md5sums="fa68528eaec1757f52bacf9fea8c68a9 mtr-0.80.tar.gz
-f5982bdacddd8c1ea26d578b62bf810c mtr-res_mkquery.patch"
+md5sums="10601ea543fda3e51545c4bce195b64c mtr-0.82.tar.gz
+ed4af88ccd422ba41f0c17268878cf4f 0001-dns-allow-disable-dns-during-compile-time.patch"