Subject: getsockopt()

From: "Xiaodan Tang" <[email-masked]>
Date: Tue, 10 Jun 2003 16:25:22 -0400

The IPPROTO_SCTP related getsockopt() usually need to send some data in
(the association id), this sort of mess up the idea that "getsockopt()" is
one direction
(from stack to application).

Is there any reason we are not using ioctl() (which is bi-direction) instead
of
getsockopt() ?

Xiaodan Tang
QNX Software System Ltd.

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Fri, 13 Jun 2003 06:04:17 -0500

>(from stack to application).

In FreeBSD anything sent into a getsockopt() call was visibile to the stack.
In NetBSD a minor tweak had to be made...

There are some stacks (aka those that use streams) that can't make
these adjustments... for them they can use the sctp_opt_info()

We did not use ioctl since it is designed more for devices and SCTP
is NOT a device (a quote from the freebsd manual):
"
DESCRIPTION
     The ioctl() function manipulates the underlying device parameters 
of spe-
     cial files.  In particular, many operating characteristics of character
     special files (e.g. terminals) may be controlled with ioctl() requests.
     The argument d must be an open file descriptor.
"

This is not in keeping with a socket... instead a sockopt get/set is in line
with this...

R

-- 
Randall R. Stewart
ITD
Cisco Systems Inc.
[email-masked] 815-342-5222(cell) or 815-477-2127(office)

---

From: Sean Boudreau <[email-masked]>
Date: Fri, 13 Jun 2003 09:30:46 -0400

> This is not in keeping with a socket... instead a sockopt get/set is in line

That seems to be a rigid interpretation of ioctl().  A socket can
be interpreted as a "special file" of type S_IFSOCK.  And ioctl() is
definitly used for sockets on FreeBSD:  look at all the SIOC* ioctls.

This seems to be a non standard way of using getsockopt() which will
require special case code.

-seanb

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Fri, 13 Jun 2003 13:45:36 -0500

Sean:

I don't see how it requires special case code.. could you
explain your statement?

I know it does not in any of the BSD's... other than the bit
I had to add for NetBSD.. free and open I think already were
passing the data from the get call in..

And for the app.. there is no special case here... If you are
worried about the
sctp_opt_info() vs getsocktop().. thats easy.. in the BSD's
just like it mentions in the draft.. the sctp_opt_info just
re-maps to getsockopt().. so for an app writer.. all you need do
is call
sctp_opt_info()

and the right thing will occur.. no matter what platform.

R

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Fri, 13 Jun 2003 15:17:36 -0500

Sean:

Each to his own opinion...

One always has the option of adding a syscall
sctp_opt_info() or mapping it to an ioctl if that
is the flavor you want :>

Of course I see no problem with leaving it
with getsockopt()

R

Sean Boudreau wrote:

>A little background:  my initiation to sctp began
>with 'it requires getsockopt() to pass in
>data'.  The extra code that I'm aware of is the
>change to NetBSD you mentioned, and to our socket
>library to pass in the extra data and our stack
>to re-arrange things to look for it (that's where I
>got invloved).  Passing data in via getsockopt() isn't
>necessarly a bad thing, I don't see it specifically
>forbidden in POSIX but no mention that it should be
>expected to work etiher.  I'm also not aware of another
>precedent for doing this and in fact it seems this
>behaviour is usually achieved on sockets via ioctl().
>
>When I first saw this I thought, that's weird...
>
>-seanb
>
>On Fri, Jun 13, 2003 at 01:45:36PM -0500, Randall Stewart (cisco) wrote:
>  
>
>>Sean:
>>

---

From: Sean Boudreau <[email-masked]>
Date: Fri, 13 Jun 2003 15:50:08 -0400

-seanb

---

From: Sean Boudreau <[email-masked]>
Date: Fri, 13 Jun 2003 18:26:59 -0400

> Of course I see no problem with leaving it

All true. Just a suggestion on how to make sctp
slightly easier for others to implement...

-seanb

---

From: "Brian F. G. Bidulock" <[email-masked]>
Date: Fri, 13 Jun 2003 21:02:21 -0600

Sean,

See

    http://www.openss7.org/cgi-bin/man/man2html?7+sctp

for a socket interface to SCTP that needs

  - no radical extensions to the POSIX interface,
  - no modifications to NET4 core socket code, and
  - no extra system calls.

(Oh, and all mechanisms are compatible between STREAMS and
sockets.)

--brian

-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
[email-masked]    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