~alpine/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[alpine-devel] [PATCH] testing/mtr: new aport

John Keith Hohm <john@hohm.net>
Details
Message ID
<1310419297-15518-1-git-send-email-john@hohm.net>
Sender timestamp
1310419297
DKIM signature
missing
Download raw message
Patch: +422 -0
Full screen ncurses traceroute tool
http://www.bitwizard.nl/mtr/
---
 testing/mtr/APKBUILD              |   48 +++++
 testing/mtr/mtr-res_mkquery.patch |  374 +++++++++++++++++++++++++++++++++++++
 2 files changed, 422 insertions(+), 0 deletions(-)
 create mode 100644 testing/mtr/APKBUILD
 create mode 100644 testing/mtr/mtr-res_mkquery.patch

diff --git a/testing/mtr/APKBUILD b/testing/mtr/APKBUILD
new file mode 100644
index 0000000..d2c1559
--- /dev/null
+++ b/testing/mtr/APKBUILD
@@ -0,0 +1,48 @@
# Contributor: John Keith Hohm <john@hohm.net>
# Maintainer:
pkgname=mtr
pkgver=0.80
pkgrel=0
pkgdesc="Full screen ncurses traceroute tool"
url="http://www.bitwizard.nl/mtr/"
arch="all"
license="GPL"
depends="ncurses"
depends_dev="ncurses-dev"
makedepends="$depends_dev"
install=""
subpackages="$pkgname-doc"
source="ftp://ftp.bitwizard.nl/$pkgname/$pkgname-$pkgver.tar.gz
	mtr-res_mkquery.patch
	"

_builddir="src/$pkgname-$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"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--without-gtk \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="fa68528eaec1757f52bacf9fea8c68a9  mtr-0.80.tar.gz
f5982bdacddd8c1ea26d578b62bf810c  mtr-res_mkquery.patch"
diff --git a/testing/mtr/mtr-res_mkquery.patch b/testing/mtr/mtr-res_mkquery.patch
new file mode 100644
index 0000000..c761e97
--- /dev/null
+++ b/testing/mtr/mtr-res_mkquery.patch
@@ -0,0 +1,374 @@
--- a/mtr-0.80/configure
+++ b/mtr-0.80/configure
@@ -7165,317 +7165,6 @@
 
 #  AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
 
-{ echo "$as_me:$LINENO: checking for res_mkquery" >&5
-echo $ECHO_N "checking for res_mkquery... $ECHO_C" >&6; }
-if test "${ac_cv_func_res_mkquery+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define res_mkquery to an innocuous variant, in case <limits.h> declares res_mkquery.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define res_mkquery innocuous_res_mkquery
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char res_mkquery (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef res_mkquery
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_mkquery ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_res_mkquery || defined __stub___res_mkquery
-choke me
-#endif
-
-int
-main ()
-{
-return res_mkquery ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_func_res_mkquery=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_func_res_mkquery=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_res_mkquery" >&5
-echo "${ECHO_T}$ac_cv_func_res_mkquery" >&6; }
-if test $ac_cv_func_res_mkquery = yes; then
-  :
-else
-
-{ echo "$as_me:$LINENO: checking for res_mkquery in -lbind" >&5
-echo $ECHO_N "checking for res_mkquery in -lbind... $ECHO_C" >&6; }
-if test "${ac_cv_lib_bind_res_mkquery+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbind  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_mkquery ();
-int
-main ()
-{
-return res_mkquery ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_bind_res_mkquery=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_bind_res_mkquery=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_bind_res_mkquery" >&5
-echo "${ECHO_T}$ac_cv_lib_bind_res_mkquery" >&6; }
-if test $ac_cv_lib_bind_res_mkquery = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBBIND 1
-_ACEOF
-
-  LIBS="-lbind $LIBS"
-
-else
-
-{ echo "$as_me:$LINENO: checking for res_mkquery in -lresolv" >&5
-echo $ECHO_N "checking for res_mkquery in -lresolv... $ECHO_C" >&6; }
-if test "${ac_cv_lib_resolv_res_mkquery+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_mkquery ();
-int
-main ()
-{
-return res_mkquery ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_resolv_res_mkquery=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_resolv_res_mkquery=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_mkquery" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv_res_mkquery" >&6; }
-if test $ac_cv_lib_resolv_res_mkquery = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
-_ACEOF
-
-  LIBS="-lresolv $LIBS"
-
-else
-
-{ echo "$as_me:$LINENO: checking for __res_mkquery in -lresolv" >&5
-echo $ECHO_N "checking for __res_mkquery in -lresolv... $ECHO_C" >&6; }
-if test "${ac_cv_lib_resolv___res_mkquery+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char __res_mkquery ();
-int
-main ()
-{
-return __res_mkquery ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_resolv___res_mkquery=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_resolv___res_mkquery=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___res_mkquery" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv___res_mkquery" >&6; }
-if test $ac_cv_lib_resolv___res_mkquery = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
-_ACEOF
-
-  LIBS="-lresolv $LIBS"
-
-else
-  { { echo "$as_me:$LINENO: error: No resolver library found" >&5
-echo "$as_me: error: No resolver library found" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-fi
-
-fi
-
-fi
-
-# 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
-# removing it hurts your OS.... -- REW
-#LIBS="$LIBS -lresolv"
-
 { echo "$as_me:$LINENO: checking for herror" >&5
 echo $ECHO_N "checking for herror... $ECHO_C" >&6; }
 if test "${ac_cv_func_herror+set}" = set; then
--- a/mtr-0.80/dns.c
+++ b/mtr-0.80/dns.c
@@ -881,6 +881,51 @@
 }
 
 
+ /* res_mkquery from dietlibc libcruft http://www.fefe.de/dietlibc/ */
+
+static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000";
+
+static int res_mkquery(int op, const char *dname, int class, int type, char* data,
+		int datalen, const unsigned char* newrr, char* buf, int buflen) {
+  unsigned char packet[512];
+  unsigned long len;
+
+  memcpy(packet,dnspacket,12);
+  len=rand();
+  packet[0]=len;
+  packet[1]=len>>8;
+  len=0;
+  if ((_res.options&RES_RECURSE)==0) packet[2]=0;
+  {
+    unsigned char* x;
+    const char* y,* tmp;
+    x=packet+12; y=dname;
+    while (*y) {
+      while (*y=='.') ++y;
+      for (tmp=y; *tmp && *tmp!='.'; ++tmp) ;
+      if (tmp-y > 63) return -1;
+      *x=tmp-y;
+      if (!(tmp-y)) break;
+      if ((len+=*x+1) > 254) return -1;
+      ++x;
+      memmove(x,y,tmp-y);
+      x+=tmp-y;
+      if (!*tmp) {
+	*x=0;
+	break;
+      }
+      y=tmp;
+    }
+    *++x= 0; *++x= type;	/* A */
+    *++x= 0; *++x= class;	/* IN */
+    ++x;
+    if (x-packet>buflen) return -1;
+    memmove(buf,packet,x-packet);
+    return x-packet;
+  }
+}
+
+
 void dorequest(char *s,int type,word id)
 {
   packetheader *hp;
-- 
1.7.4.5



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Carlo Landmeter <clandmeter@gmail.com>
Details
Message ID
<CA+cSEmN0-FQRAG4J94MYy4-H4KJTZiGeJjONx=06tdY45cCUKw@mail.gmail.com>
In-Reply-To
<1310419297-15518-1-git-send-email-john@hohm.net> (view parent)
Sender timestamp
1310455171
DKIM signature
missing
Download raw message
On Mon, Jul 11, 2011 at 11:21 PM, John Keith Hohm <john@hohm.net> wrote:
> Full screen ncurses traceroute tool
> http://www.bitwizard.nl/mtr/
> ---
>  testing/mtr/APKBUILD              |   48 +++++
>  testing/mtr/mtr-res_mkquery.patch |  374 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 422 insertions(+), 0 deletions(-)
>  create mode 100644 testing/mtr/APKBUILD
>  create mode 100644 testing/mtr/mtr-res_mkquery.patch
>
> diff --git a/testing/mtr/APKBUILD b/testing/mtr/APKBUILD
> new file mode 100644
> index 0000000..d2c1559
> --- /dev/null
> +++ b/testing/mtr/APKBUILD
> @@ -0,0 +1,48 @@
> +# Contributor: John Keith Hohm <john@hohm.net>
> +# Maintainer:
> +pkgname=mtr
> +pkgver=0.80
> +pkgrel=0
> +pkgdesc="Full screen ncurses traceroute tool"
> +url="http://www.bitwizard.nl/mtr/"
> +arch="all"
> +license="GPL"
> +depends="ncurses"
> +depends_dev="ncurses-dev"
> +makedepends="$depends_dev"
> +install=""
> +subpackages="$pkgname-doc"
> +source="ftp://ftp.bitwizard.nl/$pkgname/$pkgname-$pkgver.tar.gz
> +       mtr-res_mkquery.patch
> +       "
> +
> +_builddir="src/$pkgname-$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"
> +       ./configure --prefix=/usr \
> +               --sysconfdir=/etc \
> +               --mandir=/usr/share/man \
> +               --infodir=/usr/share/info \
> +               --localstatedir=/var \
> +               --without-gtk \
> +               || return 1
> +       make || return 1
> +}
> +
> +package() {
> +       cd "$_builddir"
> +       make DESTDIR="$pkgdir" install || return 1
> +}
> +
> +md5sums="fa68528eaec1757f52bacf9fea8c68a9  mtr-0.80.tar.gz
> +f5982bdacddd8c1ea26d578b62bf810c  mtr-res_mkquery.patch"
> diff --git a/testing/mtr/mtr-res_mkquery.patch b/testing/mtr/mtr-res_mkquery.patch
> new file mode 100644
> index 0000000..c761e97
> --- /dev/null
> +++ b/testing/mtr/mtr-res_mkquery.patch
> @@ -0,0 +1,374 @@
> +--- a/mtr-0.80/configure
> ++++ b/mtr-0.80/configure
> +@@ -7165,317 +7165,6 @@
> +
> + #  AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
> +
> +-{ echo "$as_me:$LINENO: checking for res_mkquery" >&5
> +-echo $ECHO_N "checking for res_mkquery... $ECHO_C" >&6; }
> +-if test "${ac_cv_func_res_mkquery+set}" = set; then
> +-  echo $ECHO_N "(cached) $ECHO_C" >&6
> +-else
> +-  cat >conftest.$ac_ext <<_ACEOF
> +-/* confdefs.h.  */
> +-_ACEOF
> +-cat confdefs.h >>conftest.$ac_ext
> +-cat >>conftest.$ac_ext <<_ACEOF
> +-/* end confdefs.h.  */
> +-/* Define res_mkquery to an innocuous variant, in case <limits.h> declares res_mkquery.
> +-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
> +-#define res_mkquery innocuous_res_mkquery
> +-
> +-/* System header to define __stub macros and hopefully few prototypes,
> +-    which can conflict with char res_mkquery (); below.
> +-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
> +-    <limits.h> exists even on freestanding compilers.  */
> +-
> +-#ifdef __STDC__
> +-# include <limits.h>
> +-#else
> +-# include <assert.h>
> +-#endif
> +-
> +-#undef res_mkquery
> +-
> +-/* Override any GCC internal prototype to avoid an error.
> +-   Use char because int might match the return type of a GCC
> +-   builtin and then its argument prototype would still apply.  */
> +-#ifdef __cplusplus
> +-extern "C"
> +-#endif
> +-char res_mkquery ();
> +-/* The GNU C library defines this for functions which it implements
> +-    to always fail with ENOSYS.  Some functions are actually named
> +-    something starting with __ and the normal name is an alias.  */
> +-#if defined __stub_res_mkquery || defined __stub___res_mkquery
> +-choke me
> +-#endif
> +-
> +-int
> +-main ()
> +-{
> +-return res_mkquery ();
> +-  ;
> +-  return 0;
> +-}
> +-_ACEOF
> +-rm -f conftest.$ac_objext conftest$ac_exeext
> +-if { (ac_try="$ac_link"
> +-case "(($ac_try" in
> +-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> +-  *) ac_try_echo=$ac_try;;
> +-esac
> +-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> +-  (eval "$ac_link") 2>conftest.er1
> +-  ac_status=$?
> +-  grep -v '^ *+' conftest.er1 >conftest.err
> +-  rm -f conftest.er1
> +-  cat conftest.err >&5
> +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> +-  (exit $ac_status); } && {
> +-       test -z "$ac_c_werror_flag" ||
> +-       test ! -s conftest.err
> +-       } && test -s conftest$ac_exeext &&
> +-       $as_test_x conftest$ac_exeext; then
> +-  ac_cv_func_res_mkquery=yes
> +-else
> +-  echo "$as_me: failed program was:" >&5
> +-sed 's/^/| /' conftest.$ac_ext >&5
> +-
> +-      ac_cv_func_res_mkquery=no
> +-fi
> +-
> +-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
> +-      conftest$ac_exeext conftest.$ac_ext
> +-fi
> +-{ echo "$as_me:$LINENO: result: $ac_cv_func_res_mkquery" >&5
> +-echo "${ECHO_T}$ac_cv_func_res_mkquery" >&6; }
> +-if test $ac_cv_func_res_mkquery = yes; then
> +-  :
> +-else
> +-
> +-{ echo "$as_me:$LINENO: checking for res_mkquery in -lbind" >&5
> +-echo $ECHO_N "checking for res_mkquery in -lbind... $ECHO_C" >&6; }
> +-if test "${ac_cv_lib_bind_res_mkquery+set}" = set; then
> +-  echo $ECHO_N "(cached) $ECHO_C" >&6
> +-else
> +-  ac_check_lib_save_LIBS=$LIBS
> +-LIBS="-lbind  $LIBS"
> +-cat >conftest.$ac_ext <<_ACEOF
> +-/* confdefs.h.  */
> +-_ACEOF
> +-cat confdefs.h >>conftest.$ac_ext
> +-cat >>conftest.$ac_ext <<_ACEOF
> +-/* end confdefs.h.  */
> +-
> +-/* Override any GCC internal prototype to avoid an error.
> +-   Use char because int might match the return type of a GCC
> +-   builtin and then its argument prototype would still apply.  */
> +-#ifdef __cplusplus
> +-extern "C"
> +-#endif
> +-char res_mkquery ();
> +-int
> +-main ()
> +-{
> +-return res_mkquery ();
> +-  ;
> +-  return 0;
> +-}
> +-_ACEOF
> +-rm -f conftest.$ac_objext conftest$ac_exeext
> +-if { (ac_try="$ac_link"
> +-case "(($ac_try" in
> +-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> +-  *) ac_try_echo=$ac_try;;
> +-esac
> +-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> +-  (eval "$ac_link") 2>conftest.er1
> +-  ac_status=$?
> +-  grep -v '^ *+' conftest.er1 >conftest.err
> +-  rm -f conftest.er1
> +-  cat conftest.err >&5
> +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> +-  (exit $ac_status); } && {
> +-       test -z "$ac_c_werror_flag" ||
> +-       test ! -s conftest.err
> +-       } && test -s conftest$ac_exeext &&
> +-       $as_test_x conftest$ac_exeext; then
> +-  ac_cv_lib_bind_res_mkquery=yes
> +-else
> +-  echo "$as_me: failed program was:" >&5
> +-sed 's/^/| /' conftest.$ac_ext >&5
> +-
> +-      ac_cv_lib_bind_res_mkquery=no
> +-fi
> +-
> +-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
> +-      conftest$ac_exeext conftest.$ac_ext
> +-LIBS=$ac_check_lib_save_LIBS
> +-fi
> +-{ echo "$as_me:$LINENO: result: $ac_cv_lib_bind_res_mkquery" >&5
> +-echo "${ECHO_T}$ac_cv_lib_bind_res_mkquery" >&6; }
> +-if test $ac_cv_lib_bind_res_mkquery = yes; then
> +-  cat >>confdefs.h <<_ACEOF
> +-#define HAVE_LIBBIND 1
> +-_ACEOF
> +-
> +-  LIBS="-lbind $LIBS"
> +-
> +-else
> +-
> +-{ echo "$as_me:$LINENO: checking for res_mkquery in -lresolv" >&5
> +-echo $ECHO_N "checking for res_mkquery in -lresolv... $ECHO_C" >&6; }
> +-if test "${ac_cv_lib_resolv_res_mkquery+set}" = set; then
> +-  echo $ECHO_N "(cached) $ECHO_C" >&6
> +-else
> +-  ac_check_lib_save_LIBS=$LIBS
> +-LIBS="-lresolv  $LIBS"
> +-cat >conftest.$ac_ext <<_ACEOF
> +-/* confdefs.h.  */
> +-_ACEOF
> +-cat confdefs.h >>conftest.$ac_ext
> +-cat >>conftest.$ac_ext <<_ACEOF
> +-/* end confdefs.h.  */
> +-
> +-/* Override any GCC internal prototype to avoid an error.
> +-   Use char because int might match the return type of a GCC
> +-   builtin and then its argument prototype would still apply.  */
> +-#ifdef __cplusplus
> +-extern "C"
> +-#endif
> +-char res_mkquery ();
> +-int
> +-main ()
> +-{
> +-return res_mkquery ();
> +-  ;
> +-  return 0;
> +-}
> +-_ACEOF
> +-rm -f conftest.$ac_objext conftest$ac_exeext
> +-if { (ac_try="$ac_link"
> +-case "(($ac_try" in
> +-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> +-  *) ac_try_echo=$ac_try;;
> +-esac
> +-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> +-  (eval "$ac_link") 2>conftest.er1
> +-  ac_status=$?
> +-  grep -v '^ *+' conftest.er1 >conftest.err
> +-  rm -f conftest.er1
> +-  cat conftest.err >&5
> +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> +-  (exit $ac_status); } && {
> +-       test -z "$ac_c_werror_flag" ||
> +-       test ! -s conftest.err
> +-       } && test -s conftest$ac_exeext &&
> +-       $as_test_x conftest$ac_exeext; then
> +-  ac_cv_lib_resolv_res_mkquery=yes
> +-else
> +-  echo "$as_me: failed program was:" >&5
> +-sed 's/^/| /' conftest.$ac_ext >&5
> +-
> +-      ac_cv_lib_resolv_res_mkquery=no
> +-fi
> +-
> +-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
> +-      conftest$ac_exeext conftest.$ac_ext
> +-LIBS=$ac_check_lib_save_LIBS
> +-fi
> +-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_mkquery" >&5
> +-echo "${ECHO_T}$ac_cv_lib_resolv_res_mkquery" >&6; }
> +-if test $ac_cv_lib_resolv_res_mkquery = yes; then
> +-  cat >>confdefs.h <<_ACEOF
> +-#define HAVE_LIBRESOLV 1
> +-_ACEOF
> +-
> +-  LIBS="-lresolv $LIBS"
> +-
> +-else
> +-
> +-{ echo "$as_me:$LINENO: checking for __res_mkquery in -lresolv" >&5
> +-echo $ECHO_N "checking for __res_mkquery in -lresolv... $ECHO_C" >&6; }
> +-if test "${ac_cv_lib_resolv___res_mkquery+set}" = set; then
> +-  echo $ECHO_N "(cached) $ECHO_C" >&6
> +-else
> +-  ac_check_lib_save_LIBS=$LIBS
> +-LIBS="-lresolv  $LIBS"
> +-cat >conftest.$ac_ext <<_ACEOF
> +-/* confdefs.h.  */
> +-_ACEOF
> +-cat confdefs.h >>conftest.$ac_ext
> +-cat >>conftest.$ac_ext <<_ACEOF
> +-/* end confdefs.h.  */
> +-
> +-/* Override any GCC internal prototype to avoid an error.
> +-   Use char because int might match the return type of a GCC
> +-   builtin and then its argument prototype would still apply.  */
> +-#ifdef __cplusplus
> +-extern "C"
> +-#endif
> +-char __res_mkquery ();
> +-int
> +-main ()
> +-{
> +-return __res_mkquery ();
> +-  ;
> +-  return 0;
> +-}
> +-_ACEOF
> +-rm -f conftest.$ac_objext conftest$ac_exeext
> +-if { (ac_try="$ac_link"
> +-case "(($ac_try" in
> +-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> +-  *) ac_try_echo=$ac_try;;
> +-esac
> +-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> +-  (eval "$ac_link") 2>conftest.er1
> +-  ac_status=$?
> +-  grep -v '^ *+' conftest.er1 >conftest.err
> +-  rm -f conftest.er1
> +-  cat conftest.err >&5
> +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> +-  (exit $ac_status); } && {
> +-       test -z "$ac_c_werror_flag" ||
> +-       test ! -s conftest.err
> +-       } && test -s conftest$ac_exeext &&
> +-       $as_test_x conftest$ac_exeext; then
> +-  ac_cv_lib_resolv___res_mkquery=yes
> +-else
> +-  echo "$as_me: failed program was:" >&5
> +-sed 's/^/| /' conftest.$ac_ext >&5
> +-
> +-      ac_cv_lib_resolv___res_mkquery=no
> +-fi
> +-
> +-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
> +-      conftest$ac_exeext conftest.$ac_ext
> +-LIBS=$ac_check_lib_save_LIBS
> +-fi
> +-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___res_mkquery" >&5
> +-echo "${ECHO_T}$ac_cv_lib_resolv___res_mkquery" >&6; }
> +-if test $ac_cv_lib_resolv___res_mkquery = yes; then
> +-  cat >>confdefs.h <<_ACEOF
> +-#define HAVE_LIBRESOLV 1
> +-_ACEOF
> +-
> +-  LIBS="-lresolv $LIBS"
> +-
> +-else
> +-  { { echo "$as_me:$LINENO: error: No resolver library found" >&5
> +-echo "$as_me: error: No resolver library found" >&2;}
> +-   { (exit 1); exit 1; }; }
> +-fi
> +-
> +-fi
> +-
> +-fi
> +-
> +-fi
> +-
> +-# 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
> +-# removing it hurts your OS.... -- REW
> +-#LIBS="$LIBS -lresolv"
> +-
> + { echo "$as_me:$LINENO: checking for herror" >&5
> + echo $ECHO_N "checking for herror... $ECHO_C" >&6; }
> + if test "${ac_cv_func_herror+set}" = set; then
> +--- a/mtr-0.80/dns.c
> ++++ b/mtr-0.80/dns.c
> +@@ -881,6 +881,51 @@
> + }
> +
> +
> ++ /* res_mkquery from dietlibc libcruft http://www.fefe.de/dietlibc/ */
> ++
> ++static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000";
> ++
> ++static int res_mkquery(int op, const char *dname, int class, int type, char* data,
> ++              int datalen, const unsigned char* newrr, char* buf, int buflen) {
> ++  unsigned char packet[512];
> ++  unsigned long len;
> ++
> ++  memcpy(packet,dnspacket,12);
> ++  len=rand();
> ++  packet[0]=len;
> ++  packet[1]=len>>8;
> ++  len=0;
> ++  if ((_res.options&RES_RECURSE)==0) packet[2]=0;
> ++  {
> ++    unsigned char* x;
> ++    const char* y,* tmp;
> ++    x=packet+12; y=dname;
> ++    while (*y) {
> ++      while (*y=='.') ++y;
> ++      for (tmp=y; *tmp && *tmp!='.'; ++tmp) ;
> ++      if (tmp-y > 63) return -1;
> ++      *x=tmp-y;
> ++      if (!(tmp-y)) break;
> ++      if ((len+=*x+1) > 254) return -1;
> ++      ++x;
> ++      memmove(x,y,tmp-y);
> ++      x+=tmp-y;
> ++      if (!*tmp) {
> ++      *x=0;
> ++      break;
> ++      }
> ++      y=tmp;
> ++    }
> ++    *++x= 0; *++x= type;      /* A */
> ++    *++x= 0; *++x= class;     /* IN */
> ++    ++x;
> ++    if (x-packet>buflen) return -1;
> ++    memmove(buf,packet,x-packet);
> ++    return x-packet;
> ++  }
> ++}
> ++
> ++
> + void dorequest(char *s,int type,word id)
> + {
> +   packetheader *hp;
> --
> 1.7.4.5
>
>
>
> ---
> Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
> Help:         alpine-devel+help@lists.alpinelinux.org
> ---
>
>

Looks good. Applied.

Thanks!

-carlo


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20110712102023.10ce93fe@ncopa-desktop.nor.wtbts.net>
In-Reply-To
<1310419297-15518-1-git-send-email-john@hohm.net> (view parent)
Sender timestamp
1310458823
DKIM signature
missing
Download raw message
On Mon, 11 Jul 2011 16:21:37 -0500
John Keith Hohm <john@hohm.net> wrote:

> Full screen ncurses traceroute tool
> http://www.bitwizard.nl/mtr/
> ---
>  testing/mtr/APKBUILD              |   48 +++++
>  testing/mtr/mtr-res_mkquery.patch |  374
> +++++++++++++++++++++++++++++++++++++ 2 files changed, 422
> insertions(+), 0 deletions(-) create mode 100644 testing/mtr/APKBUILD
>  create mode 100644 testing/mtr/mtr-res_mkquery.patch


Thanks!
Looks generally good. Some minor notes below.

...

> +depends_dev="ncurses-dev"
> +makedepends="$depends_dev"
> +install=""
> +subpackages="$pkgname-doc"

Since there are no mtr-dev subpackage you could have just deleted
depends_dev.

...
> +++ b/testing/mtr/mtr-res_mkquery.patch
> @@ -0,0 +1,374 @@
> +--- a/mtr-0.80/configure
> ++++ b/mtr-0.80/configure


I had a look at this patch and, sure it works. It would have been
preferable that it could have changed the configure.in file and then
run aclocal && autoreconf or similar. Instead of error out on missing
res_mkquery it could have set a config.h variable and then do
something like:

#ifndef HAVE_MK_QUERY
/* res_mkquery from dietlibc libcruft http://www.fefe.de/dietlibc/ */ 
...
#endif

and send that patch upstream.

(even better would probably to remove the entire dns.c and use c-ares
library)


That said, I think its good enough for Alpine anyways.
Thanks!

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
John Keith Hohm <john@hohm.net>
Details
Message ID
<4E1C7C58.6040405@hohm.net>
In-Reply-To
<20110712102023.10ce93fe@ncopa-desktop.nor.wtbts.net> (view parent)
Sender timestamp
1310489688
DKIM signature
missing
Download raw message
On 07/12/2011 03:20 AM, Natanael Copa wrote:
> I had a look at this patch and, sure it works. It would have been
> preferable that it could have changed the configure.in file and then
> run aclocal&&  autoreconf or similar. Instead of error out on missing
> res_mkquery it could have set a config.h variable and then do
> something like:
>
> #ifndef HAVE_MK_QUERY
> /* res_mkquery from dietlibc libcruft http://www.fefe.de/dietlibc/ */
> ...
> #endif

Yes, I actually did something like that first locally but the patch from 
re-running those tools was ridiculously big, since I did not use the 
exact same automake and autoconf versions as upstream.

> and send that patch upstream.
>
> (even better would probably to remove the entire dns.c and use c-ares
> library)

Hey, thanks for the pointer to c-ares.  Maybe I should check with 
upstream whether they are likely to accept such a patch.  I had first 
considered replacing dns.c with the public domain djbdns client library 
files but thought they might not be keen on losing IPv6 support.

> That said, I think its good enough for Alpine anyways.
> Thanks!

Thanks guys for the inclusion, and for working on Alpine. I am quite 
pleased to be able to stay with Alpine for an upgrade to a new x86_64 
incarnation of an important firewall.

-- 
John Keith Hohm
<john@hohm.net>


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)