Bug 207838 - Perl getsockopt() on SCTP sockets doesn't work
Perl getsockopt() on SCTP sockets doesn't work
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: perl (Show other bugs)
5
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Neil Horman
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-24 06:34 EDT by Pawel Politowicz
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-06-19 16:18:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Pawel Politowicz 2006-09-24 06:34:47 EDT
Description of problem:

Perl getsockopt() on SCTP socket does not work. Following perl code:
------------------------------------------
use strict;
use IO::Socket;

## create sctp socket
my $sock = new IO::Socket::INET(
        Proto => 132,
        Type  => SOCK_STREAM
) or die "Cannot create sctp socket";

## read rto data
my $i = getsockopt($sock, 132, 1);

#print rto data
print join("\n", unpack("I i*", $i));
------------------------------------------

Works on Solaris10, but not on (my) Linux. I checked C getsockopt, and code like
this:

ret  = getsockopt(sock , SOL_SCTP, SCTP_RTOINFO, &sctp_info, &len);

works OK only if len is initially set to sizeof(struct sctp_rtoinfo), which is
not what manual says:
-------------------------------------------
> man getsockopt
...
       The  parameters  optval and optlen are used to access option values for
       setsockopt().  For getsockopt() they identify a  buffer  in  which  the
       value  for  the  requested  option(s) are to be returned.  For getsock-
       opt(), optlen is a value-result  parameter,  initially  containing  the
       size  of  the  buffer  pointed  to by optval, and modified on return to
       indicate the actual size of the value returned.  If no option value  is
       to be supplied or returned, optval may be NULL.
...
-------------------------------------------

Above applies to all SCTP structures available via get/setsockopt.


Version-Release number of selected component (if applicable):
perl-5.8.8-5
glibc-2.4-11
kernel-2.6.17-1.2187_FC5

How reproducible:
every time

Steps to Reproduce:
1. run perl code from description
2. nothing is displayed
  
Actual results:
nothing is displayed

Expected results:
sctp socket rto into (4 parameters)

Additional info:
SELinux is disabled.
Comment 1 Neil Horman 2007-06-11 10:42:22 EDT
This seems like a kernel bug to me.  We're checking all our getsockopt values
for != sizeof(option) rather than for < sizeof(option), and we should be
returning ENOBUFS, rather than EINVAL (or silently truncating the result as
POSIX indicates).

Note You need to log in before you can comment on or make changes to this bug.