Return ECONNABORTED from accept if connection is closed while on the
listen queue, as well as the current behavior of a zero-length sockaddr. Obtained from: KAME Reviewed by: -net
This commit is contained in:
parent
cd8148eeb6
commit
2fd7d53d36
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=72471
@ -365,11 +365,8 @@ soaccept(so, nam)
|
||||
so->so_state &= ~SS_NOFDREF;
|
||||
if ((so->so_state & SS_ISDISCONNECTED) == 0)
|
||||
error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam);
|
||||
else {
|
||||
if (nam)
|
||||
*nam = 0;
|
||||
error = 0;
|
||||
}
|
||||
else
|
||||
error = ECONNABORTED;
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
|
@ -290,7 +290,19 @@ accept1(p, uap, compat)
|
||||
nfp->f_ops = &socketops;
|
||||
nfp->f_type = DTYPE_SOCKET;
|
||||
sa = 0;
|
||||
(void) soaccept(so, &sa);
|
||||
error = soaccept(so, &sa);
|
||||
if (error) {
|
||||
/*
|
||||
* return a namelen of zero for older code which might
|
||||
* ignore the return value from accept.
|
||||
*/
|
||||
if (uap->name != NULL) {
|
||||
namelen = 0;
|
||||
(void) copyout((caddr_t)&namelen,
|
||||
(caddr_t)uap->anamelen, sizeof(*uap->anamelen));
|
||||
}
|
||||
goto noconnection;
|
||||
}
|
||||
if (sa == NULL) {
|
||||
namelen = 0;
|
||||
if (uap->name)
|
||||
@ -314,6 +326,7 @@ accept1(p, uap, compat)
|
||||
error = copyout((caddr_t)&namelen,
|
||||
(caddr_t)uap->anamelen, sizeof (*uap->anamelen));
|
||||
}
|
||||
noconnection:
|
||||
if (sa)
|
||||
FREE(sa, M_SONAME);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user