Network stack feedback-based fixes

Thanks to Lionel Sambuc!

Change-Id: Iae6b2caf58e2b58093e60c5004cfa477e43da154
This commit is contained in:
David van Moolenbroek 2017-04-30 15:33:24 +00:00
parent 3ba6090f82
commit 79a488aa87
2 changed files with 11 additions and 3 deletions

View File

@ -1375,7 +1375,7 @@ sockevent_listen(sockid_t id, int backlog)
/*
* For the extremely unlikely case that right after the socket
* is put into listening mode, it has a connection ready tor
* is put into listening mode, it has a connection ready to
* accept, we retest blocked ready-to-read select queries now.
*/
sockevent_raise(sock, SEV_ACCEPT);

View File

@ -10,8 +10,8 @@
* (SOCK_DGRAM) neither. There are two types of ancillary data: in-flight file
* descriptors and sender credentials. In addition, for SOCK_DGRAM sockets,
* the segment may contain the sender's socket path (if the sender's socket is
* bound). Each segment has has a header, containing the full segment size,
* the size of the actual data in the segment (if any), and a flags field that
* bound). Each segment has a header, containing the full segment size, the
* size of the actual data in the segment (if any), and a flags field that
* states which ancillary are associated with the segment (if any). For
* SOCK_STREAM type sockets, new data may be merged into a previous segment,
* but only if it has no ancillary data. For the other two socket types, each
@ -600,6 +600,14 @@ uds_send_data(struct udssock * uds, struct udssock * peer,
__arraycount(groups))) != OK)
return r;
/*
* getsockcred(3) returns the total number of groups for the
* process, which may exceed the size of the given array. Our
* groups array should always be large enough for all groups,
* but we check to be sure anyway.
*/
assert(sockcred.sc_ngroups <= (int)__arraycount(groups));
credlen = 1 + SOCKCREDSIZE(sockcred.sc_ngroups);
segflags |= UDS_HAS_CRED;