svn commit: r217219 - stable/8/sys/netinet
Daniel Eischen
deischen at FreeBSD.org
Mon Jan 10 04:48:18 UTC 2011
Author: deischen
Date: Mon Jan 10 04:48:18 2011
New Revision: 217219
URL: http://svn.freebsd.org/changeset/base/217219
Log:
MFC: 217169
Make sure to always do source address selection on
an unbound socket, regardless of any multicast options.
If an address is specified via a multicast option, then
let it override normal the source address selection.
This fixes a bug where source address selection was
not being performed when multicast options were present
but without an interface being specified.
Modified:
stable/8/sys/netinet/in_pcb.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/netinet/in_pcb.c
==============================================================================
--- stable/8/sys/netinet/in_pcb.c Mon Jan 10 03:59:04 2011 (r217218)
+++ stable/8/sys/netinet/in_pcb.c Mon Jan 10 04:48:18 2011 (r217219)
@@ -833,9 +833,10 @@ in_pcbconnect_setup(struct inpcb *inp, s
}
}
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, s
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);
More information about the svn-src-all
mailing list