Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144273424
D49435.id152493.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49435.id152493.diff
View Options
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1127,29 +1127,6 @@
if (in_nullhost(inp->inp_laddr)) {
error = in_pcbladdr(inp, &faddr, &laddr, cred);
- /*
- * If the destination address is multicast and an outgoing
- * interface has been set as a multicast option, prefer the
- * address of that interface as our source address.
- */
- if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) &&
- inp->inp_moptions != NULL &&
- inp->inp_moptions->imo_multicast_ifp != NULL) {
- struct ifnet *ifp =
- inp->inp_moptions->imo_multicast_ifp;
- struct in_ifaddr *ia;
-
- CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
- if (ia->ia_ifp == ifp &&
- prison_check_ip4(cred,
- &ia->ia_addr.sin_addr) == 0)
- break;
- }
- if (ia == NULL)
- return (EADDRNOTAVAIL);
- laddr = ia->ia_addr.sin_addr;
- error = 0;
- }
if (error)
return (error);
} else
@@ -1231,6 +1208,27 @@
if (!prison_saddrsel_ip4(cred, laddr))
return (0);
+ /*
+ * If the destination address is multicast and an outgoing
+ * 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)) && inp->inp_moptions != NULL &&
+ inp->inp_moptions->imo_multicast_ifp != NULL) {
+ struct ifnet *ifp = inp->inp_moptions->imo_multicast_ifp;
+ struct in_ifaddr *ia;
+
+ CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
+ if (ia->ia_ifp == ifp &&
+ prison_check_ip4(cred, &ia->ia_addr.sin_addr) == 0)
+ break;
+ }
+ if (ia == NULL)
+ return (EADDRNOTAVAIL);
+ *laddr = ia->ia_addr.sin_addr;
+ return (0);
+ }
+
error = 0;
nh = NULL;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 11:07 AM (1 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28469047
Default Alt Text
D49435.id152493.diff (1 KB)
Attached To
Mode
D49435: inpcb: push multicast case local address selection logic into in_pcbladdr()
Attached
Detach File
Event Timeline
Log In to Comment