Return ECONNRESET instead of EINVAL if the connection has been shot
down as a result of a reset. Returning EINVAL in that case makes no sense at all and just confuses people as to what happened. It could be argued that we should save the original address somewhere so that getsockname() etc can tell us what it used to be so we know where the problem connection attempts are coming from.
This commit is contained in:
parent
7c263c5bb0
commit
e7bffe5da6
@ -582,7 +582,7 @@ in_setsockaddr(so, nam)
|
||||
if (!inp) {
|
||||
splx(s);
|
||||
free(sin, M_SONAME);
|
||||
return EINVAL;
|
||||
return ECONNRESET;
|
||||
}
|
||||
sin->sin_port = inp->inp_lport;
|
||||
sin->sin_addr = inp->inp_laddr;
|
||||
@ -605,7 +605,7 @@ in_setpeeraddr(so, nam)
|
||||
* Do the malloc first in case it blocks.
|
||||
*/
|
||||
MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK);
|
||||
bzero((caddr_t)sin, sizeof (*sin));
|
||||
bzero(sin, sizeof (*sin));
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_len = sizeof(*sin);
|
||||
|
||||
@ -614,7 +614,7 @@ in_setpeeraddr(so, nam)
|
||||
if (!inp) {
|
||||
splx(s);
|
||||
free(sin, M_SONAME);
|
||||
return EINVAL;
|
||||
return ECONNRESET;
|
||||
}
|
||||
sin->sin_port = inp->inp_fport;
|
||||
sin->sin_addr = inp->inp_faddr;
|
||||
|
Loading…
Reference in New Issue
Block a user