bzero() the the sockaddr used for the destination address for
rtalloc_ign() in in_pcbconnect_setup() before it is filled out. Otherwise, stack junk would be left in sin_zero, which could cause host routes to be ignored because they failed the comparison in rn_match(). This should fix the wrong source address selection for connect() to 127.0.0.1, among other things. Reviewed by: sam Approved by: re (rwatson)
This commit is contained in:
parent
90768c55d4
commit
1f831750b5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122960
@ -588,6 +588,7 @@ in_pcbconnect_setup(inp, nam, laddrp, lportp, faddrp, fportp, oinpp, td)
|
||||
*/
|
||||
if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0) {
|
||||
/* Find out route to destination */
|
||||
bzero(&sro.ro_dst, sizeof(struct sockaddr_in));
|
||||
sro.ro_dst.sa_family = AF_INET;
|
||||
sro.ro_dst.sa_len = sizeof(struct sockaddr_in);
|
||||
((struct sockaddr_in *)&sro.ro_dst)->sin_addr = faddr;
|
||||
|
Loading…
Reference in New Issue
Block a user