From owner-freebsd-current Sat Dec 13 11:30:09 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id LAA09544 for current-outgoing; Sat, 13 Dec 1997 11:30:09 -0800 (PST) (envelope-from owner-freebsd-current) Received: from zed.ludd.luth.se (zed.ludd.luth.se [130.240.16.33]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id LAA09539 for ; Sat, 13 Dec 1997 11:30:01 -0800 (PST) (envelope-from gozer@ludd.luth.se) Received: from brother.ludd.luth.se (gozer@brother.ludd.luth.se [130.240.16.78]) by zed.ludd.luth.se (8.8.5/8.8.5) with SMTP id UAA06605; Sat, 13 Dec 1997 20:29:49 +0100 Date: Sat, 13 Dec 1997 20:29:48 +0100 (MET) From: Johan Larsson To: Pierre Beyssac cc: freebsd-current@FreeBSD.ORG Subject: Re: small patch to fix MSG_COMPAT in recvfrom() In-Reply-To: <19971213181809.AU40295@@> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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/ +-+-+-+-+-+-+-+-+ *