The listen call applies only to sockets of type SOCK_STREAM or
SOCK_SEQPACKET.
However, the code for inet_listen() in net/ipv4/af_inet.c (kernel version
2.1.59) reads, starting at line 290:
if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM)
return(-EINVAL);
Shouldn't this be:
if (sock->state != SS_UNCONNECTED ||
(sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET))
return(-EINVAL);
according to the manpage?
I suspect this bug appears in earlier version of linux, too... I found it
while trying to figure out why my listen() calls were failing with EINVAL.
I don't know whether accepting SEQPACKETs here would somehow break the
code at this point (I'm not familiar with the networking code at all...
yet), so I submit this to wiser heads than mine before I send in a patch.
--Scott
@ @
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-oOO-(_)-OOo-=-=-=-=-=
C. Scott Ananian: cananian@lcs.mit.edu / Declare the Truth boldly and
Laboratory for Computer Science/Crypto / without hindrance.
Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31
-.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -.
PGP key available via finger and from http://www.pdos.lcs.mit.edu/~cananian