[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#654937: marked as done (libc6-dev: bind fails when using INADDR_LOOPBACK)



Your message dated Sat, 7 Jan 2012 18:00:30 +0100
with message-id <20120107170030.GA20942@hall.aurel32.net>
and subject line Re: Bug#654937: libc6-dev: bind fails when using INADDR_LOOPBACK
has caused the Debian Bug report #654937,
regarding libc6-dev: bind fails when using INADDR_LOOPBACK
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
654937: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=654937
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6-dev
Version: 2.11.2-10
Severity: normal

Cannot use INADDR_LOOPBACK in a bind call. A code example follows:

  server_addr.sin_family      = AF_INET;
  server_addr.sin_port        = htons(tcp_server_port);
  server_addr.sin_addr.s_addr = INADDR_LOOPBACK;

... followed by a bind() call fails.

whereas:
  server_addr.sin_family      = AF_INET;
  server_addr.sin_port        = htons(tcp_server_port);
  server_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
... works.

I printout the two values like below:
  printf("server_addr.sin_addr.s_add: %ld    INADDR_LOOPBACK: %ld\n",
	 server_addr.sin_addr.s_addr, INADDR_LOOPBACK);
...and I get:
server_addr.sin_addr.s_add: 16777343    INADDR_LOOPBACK: 2130706433

...which is odd, I guess the two values should be the same.

My includes look like this:
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>

...and netinet/in.h is the one include to have INADDR_LOOPBACK defined.

Thanks!
-- System Information:
Debian Release: 6.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (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/dash

Versions of packages libc6-dev depends on:
ii  libc-dev-bin                  2.11.2-10  Embedded GNU C Library: Developmen
ii  libc6                         2.11.2-10  Embedded GNU C Library: Shared lib
ii  linux-libc-dev                2.6.32-38  Linux support headers for userspac

Versions of packages libc6-dev recommends:
ii  gcc [c-compiler]              4:4.4.5-1  The GNU C compiler
ii  gcc-4.1 [c-compiler]          4.1.2-29   The GNU C compiler
ii  gcc-4.3 [c-compiler]          4.3.5-4    The GNU C compiler
ii  gcc-4.4 [c-compiler]          4.4.5-8    The GNU C compiler

Versions of packages libc6-dev suggests:
pn  glibc-doc                     <none>     (no description available)
ii  manpages-dev                  3.27-1     Manual pages about using GNU/Linux

-- no debconf information



--- End Message ---
--- Begin Message ---
On Sat, Jan 07, 2012 at 05:58:07AM +0700, Olle Blomgren wrote:
> Package: libc6-dev
> Version: 2.11.2-10
> Severity: normal
> 
> Cannot use INADDR_LOOPBACK in a bind call. A code example follows:
> 
>   server_addr.sin_family      = AF_INET;
>   server_addr.sin_port        = htons(tcp_server_port);
>   server_addr.sin_addr.s_addr = INADDR_LOOPBACK;

INADDR_LOOPBACK is given in the host representation, it should still be
converted to network representation. Please try with:

    server_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


--- End Message ---

Reply to: