Bug#601030: 6tunnel: Can't resolve IPv4 target host

2011-01-15 Thread Jari Aalto

Hi Roland,

Adam reported in message:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=601030#57

That there seesm to be a problem with ipv4 support. The version in Lenny
 (lenny/6tunnel-0.11rc2-2) seems to work ok.

The only difference that I can see is the inclusion of your ipv6 patch in
recent release. Could you take a look at it and see if there is anything
that got mixed up with the ipv4.

Adam,

Could you confirm that the patch is indeed the problem:

dget -x 
http://ftp.de.debian.org/debian/pool/main/6/6tunnel/6tunnel_0.11rc2-5.dsc
cd 6tunnel-0.11rc2
sed --in-place '3d' debian/patches/series

apt-get -t unstable build-dep 6tunnel
debuild -uc -uc
dpkg -i ../6tunnel_0.11rc2-5*.deb

...and test as you did

Thanks,
Jari



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Can't resolve IPv4 target host

2011-01-15 Thread Adam Borowski
On Sat, Jan 15, 2011 at 12:22:51PM +0200, Jari Aalto wrote:
 Could you confirm that the patch is indeed the problem:
 
 dget -x 
 http://ftp.de.debian.org/debian/pool/main/6/6tunnel/6tunnel_0.11rc2-5.dsc
 cd 6tunnel-0.11rc2
 sed --in-place '3d' debian/patches/series
 
 apt-get -t unstable build-dep 6tunnel
 debuild -uc -uc
 dpkg -i ../6tunnel_0.11rc2-5*.deb
 
 ...and test as you did

Doesn't help when done exactly as you say, but git bisect points at
commit c3decac6 which seems to enable that patch.

-- 
1KB // Microsoft corollary to Hanlon's razor:
//  Never attribute to stupidity what can be
//  adequately explained by malice.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Can't resolve IPv4 target host

2011-01-15 Thread Roland Stigge
Hi,

On 15/01/11 11:22, Jari Aalto wrote:
 That there seesm to be a problem with ipv4 support. The version in Lenny
  (lenny/6tunnel-0.11rc2-2) seems to work ok.

 [~]$ 6tunnel -4 -l 192.168.0.100 5432 10.2.10.2 5432
 6tunnel: unable to resolve host 10.2.10.2

Looks like getaddrinfo() only works when we specify a host name for the
remote host (then it works for me). I can reproduce the problem when I
use an IPv4 address for the remote host.

bye,
  Roland



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Can't resolve IPv4 target host

2011-01-15 Thread Roland Stigge
On 15/01/11 15:01, Roland Stigge wrote:
 On 15/01/11 11:22, Jari Aalto wrote:
 That there seesm to be a problem with ipv4 support. The version in Lenny
  (lenny/6tunnel-0.11rc2-2) seems to work ok.
 
 [~]$ 6tunnel -4 -l 192.168.0.100 5432 10.2.10.2 5432
 6tunnel: unable to resolve host 10.2.10.2

Look at the hints: 6tunnel is supposed to create tunnels IPv6-IPv4 or
IPv4-IPv6. Not IPv4-IPv4. (Which would be nice, though, but not the
original intention.)

bye,
  Roland



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Can't resolve IPv4 target host

2011-01-15 Thread Adam Borowski
On Sat, Jan 15, 2011 at 03:10:44PM +0100, Roland Stigge wrote:
 On 15/01/11 15:01, Roland Stigge wrote:
  On 15/01/11 11:22, Jari Aalto wrote:
  That there seesm to be a problem with ipv4 support. The version in 
  Lenny
   (lenny/6tunnel-0.11rc2-2) seems to work ok.
  
  [~]$ 6tunnel -4 -l 192.168.0.100 5432 10.2.10.2 5432
  6tunnel: unable to resolve host 10.2.10.2
 
 Look at the hints: 6tunnel is supposed to create tunnels IPv6-IPv4 or
 IPv4-IPv6. Not IPv4-IPv4. (Which would be nice, though, but not the
 original intention.)

In this example I used IPv4-IPv4 since it's more likely to be installed on
armel[1] boxes, but the bug happens if the listen address is IPv6 as well:

[~]$ 6tunnel -4 -l ::1 5432 10.2.10.2 5432
6tunnel: unable to resolve host 10.2.10.2


[1]. The breakage was initially caused by a problem on armel.  A good deal
of such machines in the wild have kernels without IPv6, including n900.  I
do happen to use an IPv6-enabled kernel on my phone, but I guess most people
don't.

-- 
1KB // Microsoft corollary to Hanlon's razor:
//  Never attribute to stupidity what can be
//  adequately explained by malice.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Can't resolve IPv4 target host

2010-10-22 Thread Roland Stigge
Package: 6tunnel
Version: 0.11rc2-3
Severity: normal

Hi,

I'm trying to make 6tunnel listen on an IPv6 address and forward the connection
to an IPv4 (only) host, but 6tunnel tells me it can't resolve the target host:

# 6tunnel -6 -v 84 ftp.de.debian.org 80
resolving ftp.de.debian.org
6tunnel: unable to resolve host ftp.de.debian.org
#

The target host is resolvable, I tried with both IPv4 and IPv6 DNS servers,
e.g.:

