Properly check for an IPv4 socket after r219579.
In some cases as udp6_connect() without an earlier bind(2) to an address, v4-mapped scokets allowed and a non mapped destination address, we can end up here with both v4 and v6 indicated: inp_vflag = (INP_IPV4|INP_IPV6|INP_IPV6PROTO) In that case however laddrp is NULL as the IPv6 path does not pass in a copy currently. Reported by: Pawel Worach (pawel.worach gmail.com) Tested by: Pawel Worach (pawel.worach gmail.com) MFC after: 6 days X-MFC with: r219579
This commit is contained in:
parent
9dffdca01d
commit
7b8d9ca423
@ -387,7 +387,7 @@ in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp,
|
||||
#ifdef INET
|
||||
/* Make the compiler happy. */
|
||||
laddr.s_addr = 0;
|
||||
if ((inp->inp_vflag & INP_IPV4) != 0) {
|
||||
if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) {
|
||||
KASSERT(laddrp != NULL, ("%s: laddrp NULL for v4 inp %p",
|
||||
__func__, inp));
|
||||
laddr = *laddrp;
|
||||
@ -423,7 +423,7 @@ in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp,
|
||||
} while (tmpinp != NULL);
|
||||
|
||||
#ifdef INET
|
||||
if ((inp->inp_vflag & INP_IPV4) != 0)
|
||||
if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4)
|
||||
laddrp->s_addr = laddr.s_addr;
|
||||
#endif
|
||||
*lportp = lport;
|
||||
|
Loading…
x
Reference in New Issue
Block a user