Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jul 2002 18:39:02 +0200 (CEST)
From:      Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
Subject:   kern/40558: UDP6 sockets do not receive responses of sendto to IPv4mapped address
Message-ID:  <200207141639.g6EGd2Jv092933@luna.imag.fr>

next in thread | raw e-mail | index | archive | help

>Number:         40558
>Category:       kern
>Synopsis:       UDP6 sockets do not receive responses of sendto to IPv4mapped address
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 14 09:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Luc Richier
>Release:        FreeBSD 4.6-RELEASE i386
>Organization:
LSR-IMAG, Grenoble, France
>Environment:
System: FreeBSD luna.imag.fr 4.6-RELEASE FreeBSD 4.6-RELEASE #6: Wed Jun 12 18:55:37 GMT 2002 richier@luna.imag.fr:/usr/src/sys/compile/VLAN i386
	also FreeBSD current (June, 24 2002)
	and KAME FreeBSD (kame-20020708-freebsd46-snap.tgz)
Description:
	An UDP PF_INET6 socket which is implicitely binded using sento to
	an IPv6 IPv4mapped address (::FFFF:x.y.z.t) will not receive the
	IPv4 packets sent in response
How-To-Repeat:
	+ On a machine with IPv4 address x.y.z.t, validate the udp4 echo service
		in /etc/inetd.conf

	+ Write and execute the following test program:
	- s = socket(PF_INET6, SOCK_DGRAM, 0);
	- getaddrinfo("0:ffff:x.y.z.t","echo", &hints, &res);
	- sento(s, "data", 4, 0, res->ai_addr, res->ai_addrlen);
	- recvfrom(s, buf, sizeof buf, 0, (struct sockaddr *)&from, &fromlen);

	The recvfrom will not receives any packet

Fix:
	The bug is the udp sendto code. INET6 sendto udp code does not set
	the INP_IPV4 flag on the inpcb of the socket. Therefore the received
	IPv4 packets are not matched against this pcb.

	To correct apply the following patch:

--- /sys/netinet6/udp6_usrreq.c.DIST	Sun Apr 28 07:40:27 2002
+++ /sys/netinet6/udp6_usrreq.c	Wed May 29 19:23:23 2002
@@ -713,6 +713,7 @@
 
 			if (sin6)
 				in6_sin6_2_sin_in_sock(addr);
+			inp->inp_vflag |= INP_IPV4;
 			pru = inetsw[ip_protox[IPPROTO_UDP]].pr_usrreqs;
 			error = ((*pru->pru_send)(so, flags, m, addr, control,
 						  p));

>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207141639.g6EGd2Jv092933>