mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
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
0fd66c1d39
commit
ff079ca4b1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=60690
@ -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