svn commit: r219779 - head/sys/netinet
Bjoern A. Zeeb
bz at FreeBSD.org
Sun Mar 20 09:08:59 UTC 2011
On Sat, 19 Mar 2011, Bjoern A. Zeeb wrote:
> Author: bz
> Date: Sat Mar 19 19:08:54 2011
> New Revision: 219779
> URL: http://svn.freebsd.org/changeset/base/219779
>
> Log:
> 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.
For your information and future reference:
UDP and TCP come in with flags set differently for the 6 cases. The
only conistent one is IPv4 only. v4-mapped v6 is the trouble maker.
So while this one fixed the panic with plain IPv6 and v4-mapped
enabled, it actually broke udp on v4-mapped as further investigation
has shown. I am working on regression tests as well as harmonizing
the initial calls setting the flags and documenting things (and
obviously fixing that one case as well;)
/bz
> Reported by: Pawel Worach (pawel.worach gmail.com)
> Tested by: Pawel Worach (pawel.worach gmail.com)
> MFC after: 6 days
> X-MFC with: r219579
>
> Modified:
> head/sys/netinet/in_pcb.c
>
> Modified: head/sys/netinet/in_pcb.c
> ==============================================================================
> --- head/sys/netinet/in_pcb.c Sat Mar 19 18:26:54 2011 (r219778)
> +++ head/sys/netinet/in_pcb.c Sat Mar 19 19:08:54 2011 (r219779)
> @@ -387,7 +387,7 @@ in_pcb_lport(struct inpcb *inp, struct i
> #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 i
> } 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;
>
--
Bjoern A. Zeeb You have to have visions!
Stop bit received. Insert coin for new address family.
More information about the svn-src-head
mailing list