summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2003-11-23 03:02:00 +0000
committertmm <tmm@FreeBSD.org>2003-11-23 03:02:00 +0000
commit5bae25b0ade32ad5e58850665a1f3de6593e4eab (patch)
treeb32f2ddee8fa3da844cda3e001bbb6588bcd6f68 /sys
parent7fde31fc316ddc67eca04ed4afde49794d82ea28 (diff)
downloadFreeBSD-src-5bae25b0ade32ad5e58850665a1f3de6593e4eab.zip
FreeBSD-src-5bae25b0ade32ad5e58850665a1f3de6593e4eab.tar.gz
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)
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in_pcb.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 898c0d4..050fb88 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -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;
OpenPOWER on IntegriCloud