Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102105530
D39215.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
D39215.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
@@ -707,6 +707,9 @@
struct in6_addr *laddr6, *faddr6;
#endif
+ KASSERT(fsa == NULL || fsa->sa_family == lsa->sa_family,
+ ("%s: address family mismatch", __func__));
+
pcbinfo = inp->inp_pcbinfo;
/*
@@ -746,22 +749,31 @@
#ifdef INET
laddr.s_addr = INADDR_ANY; /* used by INET6+INET below too */
- if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) {
- if (lsa != NULL)
- laddr = ((struct sockaddr_in *)lsa)->sin_addr;
- if (fsa != NULL)
- faddr = ((struct sockaddr_in *)fsa)->sin_addr;
- }
#endif
#ifdef INET6
laddr6 = NULL;
- if ((inp->inp_vflag & INP_IPV6) != 0) {
- if (lsa != NULL)
+#endif
+
+ if (lsa != NULL) {
+#ifdef INET
+ if (lsa->sa_family == AF_INET)
+ laddr = ((struct sockaddr_in *)lsa)->sin_addr;
+#endif
+#ifdef INET6
+ if (lsa->sa_family == AF_INET6)
laddr6 = &((struct sockaddr_in6 *)lsa)->sin6_addr;
- if (fsa != NULL)
- faddr6 = &((struct sockaddr_in6 *)fsa)->sin6_addr;
+#endif
}
+ if (fsa != NULL) {
+#ifdef INET
+ if (fsa->sa_family == AF_INET)
+ faddr = ((struct sockaddr_in *)fsa)->sin_addr;
#endif
+#ifdef INET6
+ else if (fsa->sa_family == AF_INET6)
+ faddr6 = &((struct sockaddr_in6 *)fsa)->sin6_addr;
+#endif
+ }
tmpinp = NULL;
lport = *lportp;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 4:32 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14538585
Default Alt Text
D39215.diff (1 KB)
Attached To
Mode
D39215: netinet: Fix sockaddr type confusion in_pcb_lport_dest()
Attached
Detach File
Event Timeline
Log In to Comment