This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Re: IP_MULTICAST_IF et all / Winsock[2] value conflict


On Fri, 30 Sep 2005, Corinna Vinschen wrote:
> On Sep 30 10:07, Brian Ford wrote:
> > We can simply translate the current constant Winsock 1 values to Winsock 2
> > ones when necessary in cygwin_[set|get]sockopt.  There are only 8 values
> > that need changing, I think.
>
> Yeah, I think that we can basically do something like this.  But we
> should not try to guess what the application really meant to do
> based on the incoming value and the winsock version in use.

Why not?  There is no guessing involved if we do not change Cygwin's
system headers.  If someone used a Windows header directly and called the
Cygwin [set|get]sockopt, well then..., that's their fault.

> Actually we have two states, applications built before we changed the
> header file and applications built after we changed the header file.

Let's just not change it ;-).

> This is visible by an internal version number maintained by Cygwin.

Ok, I'm not aware of how that works.

> The problem is that the value can be simply wrong today, because the
> application is built against the old (wrong) header file, but running
> under a Cygwin which is run-time loading Winsock2.  Anyway, the idea
> to convert the incoming values based on some internal information is
> a good one.

Ok, here's an untested (as yet) patch:

2005-09-30  Brian Ford  <Brian.Ford@FlightSafety.com>

	* net.cc (ws2ip_optname): New function to convert IP_* socket
	options from Winsock 1.1 values to Winsock 2 ones.
	(cygwin_setsockopt): Use it.
	(cygwin_getsockopt): Likewise.

> I want to drop Winsock1 support nevertheless.  It only complicates the
> code and has no real gain.

I think I'll let you handle that one ;-).

> Yup, that's something for 1.5.20 or, more likely 1.5.21.  We can discuss
> implementation details on cygwin-developers.

I was hoping this would be simple enough that it might make it in before,
but it's obviously up to you and cgf to decide.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

Attachment: winsock2_IP_sockopt.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]