[patch] fix for accept on unix-domain sockets

Lars Heete (hel@admin.de)
Thu, 28 Oct 1999 18:43:01 +0200


--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Hello,

in recent 2.3 linux accept on unix-domain sockets is broken. It immediatly returns ENOTCONN
when called on listening sockets with no connections pending, instead of waiting.
The reason is, that skb_recv_datagram is used get incoming connection requests, but this checks
if a SOCK_STREAM socket is in TCP_ESTABLISHED state before waiting.
Here is a patch, that fixes this problem by not using skb_recv_datagram. It may not be the right
solution, but it fixes this problem.

Lars Heete
--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD
Content-Type: text/plain;
name="unix.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="unix.diff"

LS0tIGxpbnV4L25ldC91bml4L2FmX3VuaXguYy5iYWsJVGh1IE9jdCAyOCAxODoyNToxMSAxOTk5
CisrKyBsaW51eC9uZXQvdW5peC9hZl91bml4LmMJVGh1IE9jdCAyOCAxOTowNjo1OCAxOTk5CkBA
IC05NjEsMTggKzk2MSwyNiBAQAogCiAJLyogSWYgc29ja2V0IHN0YXRlIGlzIFRDUF9MSVNURU4g
aXQgY2Fubm90IGNoYW5nZSwKIAkgICBzbyB0aGF0IG5vIGxvY2tzIGFyZSBuZWNlc3NhcnkuCiAJ
ICovCiAKLQlza2IgPSBza2JfcmVjdl9kYXRhZ3JhbShzaywgMCwgZmxhZ3MmT19OT05CTE9DSywg
JmVycik7Ci0JaWYgKCFza2IpCi0JCWdvdG8gb3V0OworICAgICAgICBkbyB7CisgICAgICAgICAg
ICAgICAgaWYgKChza2IgPSBza2JfZGVxdWV1ZSgmc2stPnJlY2VpdmVfcXVldWUpKSA9PSBOVUxM
KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmxhZ3MgJiBPX05PTkJMT0NLKQorICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLUVBR0FJTjsKKyAKKyAgICAgICAg
ICAgICAgICAgICAgICAgIGlmIChzaWduYWxfcGVuZGluZyhjdXJyZW50KSkKKyAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FUkVTVEFSVFNZUzsKKworICAgICAgICAgICAg
ICAgICAgICAgICAgaW50ZXJydXB0aWJsZV9zbGVlcF9vbihzay0+c2xlZXApOworICAgICAgICAg
ICAgICAgIH0KKyAgICAgICAgfSB3aGlsZSAoc2tiID09IE5VTEwpOwogCiAJdHNrID0gc2tiLT5z
azsKKwlrZnJlZV9za2Ioc2tiKTsKIAlpZiAoc2tiX3F1ZXVlX2xlbigmc2stPnJlY2VpdmVfcXVl
dWUpIDw9IHNrLT5tYXhfYWNrX2JhY2tsb2cvMikKIAkJd2FrZV91cF9pbnRlcnJ1cHRpYmxlKCZz
ay0+cHJvdGluZm8uYWZfdW5peC5wZWVyX3dhaXQpOwotCXNrYl9mcmVlX2RhdGFncmFtKHNrLCBz
a2IpOwogCiAJLyogYXR0YWNoIGFjY2VwdGVkIHNvY2sgdG8gc29ja2V0ICovCiAJdW5peF9zdGF0
ZV93bG9jayh0c2spOwogCW5ld3NvY2stPnN0YXRlID0gU1NfQ09OTkVDVEVEOwogCW5ld3NvY2st
PnNrID0gdHNrOwo=

--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/