bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ioctl-patch for Darwin and FreeBSD


From: Markus Gothe
Subject: Re: ioctl-patch for Darwin and FreeBSD
Date: Tue, 22 Feb 2011 23:11:37 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22 Feb, 2011, at 22:53 , Eric Blake wrote:

> [re-adding the list]
> [please don't top-post on technical lists]
> 
> On 02/22/2011 02:14 PM, Markus Gothe wrote:
>> The issue is with PIMd-NG (http://pimd-ng.sf.net).
> ...
> 
> I'm not sure if you emailed me privately because of sensitive content in
> your email, but hopefully I've trimmed enough of your content to avoid
> risking any public exposure of a security issue, if that was your intent
> behind mailing just me instead of the list.
> 
>> 
>> For some reason FreeBSD chose 'unsigned long' for the request part instead 
>> of the 'signed int'-POSIX variant argument to ioctl().
> 
> We know.  And the configure test should be detecting that, as well as
> letting rpl_ioctl work around that.
> 
> Maybe the real problem is that we need to ensure that our replacement
> does not do sign extension.  Does this patch fix your issue?
> 
> diff --git i/lib/ioctl.c w/lib/ioctl.c
> index 72f9f37..3ed4327 100644
> --- i/lib/ioctl.c
> +++ w/lib/ioctl.c
> @@ -37,7 +37,11 @@ rpl_ioctl (int fd, int request, ... /* {void *,char
> *} arg */)
>   buf = va_arg (args, void *);
>   va_end (args);
> 
> -  return ioctl (fd, request, buf);
> +  /* Generally, this replacement function is in effect when the system
> +     ioctl expects unsigned long int.  If request has the most
> +     significant bit set, then we need to make sure that
> +     sign-extension does not come into play.  */
> +  return ioctl (fd, (unsigned long) request, buf);
> }
> 
> #else /* mingw */
> 
> 
Unfortunately it doesn't work.

This is with the POSIX declaration of ioctl():

./igmpproxyd 
ioctl: Operation not supported on socket
1:0:e5:10:80:3
01:00:E5:10:80:03
tap0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 01:00:e5:10:80:03 

and this is with the ordinary sys/ioctl.h on Darwin:

./igmpproxyd 
ioctl: Operation not permitted
ioctl: Operation not permitted
6a:c2:d0:e6:50:11
6A:C2:D0:E6:50:11
tap0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 6a:c2:d0:e6:50:11 

//Markus
> 
> -- 
> Eric Blake   address@hidden    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)

iD8DBQFNZDSf6I0XmJx2NrwRAnvlAKDEo+A8srLdIGaJdqXFXHNlkVxqAACguf9x
gVsjmw1HcYsnWrFPSblCoWc=
=4qRZ
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]