Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Dec 1997 20:29:48 +0100 (MET)
From:      Johan Larsson <gozer@ludd.luth.se>
To:        Pierre Beyssac <pb@fasterix.freenix.org>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: small patch to fix MSG_COMPAT in recvfrom()
Message-ID:  <Pine.SUN.3.95.971213202635.21177A-100000@brother.ludd.luth.se>
In-Reply-To: <19971213181809.AU40295@@>

next in thread | previous in thread | raw e-mail | index | archive | help
YES! Thank you soooo much. This solved the problem i've had with
WordPerfect (long++ startup time), and rvplayer now works like a charm
(well, the best it can do ;). I haven't had time to check anything else,
but this should be commited yesterday ;) (if there's no major faults in it
:) 

	Johan

On Sat, 13 Dec 1997, Pierre Beyssac wrote:

> Hello,
> 
> Could someone check this and possibly commit it to -current if it
> is correct?
> 
> It seems to fix a bug with orecvfrom() or recvfrom() called with
> the MSG_COMPAT flag on kernels compiled with the COMPAT_43 option.
> The symptom is that the fromaddr is not correctly returned.
> 
> This affects the Linux emulator.
> 
> I also have several other patches regarding the use of sockets by
> the Linux emulator, notably getsockopt(), raw sockets, and the
> IP_HDRINCL option which Linux handles differently from BSD in a
> subtle way. It allows me to run Linux ping, traceroute, and other
> small network "utilities" compiled on Linux such as teardrop.
> Should I send these patches to the list or to the Linux emulator
> maintainer?
> 
> --- /sys/kern/uipc_syscalls.c.orig	Tue Dec  9 01:42:58 1997
> +++ /sys/kern/uipc_syscalls.c	Sat Dec 13 18:05:46 1997
> @@ -699,17 +699,18 @@
>  		len = mp->msg_namelen;
>  		if (len <= 0 || fromsa == 0)
>  			len = 0;
>  		else {
> +#ifndef MIN
> +#define MIN(a,b) ((a)>(b)?(b):(a))
> +#endif
> +			/* save sa_len before it is destroyed by MSG_COMPAT */
> +			len = MIN(len, fromsa->sa_len);
>  #ifdef COMPAT_OLDSOCK
>  			if (mp->msg_flags & MSG_COMPAT)
>  				((struct osockaddr *)fromsa)->sa_family =
>  				    fromsa->sa_family;
>  #endif
> -#ifndef MIN
> -#define MIN(a,b) ((a)>(b)?(b):(a))
> -#endif
> -			len = MIN(len, fromsa->sa_len);
>  			error = copyout(fromsa,
>  			    (caddr_t)mp->msg_name, (unsigned)len);
>  			if (error)
>  				goto out;
> -- 
> Pierre Beyssac	      pb@fasterix.frmug.org pb@fasterix.freenix.org
> {Free,Net,Open}BSD, Linux : il y a moins bien, mais c'est plus cher
>     Free domains: http://www.eu.org/ or mail dns-manager@EU.org
> 
> 

-- 
  * mailto:gozer@ludd.luth.se * http://www.ludd.luth.se/users/gozer/ *
  * Powered by FreeBSD. http://www.se.freebsd.org/ +-+-+-+-+-+-+-+-+ *




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.95.971213202635.21177A-100000>