Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please add sctp protocol support to IO::Socket::INET [rt.cpan.org #68902] #17446

Open
toddr opened this issue Apr 19, 2018 · 14 comments
Open

please add sctp protocol support to IO::Socket::INET [rt.cpan.org #68902] #17446

toddr opened this issue Apr 19, 2018 · 14 comments
Assignees
Labels
dist-IO issues in the dual-life blead-first IO distribution Feature Request

Comments

@toddr
Copy link
Member

toddr commented Apr 19, 2018

Migrated from rt.cpan.org#68902 (status was 'open')

Requestors:

From [email protected] on 2011-06-17 19:12:49:

currently not working:
IO::Socket::INET->new('Proto'    => 'sctp');

very small and simple fix:

```diff
--- INET.pm_    2011-06-17 20:55:56.000000000 +0400
+++ INET.pm     2011-06-17 20:56:35.000000000 +0400
@@ -22,11 +22,13 @@
 IO::Socket::INET->register_domain( AF_INET );

 my %socket_type = ( tcp  => SOCK_STREAM,
+                    sctp => SOCK_STREAM,
                    udp  => SOCK_DGRAM,
                    icmp => SOCK_RAW
                  );
 my %proto_number;
 $proto_number{tcp}  = Socket::IPPROTO_TCP()  if defined 
&Socket::IPPROTO_TCP;
+$proto_number{sctp}  = Socket::IPPROTO_SCTP()  if defined 
&Socket::IPPROTO_SCTP;
 $proto_number{udp}  = Socket::IPPROTO_UDP()  if defined 
&Socket::IPPROTO_UDP;
 $proto_number{icmp} = Socket::IPPROTO_ICMP() if defined 
&Socket::IPPROTO_ICMP;
 my %proto_name = reverse %proto_number;

From [email protected] on 2012-02-21 19:50:18:

I'm not sure this is the most sensible of behaviors. sctp can be used as
both a SOCK_STREAM and a SOCK_SEQPACKET: but the former doesn't really
make sense (what'd be the advantage over tcp?).

Leon

@toddr
Copy link
Member Author

toddr commented Apr 20, 2018

Given no response to the comment made by @Leont in 2012, I'm going to close this. Please re-open if you still would like to discuss this further.

@toddr toddr closed this as completed Apr 20, 2018
@Leont
Copy link
Contributor

Leont commented Apr 20, 2018

I do think this ticket is valid, but realistically it needs Socket to have more SCTP support

@toddr
Copy link
Member Author

toddr commented Apr 20, 2018

How would you like to action this then? Do we want a perl RT about this?

@toddr toddr reopened this Apr 20, 2018
@toddr toddr transferred this issue from Dual-Life/IO Jan 20, 2020
@toddr toddr added Needs Triage dist-IO issues in the dual-life blead-first IO distribution labels Jan 20, 2020
@Leont
Copy link
Contributor

Leont commented Feb 2, 2020

IMO we should improve our sctp support, the question is should it be SOCK_STREAM or SOCK_SEQPACKET by default. @leonerd got an opinion?

@leonerd
Copy link
Contributor

leonerd commented Feb 6, 2020

I don't really know enough about SCTP or the uses of it to suggest either way

@FGasper
Copy link
Contributor

FGasper commented Feb 7, 2020

@Leont Perhaps rather than just sctp, there could be both sctp_one (SOCK_STREAM) and sctp_many (SOCK_SEQPACKET)?

Both interface styles are of legitimate interest.

@Leont
Copy link
Contributor

Leont commented Feb 8, 2020

Perhaps rather than just sctp, there could be both sctp_one (SOCK_STREAM) and sctp_many (SOCK_SEQPACKET)?

I think that would only be more confusing. Also, this is only about the default (you can still override the Type argument to set the other), so ultimately it's not all that important.

@FGasper
Copy link
Contributor

FGasper commented Feb 8, 2020

I think that would only be more confusing.

In order to use SCTP usefully, though, you have to know whether you want TCP-style/one-to-one or UDP-style/one-to-many, right? It seems to me that any confusion that results from having sctp_one and sctp_many has more to do with not understanding that SCTP does both one-to-one (à la TCP) and one-to-many (à la UDP) interactions.

@Leont
Copy link
Contributor

Leont commented Feb 8, 2020

SOCK_SEQPACKET doesn't mean one-to-many. It means sequential packets (much like a stream, but with actual packet boundaries; or like connected UDP but reliable and ordered).

While SCTP does support multihoming, I don't think that would fit into the interface of IO::Socket::INET/IO::Socket::IP. That will probably require an IO::Socket::SCTP module that probably should at least start out its life outside of this distribution.

@FGasper
Copy link
Contributor

FGasper commented Feb 8, 2020

@Leont

SOCK_SEQPACKET doesn't mean one-to-many.

Hrm? Where are you reading that? sctp(7) says:

       A one-to-many style interface with 1 to MANY relationship between  socket
       and  associations  where  the outbound association setup is implicit. The
       syntax of a one-to-many style socket() call is

       sd = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);

@Leont
Copy link
Contributor

Leont commented Feb 9, 2020

Yeah I didn't have that manpage until I just installed it.

I still don't think it'd be helpful to deviate from the socket API too much here (in other words, have 2 arguments instead of 1)

@FGasper
Copy link
Contributor

FGasper commented Feb 9, 2020

How would 2 args conform better to the socket API?

@tonycoz
Copy link
Contributor

tonycoz commented Mar 19, 2020

It seems to me that the current behaviour is reasonable, I don't think we can reasonable select one socket type over the other, so it's reasonable to expect the caller to supply that themselves.

The error returned could be improved though:

$ ./perl -Ilib -MIO::Socket::INET -e '$x = IO::Socket::INET->new(Proto => 'sctp') or die;'
IO::Socket::INET: Socket type not supported     ...propagated at -e line 1.

and that could be improved, maybe:

No default socket type for 'sctp', supply a Type parameter.

would be an improvement.

@Leont
Copy link
Contributor

Leont commented Mar 20, 2020

It seems to me that the current behaviour is reasonable, I don't think we can reasonable select one socket type over the other, so it's reasonable to expect the caller to supply that themselves.

Actually, that is probably the most reasonable suggestion :-)

@xenu xenu removed the Severity Low label Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dist-IO issues in the dual-life blead-first IO distribution Feature Request
Projects
None yet
Development

No branches or pull requests

6 participants