Claudio Jeker <[email protected]> writes:
[...]
> I wonder what other systems do with regard to fd passing with empty
> messages. I always had the feeling that this is not allowed but I never
> looked deeper into the standards defining this.
I don't which standard does actually define this.
Running my test program with the default iteration (5 rounds, so fd 5 to
9 are expected to be passed and printed). The results seem to imply
that the behavior brought by the patch is consistent. Linux behaves
differently here, but that's not very surprising.
Note: just like the SOCK_STREAM case on OpenBSD, those implementations
may fail to discard the empty data mbuf, ending up filling the socket
buffer. I did not want to bother too much Freddy Dissaux (dsx) who
provided tests on !(Linux). :)
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| OS | Arch | Version | recvmsg data buffer | SOCK_STREAM
| SOCK_DGRAM |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| Linux | amd64 | 3.2 | no | recvmsg blocks
| fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| Linux | amd64 | 3.2 | yes | recvmsg blocks
| fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| FreeBSD | ia64 | 10 | no | CMSG_DATA yields
NULL | CMSG_DATA yields NULL |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| FreeBSD | ia64 | 10 | yes | fds correctly
passed | fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| FreeBSD | i386 | 8.2 | no | second recvmsg
call yields fd 5 | truncation warnings |
| | | | | others: CMSG_DATA
yields NULL | fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| FreeBSD | i386 | 8.2 | yes | fds correctly
passed | fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| Dragonfly | amd64 | 3.7-DEVELOPMENT | no | second recvmsg
call yields fd 5 | truncation warning |
| | | | | others: CMSG_DATA
yields NULL | first recvmsg: CMSG_DATA yields NULL |
| | | | |
| then fds 5 to 8 are passed, fd 9 is missing |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| Dragonfly | amd64 | 3.7-DEVELOPMENT | yes | fds correctly
passed | fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| NetBSD | amd64 | 6.1.3 | no | second recvmsg
call yields fd 5 | unknown |
| | | | | others: CMSG_DATA
yields NULL | |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
| NetBSD | amd64 | 6.1.3 | yes | fds correctly
passed | fds correctly passed |
|-----------+-------+-----------------+---------------------+---------------------------------+---------------------------------------------|
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE