exclude Unix Domain Socket from setErrMessageCB
authorLiang Zhu <liangzhu@fb.com>
Tue, 5 Dec 2017 11:49:11 +0000 (03:49 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 Dec 2017 11:50:15 +0000 (03:50 -0800)
commitd389a33028d1a8a8520bc5c85dbcf767131fd51c
tree92f811d6aa656e85798ebfad201196ce9f363b2c
parent6786799608b6ef203db9d7e880b99d0bc7330ede
exclude Unix Domain Socket from setErrMessageCB

Summary:
In the latest stable kernel 4.14.3 as of 2017-12-04, unix domain socket does not support MSG_ERRQUEUE. So recvmsg(MSG_ERRQUEUE) will read application data from unix doamin socket as error message, which breaks the message flow in application. This diff disable setErrMessageCB for Unix Domain Socket.

Both [[ https://github.com/torvalds/linux/blob/master/net/ipv4/tcp.c#L1782 | tcp_recvmsg ]] and [[ https://github.com/torvalds/linux/blob/master/net/ipv4/udp.c#L1571 | udp_recvmsg ]] will check flag MSG_ERRQUEUE and read from error queue.  However, there is nothing about MSG_ERRQUEUE in [[ https://github.com/torvalds/linux/blob/master/net/unix/af_unix.c#L2249 | af_unix ]].

Reviewed By: yfeldblum

Differential Revision: D6479465

fbshipit-source-id: eba2c8650e96466f2b361a42ddf90053d65f19bd
folly/io/async/AsyncSocket.cpp
folly/io/async/test/AsyncSocketTest2.cpp