summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2011-01-11 19:43:35 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2011-01-11 19:43:35 +0000
commit0abe01cfd416f4705fe817282518b197577c6a1d (patch)
tree9920145b6e6e6454ff65b16c13c6d4c3d1eec682
parent4e5edfb6302646f0204fe0cde2ee2d34eb9e8ade (diff)
Notes
-rw-r--r--sys/netinet/in_pcb.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 5d1b9af94b39..02af7419911a 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -833,9 +833,10 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam,
}
}
if (laddr.s_addr == INADDR_ANY) {
+ error = in_pcbladdr(inp, &faddr, &laddr, cred);
/*
* If the destination address is multicast and an outgoing
- * interface has been set as a multicast option, use the
+ * interface has been set as a multicast option, prefer the
* address of that interface as our source address.
*/
if (IN_MULTICAST(ntohl(faddr.s_addr)) &&
@@ -852,16 +853,16 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam,
break;
if (ia == NULL) {
IN_IFADDR_RUNLOCK();
- return (EADDRNOTAVAIL);
+ error = EADDRNOTAVAIL;
+ } else {
+ laddr = ia->ia_addr.sin_addr;
+ IN_IFADDR_RUNLOCK();
+ error = 0;
}
- laddr = ia->ia_addr.sin_addr;
- IN_IFADDR_RUNLOCK();
}
- } else {
- error = in_pcbladdr(inp, &faddr, &laddr, cred);
- if (error)
- return (error);
}
+ if (error)
+ return (error);
}
oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport,
0, NULL);