public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/345] New: getsockname returns a value different of zero when successful
@ 2004-08-25 16:10 aioannis at tinet dot org
2004-08-25 16:18 ` [Bug libc/345] " aioannis at tinet dot org
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: aioannis at tinet dot org @ 2004-08-25 16:10 UTC (permalink / raw)
To: glibc-bugs
When calling the function getsockname, errno shows Successful, but the value
returned is not zero, but different instead.
I have tested this on versions 2.3.2 (Debian) and 2.3.4 (Gentoo) with that
behaviour.
>From man 2 getsockname:
NAME
getsockname - get socket name
SYNOPSIS
#include <sys/socket.h>
int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
DESCRIPTION
Getsockname returns the current name for the specified socket. The
namelen parameter should be initialized to indicate the amount of space
pointed to by name. On return it contains the actual size of the name
returned (in bytes).
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is
set appropriately.
--
Summary: getsockname returns a value different of zero when
successful
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P1
Component: libc
AssignedTo: gotom at debian dot or dot jp
ReportedBy: aioannis at tinet dot org
CC: glibc-bugs at sources dot redhat dot com
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
@ 2004-08-25 16:18 ` aioannis at tinet dot org
2004-08-25 16:18 ` aioannis at tinet dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: aioannis at tinet dot org @ 2004-08-25 16:18 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From aioannis at tinet dot org 2004-08-25 16:18 -------
Created an attachment (id=175)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=175&action=view)
This is the headers file for gso.cpp
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
2004-08-25 16:18 ` [Bug libc/345] " aioannis at tinet dot org
@ 2004-08-25 16:18 ` aioannis at tinet dot org
2004-08-25 16:27 ` aioannis at tinet dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: aioannis at tinet dot org @ 2004-08-25 16:18 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From aioannis at tinet dot org 2004-08-25 16:18 -------
Created an attachment (id=174)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=174&action=view)
This is a sample source code that reproduces the bug (requires the header file)
I add a sample source code that reproduces the bug:
gso.cpp and gso.h
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
2004-08-25 16:18 ` [Bug libc/345] " aioannis at tinet dot org
2004-08-25 16:18 ` aioannis at tinet dot org
@ 2004-08-25 16:27 ` aioannis at tinet dot org
2004-08-29 19:45 ` jakub at redhat dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: aioannis at tinet dot org @ 2004-08-25 16:27 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From aioannis at tinet dot org 2004-08-25 16:27 -------
This behaviour described for getsockname also happens for the getpeername()
function, which returns a value different from zero when successful.
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
` (2 preceding siblings ...)
2004-08-25 16:27 ` aioannis at tinet dot org
@ 2004-08-29 19:45 ` jakub at redhat dot com
2004-09-12 5:49 ` drepper at redhat dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: jakub at redhat dot com @ 2004-08-29 19:45 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jakub at redhat dot com 2004-08-29 19:44 -------
I certainly can't reproduce this, neither on IA-32 nor x86-64.
Please write what exact arguments you call the test with, run it under
strace and show its output and what kernel you're using.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
` (3 preceding siblings ...)
2004-08-29 19:45 ` jakub at redhat dot com
@ 2004-09-12 5:49 ` drepper at redhat dot com
2004-09-13 15:56 ` aioannis at tinet dot org
2004-09-21 10:35 ` aioannis at tinet dot org
6 siblings, 0 replies; 15+ messages in thread
From: drepper at redhat dot com @ 2004-09-12 5:49 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2004-09-12 05:49 -------
getsockname in glibc is nothing but a syscall wrapper. If you have a problem,
this is a problem in the kernel. Report the bug appropriately.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |WORKSFORME
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
` (4 preceding siblings ...)
2004-09-12 5:49 ` drepper at redhat dot com
@ 2004-09-13 15:56 ` aioannis at tinet dot org
2004-09-21 10:35 ` aioannis at tinet dot org
6 siblings, 0 replies; 15+ messages in thread
From: aioannis at tinet dot org @ 2004-09-13 15:56 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From aioannis at tinet dot org 2004-09-13 15:56 -------
Sent to kernel.org: http://bugzilla.kernel.org/show_bug.cgi?id=3387
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
` (5 preceding siblings ...)
2004-09-13 15:56 ` aioannis at tinet dot org
@ 2004-09-21 10:35 ` aioannis at tinet dot org
6 siblings, 0 replies; 15+ messages in thread
From: aioannis at tinet dot org @ 2004-09-21 10:35 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From aioannis at tinet dot org 2004-09-21 10:35 -------
kernel.org refused to solve this bug, arguing it's a glibc issue:
------- Additional Comment #3 From Hideaki YOSHIFUJI 2004-09-21 00:47 -------
Kernel is not responsible to errno, but glibc is;
it should setup errno appropriately returned from syscall.
------- Additional Comment #4 From Hideaki YOSHIFUJI 2004-09-21 00:48 -------
Please report this to the appropriate community (glibc).
See bug: http://bugme.osdl.org/show_bug.cgi?id=3387 for additional info.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|VERIFIED |REOPENED
Resolution|WORKSFORME |
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
` (5 preceding siblings ...)
2004-09-21 14:05 ` jakub at redhat dot com
@ 2004-09-21 14:10 ` deathwing00 at forums dot gentoo dot org
6 siblings, 0 replies; 15+ messages in thread
From: deathwing00 at forums dot gentoo dot org @ 2004-09-21 14:10 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From deathwing00 at forums dot gentoo dot org 2004-09-21 14:10 -------
Oops. I saw your comment.
After modifying my code a bit more (with the source I provided you) I got this:
ioannis@petekan gso $ ./gso www.google.com 80
gethostname OK
socket OK
connect OK
getsockname Success
getsockname: 10.30.102.123:56575
getpeername Success
getpeername: 66.102.9.104:80
EXITING
Should have done that from the begining.
In the code:
if(getpeername(SocketDesc,(sockaddr *)&gsoSA,&gsoSL))
{
cout << strerror(errno) << endl;
return -4;
}
If the returned value is zero, the statement is false, so it won't exit. I
still don't understand why it failed in the previous code. Anyway. Now I have
my app up and running.
Thanks for the time.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |WORKSFORME
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
` (4 preceding siblings ...)
2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
@ 2004-09-21 14:05 ` jakub at redhat dot com
2004-09-21 14:10 ` deathwing00 at forums dot gentoo dot org
6 siblings, 0 replies; 15+ messages in thread
From: jakub at redhat dot com @ 2004-09-21 14:05 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jakub at redhat dot com 2004-09-21 14:05 -------
Still doesn't fail.
strace -e getsockname /tmp/gso2 www.google.com 80; echo $?
gethostname OK
socket OK
connect OK
getsockname(3, {sa_family=AF_INET, sin_port=htons(33139),
sin_addr=inet_addr("195.113.19.62")}, [22560191895568400]) = 0
getsockname Success
getsockname: 195.113.19.62:33139
getpeername Success
getpeername: 216.239.59.147:80
EXITING
0
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
` (3 preceding siblings ...)
2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
@ 2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
2004-09-21 14:05 ` jakub at redhat dot com
2004-09-21 14:10 ` deathwing00 at forums dot gentoo dot org
6 siblings, 0 replies; 15+ messages in thread
From: deathwing00 at forums dot gentoo dot org @ 2004-09-21 14:02 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From deathwing00 at forums dot gentoo dot org 2004-09-21 14:02 -------
Created an attachment (id=197)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=197&action=view)
Updated version.
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #175 is|0 |1
obsolete| |
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
` (2 preceding siblings ...)
2004-09-21 13:38 ` jakub at redhat dot com
@ 2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: deathwing00 at forums dot gentoo dot org @ 2004-09-21 14:02 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From deathwing00 at forums dot gentoo dot org 2004-09-21 14:01 -------
Created an attachment (id=196)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=196&action=view)
Updated version.
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #174 is|0 |1
obsolete| |
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
2004-09-21 10:42 ` jakub at redhat dot com
2004-09-21 12:51 ` deathwing00 at forums dot gentoo dot org
@ 2004-09-21 13:38 ` jakub at redhat dot com
2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: jakub at redhat dot com @ 2004-09-21 13:38 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jakub at redhat dot com 2004-09-21 13:38 -------
/tmp/gso www.google.com 80; echo $?
gethostname OK
socket OK
connect OK
getsockname Success
EXITING
0
strace -e getsockname /tmp/gso www.google.com 80 > /dev/null
getsockname(4, {sa_family=AF_INET, sin_port=htons(33134),
sin_addr=inet_addr("195.113.19.62")}, [22560191895568400]) = 0
strace -e getsockname /tmp/gso www.google.com 80 > /dev/null
getsockname(4, {sa_family=AF_INET, sin_port=htons(33134),
sin_addr=inet_addr("195.113.19.62")}, [22560191895568400]) = 0
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
2004-09-21 10:42 ` jakub at redhat dot com
@ 2004-09-21 12:51 ` deathwing00 at forums dot gentoo dot org
2004-09-21 13:38 ` jakub at redhat dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: deathwing00 at forums dot gentoo dot org @ 2004-09-21 12:51 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From deathwing00 at forums dot gentoo dot org 2004-09-21 12:51 -------
Alright, sorry about that.
I'll give you a more elaborate code soon, but about thre results, what happens
is that:
www.google.com:80 --> The function returns a value different from zero, errno
returns successful and the IP addresses returned (both local and remote) are
correct.
I've tried this also with forums.gentoo.org:80, sf.net:80,
upload.sf.net:21, ...
As soon as I find the piece of code I used, I'll post it :)
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libc/345] getsockname returns a value different of zero when successful
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
@ 2004-09-21 10:42 ` jakub at redhat dot com
2004-09-21 12:51 ` deathwing00 at forums dot gentoo dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: jakub at redhat dot com @ 2004-09-21 10:42 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jakub at redhat dot com 2004-09-21 10:42 -------
You haven't bothered to answer the questions in #4.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |WAITING
http://sources.redhat.com/bugzilla/show_bug.cgi?id=345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2004-09-21 14:10 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25 16:10 [Bug libc/345] New: getsockname returns a value different of zero when successful aioannis at tinet dot org
2004-08-25 16:18 ` [Bug libc/345] " aioannis at tinet dot org
2004-08-25 16:18 ` aioannis at tinet dot org
2004-08-25 16:27 ` aioannis at tinet dot org
2004-08-29 19:45 ` jakub at redhat dot com
2004-09-12 5:49 ` drepper at redhat dot com
2004-09-13 15:56 ` aioannis at tinet dot org
2004-09-21 10:35 ` aioannis at tinet dot org
[not found] <20040825161035.345.deathwing00@forums.gentoo.org>
2004-09-21 10:42 ` jakub at redhat dot com
2004-09-21 12:51 ` deathwing00 at forums dot gentoo dot org
2004-09-21 13:38 ` jakub at redhat dot com
2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
2004-09-21 14:02 ` deathwing00 at forums dot gentoo dot org
2004-09-21 14:05 ` jakub at redhat dot com
2004-09-21 14:10 ` deathwing00 at forums dot gentoo dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).