# host ftp.de.debian.org
ftp.de.debian.org has address 141.76.2.4
#

The examples in the man page do it the other way around: Listening on an IPv4
address and forwarding to an IPv6 address. But it also says that if -6 is
given, the other direction is also valid. So the above should
work, IMHO.

Thanks for considering.

bye,
  Roland

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages 6tunnel depends on:
ii  libc6 2.11.2-6   Embedded GNU C Library: Shared lib

6tunnel recommends no packages.

6tunnel suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Debian Bug#601030: 6tunnel: Can't resolve IPv4 target host

2010-10-22 Thread Jari Aalto
forwarded 601030 Wojtek Kaniewski wojte...@irc.pl
thanks

Wojtek, [Keep CC]

Could you take a look at a Debian bug reported to your package:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=601030

Thanks,
Jari



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#601030: 6tunnel: Can't resolve IPv4 target host

2010-10-22 Thread Roland Stigge
Hi,

I'm attaching a patch that fixes it for me. (See comments in the DEP-3
patch.)

bye,
  Roland
Description: Fix IPv6-bind IPv4-remote
 This patch fixes an error in the hints handling of the host resolver which
 confused local/source and remote hint (AF_INET/AF_INET6).
Author: Roland Stigge sti...@antcom.de
Bug-Debian: http://bugs.debian.org/601030

--- 6tunnel-0.11rc2.orig/6tunnel.c
+++ 6tunnel-0.11rc2/6tunnel.c
@@ -43,7 +43,9 @@
 } while(0)
 
 int verbose = 0, conn_count = 0;
-int remote_port, verbose, hint = AF_INET6, hexdump = 0;
+int remote_port, verbose, hexdump = 0;
+int remote_hint = AF_INET6;
+int local_hint = AF_INET;
 char *remote_host, *ircpass = NULL;
 char *ircsendpass = NULL, remote[128];
 char *pid_file = NULL;
@@ -218,7 +220,7 @@ void make_tunnel(int rsock, const char *
 		debug(%d irc proxy auth succeded\n, rsock);
 	}
   
-	if (!(sa = resolve_host(remote_host, hint))) {
+	if (!(sa = resolve_host(remote_host, remote_hint))) {
 		debug(%d unable to resolve %s\n, rsock, remote_host);
 		goto cleanup;
 	}
@@ -232,12 +234,12 @@ void make_tunnel(int rsock, const char *
 	sa = NULL;
 
 	if (source) {
-		if (!(sa = resolve_host(source, hint))) {
+		if (!(sa = resolve_host(source, local_hint))) {
 			debug(%d unable to resolve source host (%s)\n, rsock, source);
 			goto cleanup;
 		}
 
-		if (bind(sock, sa, (hint == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))) {
+		if (bind(sock, sa, (local_hint == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))) {
 			debug(%d unable to bind to source host (%s)\n, rsock, source);
 			goto cleanup;
 		}
@@ -246,7 +248,7 @@ void make_tunnel(int rsock, const char *
 		sa = NULL;
 	}
 
-	sa = resolve_host(remote_host, hint);
+	sa = resolve_host(remote_host, remote_hint);
 
 	((struct sockaddr_in*) sa)-sin_port = htons(remote_port);
 
@@ -507,7 +509,7 @@ void sigterm()
 int main(int argc, char **argv)
 {
 	int force = 0, lsock, csock, one = 0, jeden = 1, local_port;
-	int detach = 1, listen6 = 0, sa_len, conn_limit = 0;
+	int detach = 1, sa_len, conn_limit = 0;
 	char optc, *username = NULL, *bind_host = NULL;
 	struct sockaddr *sa;
 	struct sockaddr_in laddr, caddr;
@@ -527,10 +529,10 @@ int main(int argc, char **argv)
 verbose = 1;
 break;
 			case '4':
-hint = AF_INET; 
 break;
 			case '6':
-listen6 = 1;
+remote_hint = AF_INET;
+local_hint = AF_INET6;
 break;
 			case 's':
 source_host = xstrdup(optarg);
@@ -597,7 +599,7 @@ int main(int argc, char **argv)
 
 	debug(resolving %s\n, remote_host);
 
-	if (!(sa = resolve_host(remote_host, hint))  !force) {
+	if (!(sa = resolve_host(remote_host, remote_hint))  !force) {
 		fprintf(stderr, %s: unable to resolve host %s\n, argv[0], remote_host);
 		exit(1);
 	}
@@ -608,7 +610,7 @@ int main(int argc, char **argv)
 	if (bind_host) {
 		debug(resolving %s\n, bind_host);
 
-		if (!(sa = resolve_host(bind_host, (listen6) ? AF_INET6 : AF_INET))) {
+		if (!(sa = resolve_host(bind_host, local_hint))) {
 			fprintf(stderr, %s: unable to resolve host %s\n, argv[0], remote_host);
 			exit(1);
 		}
@@ -622,7 +624,7 @@ int main(int argc, char **argv)
 	else
 		debug(source: %s\n, (source_host) ? source_host : default);
 
-	if (!listen6) {
+	if (local_hint == AF_INET) {
 		lsock = socket(PF_INET, SOCK_STREAM, 0);
 
 		memset(laddr, 0, (sa_len = sizeof(laddr)));