mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Use thread0 instead of user's thread for sobind.
This fixes reconnect after, for example, tcp idle disconnection. Previously this would fail if a normal user tried to bind to a privileged port. Submitted by: cel@citi.umich.edu MFC after: 1 week
This commit is contained in:
parent
4b81d0eb0f
commit
c99880b289
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154581
@ -423,7 +423,11 @@ rpcclnt_connect(rpc, td)
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sin.sin_port = htons(0);
|
||||
error = sobind(so, (struct sockaddr *) & sin, td);
|
||||
/*
|
||||
* &thread0 gives us root credentials to ensure sobind
|
||||
* will give us a reserved ephemeral port.
|
||||
*/
|
||||
error = sobind(so, (struct sockaddr *) & sin, &thread0);
|
||||
#endif
|
||||
if (error)
|
||||
goto bad;
|
||||
|
Loading…
Reference in New Issue
Block a user