Project

General

Profile

Actions

Bug #5898

closed

SO_RCVTIMEO broken for AF_UNIX

Added by Gordon Ross over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2015-05-02
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

After we changed the SMB server to use AF_UNIX sockets for SMB "named pipes", we noticed that recv calls on these sockets don't timeout as advertised when one sets SO_RCVTIMEO.

Actions #1

Updated by Gordon Ross over 6 years ago

We tracked this down to socktpi.c sotpi_recvmsg()
where it computes the timeout to pass to kstrgetmsg.
The fix is pretty simple, as shown below:

diff --git a/usr/src/uts/common/fs/sockfs/socktpi.c b/usr/src/uts/common/fs/sockfs/socktpi.c
index 582db26..d33f53f 100644
--- a/usr/src/uts/common/fs/sockfs/socktpi.c
+++ b/usr/src/uts/common/fs/sockfs/socktpi.c
@@ -3223,6 +3222,8 @@ sotpi_recvmsg(struct sonode *so, struct nmsghdr *msg, struct uio *uiop,

     if (flags & MSG_DONTWAIT)
         timout = 0;
+    else if (so->so_rcvtimeo != 0)
+        timout = TICK_TO_MSEC(so->so_rcvtimeo);
     else
         timout = -1;
     opflag = pflag;
Actions #2

Updated by Electric Monk about 6 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 412cc9e98decfe9afa3ce4f414bc04fd83c9f856

commit  412cc9e98decfe9afa3ce4f414bc04fd83c9f856
Author: Gordon Ross <gwr@nexenta.com>
Date:   2015-05-08T14:36:39.000Z

    5898 SO_RCVTIMEO broken for AF_UNIX
    Reviewed by: Albert Lee <trisk@omniti.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Dan McDonald <danmcd@omniti.com>

Actions

Also available in: Atom PDF