The following change
revision 1.155 date: 2004/09/07 20:47:03; author: julliard; state: Exp; lines: +113 -0 Roderick Colenbrander thunderbird2k@gmx.net - set ipx packet type - add support for retrieving some ipx info
breaks FreeBSD 4.10 quite a bit:
/sw/gcc-3.3.4/bin/gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -DUSE_WS_PREFIX -D_REENTRANT -fPIC -Wall -pipe -mpreferred-stack-boundary=2 -fno-strict-aliasing -gstabs+ -Wpointer-arith -g -O2 -o socket.o socket.c socket.c: In function `WS2_send': socket.c:1120: error: `SOL_IPX' undeclared (first use in this function) socket.c:1120: error: (Each undeclared identifier is reported only once socket.c:1120: error: for each function it appears in.) socket.c:1120: error: `IPX_TYPE' undeclared (first use in this function) socket.c:1123: error: structure has no member named `sipx_type' socket.c: In function `WS_getsockopt': socket.c:1585: error: `SOL_IPX' undeclared (first use in this function) socket.c:1585: error: `IPX_TYPE' undeclared (first use in this function) socket.c: In function `WS_setsockopt': socket.c:2312: error: `SOL_IPX' undeclared (first use in this function) socket.c:2312: error: `IPX_TYPE' undeclared (first use in this function) gmake: *** [socket.o] Error 1
Concerning the error in socket.c, line 1120, SOL_IPX is not defined on FreeBSD 4.10, but there is a constant SOL_SOCKET which is supposed to be passed as the second parameter of getsockopt with the following description: "To manipulate options at the socket level, level is specified as SOL_SOCKET". Would that do the job?
Concerning the error in socket.c, line 1123, struct sockaddr_ipx looks as follows on FreeBSD 4.10:
struct sockaddr_ipx { u_char sipx_len; u_char sipx_family; struct ipx_addr sipx_addr; char sipx_zero[2]; };
Finally, I could not find anything remotely similiar to IPX_TYPE.
I hope this will allow you to fix this breakage? (To check for FreeBSD, you can use #ifdef __FreeBSD_...)
Thanks, Gerald
Hi,
The problem is like this. In case of the ipx protocol you can select different ipx types of ipx packets. On linux there's an entry in the sockaddr_ipx struct in which you can change and further you can change it at the ipx socket level using that SOL_IPX stuff. I wasn't aware that this stuff doesn't exist on freebsd. Unfortunately I don't have any freebsd experience, so I don't know about the way to do it on your OS. I will try to find a solution, if none can be found I'm affraight we need some #ifdef stuff.
Thanks,
Roderick
On Thursday 09 September 2004 14:55, you wrote:
The following change
revision 1.155 date: 2004/09/07 20:47:03; author: julliard; state: Exp; lines: +113 -0 Roderick Colenbrander thunderbird2k@gmx.net
- set ipx packet type
- add support for retrieving some ipx info
breaks FreeBSD 4.10 quite a bit:
/sw/gcc-3.3.4/bin/gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -DUSE_WS_PREFIX -D_REENTRANT -fPIC -Wall -pipe -mpreferred-stack-boundary=2 -fno-strict-aliasing -gstabs+ -Wpointer-arith -g -O2 -o socket.o socket.c socket.c: In function `WS2_send': socket.c:1120: error: `SOL_IPX' undeclared (first use in this function) socket.c:1120: error: (Each undeclared identifier is reported only once socket.c:1120: error: for each function it appears in.) socket.c:1120: error: `IPX_TYPE' undeclared (first use in this function) socket.c:1123: error: structure has no member named `sipx_type' socket.c: In function `WS_getsockopt': socket.c:1585: error: `SOL_IPX' undeclared (first use in this function) socket.c:1585: error: `IPX_TYPE' undeclared (first use in this function) socket.c: In function `WS_setsockopt': socket.c:2312: error: `SOL_IPX' undeclared (first use in this function) socket.c:2312: error: `IPX_TYPE' undeclared (first use in this function) gmake: *** [socket.o] Error 1
Concerning the error in socket.c, line 1120, SOL_IPX is not defined on FreeBSD 4.10, but there is a constant SOL_SOCKET which is supposed to be passed as the second parameter of getsockopt with the following description: "To manipulate options at the socket level, level is specified as SOL_SOCKET". Would that do the job?
Concerning the error in socket.c, line 1123, struct sockaddr_ipx looks as follows on FreeBSD 4.10:
struct sockaddr_ipx { u_char sipx_len; u_char sipx_family; struct ipx_addr sipx_addr; char sipx_zero[2]; };
Finally, I could not find anything remotely similiar to IPX_TYPE.
I hope this will allow you to fix this breakage? (To check for FreeBSD, you can use #ifdef __FreeBSD_...)
Thanks, Gerald
I made some more progress with the fix but I'm not fully sure how it works. I checked the freebsd source code to figure out how it works. Compared to the linux source the code was very complicated as in linux there's a special ipx setsockopt option and so on. We have to pass SO_DEFAULT_HEADERS to setsockopt with as option SOPT_GET/SOPT_SET when we want go get/set the packet type. The structure to use is "struct ipx".
Perhaps you can try to build a fix as I don't have access to any FreeBSD box and can't test the patch. Note that in the function ws2_send we don't need to retrieve the ipx packet type as that won't be needed for freebsd as the linux/freebsd ipx sockaddr structure is different.
Regards, Roderick
On Thursday 09 September 2004 15:20, you wrote:
Hi,
The problem is like this. In case of the ipx protocol you can select different ipx types of ipx packets. On linux there's an entry in the sockaddr_ipx struct in which you can change and further you can change it at the ipx socket level using that SOL_IPX stuff. I wasn't aware that this stuff doesn't exist on freebsd. Unfortunately I don't have any freebsd experience, so I don't know about the way to do it on your OS. I will try to find a solution, if none can be found I'm affraight we need some #ifdef stuff.
Thanks,
Roderick
On Thursday 09 September 2004 14:55, you wrote:
The following change
revision 1.155 date: 2004/09/07 20:47:03; author: julliard; state: Exp; lines: +113 -0 Roderick Colenbrander thunderbird2k@gmx.net
- set ipx packet type
- add support for retrieving some ipx info
breaks FreeBSD 4.10 quite a bit:
/sw/gcc-3.3.4/bin/gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -DUSE_WS_PREFIX -D_REENTRANT -fPIC -Wall -pipe -mpreferred-stack-boundary=2 -fno-strict-aliasing -gstabs+ -Wpointer-arith -g -O2 -o socket.o socket.c socket.c: In function `WS2_send': socket.c:1120: error: `SOL_IPX' undeclared (first use in this function) socket.c:1120: error: (Each undeclared identifier is reported only once socket.c:1120: error: for each function it appears in.) socket.c:1120: error: `IPX_TYPE' undeclared (first use in this function) socket.c:1123: error: structure has no member named `sipx_type' socket.c: In function `WS_getsockopt': socket.c:1585: error: `SOL_IPX' undeclared (first use in this function) socket.c:1585: error: `IPX_TYPE' undeclared (first use in this function) socket.c: In function `WS_setsockopt': socket.c:2312: error: `SOL_IPX' undeclared (first use in this function) socket.c:2312: error: `IPX_TYPE' undeclared (first use in this function) gmake: *** [socket.o] Error 1
Concerning the error in socket.c, line 1120, SOL_IPX is not defined on FreeBSD 4.10, but there is a constant SOL_SOCKET which is supposed to be passed as the second parameter of getsockopt with the following description: "To manipulate options at the socket level, level is specified as SOL_SOCKET". Would that do the job?
Concerning the error in socket.c, line 1123, struct sockaddr_ipx looks as follows on FreeBSD 4.10:
struct sockaddr_ipx { u_char sipx_len; u_char sipx_family; struct ipx_addr sipx_addr; char sipx_zero[2]; };
Finally, I could not find anything remotely similiar to IPX_TYPE.
I hope this will allow you to fix this breakage? (To check for FreeBSD, you can use #ifdef __FreeBSD_...)
Thanks, Gerald
On Thu, 9 Sep 2004, Roderick Colenbrander wrote:
I made some more progress with the fix but I'm not fully sure how it works. I checked the freebsd source code to figure out how it works. Compared to the linux source the code was very complicated as in linux there's a special ipx setsockopt option and so on. [...] Perhaps you can try to build a fix as I don't have access to any FreeBSD box and can't test the patch. Note that in the function ws2_send we don't need to retrieve the ipx packet type as that won't be needed for freebsd as the linux/freebsd ipx sockaddr structure is different.
The problem is, I don't know anything about IPX in general nor IPX on Windows or FreeBSD :-(, else I really would have tried to fix this.
(This is why I tried to describe the FreeBSD situation as far as I could find out from an installation in my original message.)
If you could provide a prototype path, I'd be most happy to give it a try and will also try to tweak it as good as I can, if needed.
Gerald
Hi,
Currently I don't have access to the machine I use for wine stuff, so I haven't been able to create a real patch. Anyway I'll try to assist you fixing the problem as it isn't that difficult to fix.
There are three places that break Wine on FreeBSD: - WS2_Send - WS_getsockopt - WS_setsockopt
First the code in ws2_send isn't relevant to FreeBSD as the ipx sockaddr structures are different in case of Linux and FreeBSD. Just add #ifdefs or whatever Alexandre likes the most.
Next there are the WS_getsockopt/setsockopt functions. In the getsockopt fuction we need to retrieve the ipx packet type and we do the opposite in setsockopt. The code that you need to place in both functions looks something like this:
//getsockopt code struct ipx val; getsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); *opt_val = (int)val.ipx_pt;
//setsockopt code struct ipx val; (perhaps we should retrieve this one using a getsockopt call and then we set modified one) val.ipx_pt = *opt_val; setsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); *opt_val = (int)val.ipx_pt;
I hope this helps.
Roderick
On Saturday 11 September 2004 19:36, Gerald Pfeifer wrote:
On Thu, 9 Sep 2004, Roderick Colenbrander wrote:
I made some more progress with the fix but I'm not fully sure how it works. I checked the freebsd source code to figure out how it works. Compared to the linux source the code was very complicated as in linux there's a special ipx setsockopt option and so on. [...] Perhaps you can try to build a fix as I don't have access to any FreeBSD box and can't test the patch. Note that in the function ws2_send we don't need to retrieve the ipx packet type as that won't be needed for freebsd as the linux/freebsd ipx sockaddr structure is different.
The problem is, I don't know anything about IPX in general nor IPX on Windows or FreeBSD :-(, else I really would have tried to fix this.
(This is why I tried to describe the FreeBSD situation as far as I could find out from an installation in my original message.)
If you could provide a prototype path, I'd be most happy to give it a try and will also try to tweak it as good as I can, if needed.
Gerald
[ Adding wine-patches. Alexandre, this is for you! ]
On Sun, 12 Sep 2004, Roderick Colenbrander wrote:
Currently I don't have access to the machine I use for wine stuff, so I haven't been able to create a real patch. Anyway I'll try to assist you fixing the problem as it isn't that difficult to fix.
This is most welcome. Thanks a lot, I really appreciate your help!
//setsockopt code struct ipx val; (perhaps we should retrieve this one using a getsockopt call and then we set modified one) val.ipx_pt = *opt_val; setsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); *opt_val = (int)val.ipx_pt;
I hope this helps.
The last line of code was only a trick to see whether I'm paying attention, wasn't it? ;-)
I added a bit of error checking, similiar to the general case, and guarded variables by #ifdefs as well. Current winehq.com CVS plus the following patch was built on FreeBSD 4.10 and SUSE LINUX 9.1.
Thanks again, Gerald
ChangeLog: Roderick Colenbrander thunderbird2k@gmx.net Gerald Pfeifer gerald@pfeifer.com Make WS2_Send(), WS_getsockopt(), and WS_setsockopt() work on FreeBSD.
Index: socket.c =================================================================== RCS file: /home/wine/wine/dlls/winsock/socket.c,v retrieving revision 1.155 diff -u -3 -p -r1.155 socket.c --- socket.c 7 Sep 2004 20:47:03 -0000 1.155 +++ socket.c 12 Sep 2004 21:19:09 -0000 @@ -1108,6 +1108,7 @@ static int WS2_send ( int fd, struct iov #ifdef HAVE_IPX if(to->sa_family == WS_AF_IPX) { +#ifndef __FreeBSD__ struct sockaddr_ipx* uipx = (struct sockaddr_ipx*)hdr.msg_name; int val=0; int len=sizeof(int); @@ -1122,6 +1123,7 @@ static int WS2_send ( int fd, struct iov TRACE("ptype: %d (fd:%d)\n", val, fd); uipx->sipx_type = val; } +#endif } #endif
@@ -1574,6 +1576,10 @@ INT WINAPI WS_getsockopt(SOCKET s, INT l #ifdef HAVE_IPX if(level == NSPROTO_IPX) { +#ifdef __FreeBSD__ + struct ipx val; + socklen_t len=sizeof(struct ipx); +#endif struct WS_sockaddr_ipx addr; IPX_ADDRESS_DATA *data; int namelen; @@ -1581,11 +1587,20 @@ INT WINAPI WS_getsockopt(SOCKET s, INT l { case IPX_PTYPE: fd = get_sock_fd( s, 0, NULL ); - +#ifdef __FreeBSD__ + + if(getsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, &len) + == -1 ) + { + return SOCKET_ERROR; + } + *optval = (int)val.ipx_pt; +#else if(getsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) { return SOCKET_ERROR; } +#endif TRACE("ptype: %d (fd: %d)\n", *(int*)optval, fd); release_sock_fd( s, fd );
@@ -2305,18 +2320,30 @@ int WINAPI WS_setsockopt(SOCKET s, int l switch(optname) { case IPX_PTYPE: + { +#ifdef __FreeBSD__ + struct ipx val; +#endif fd = get_sock_fd( s, 0, NULL ); TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(int*)optval, fd);
/* We try to set the ipx type on ipx socket level. */ +#ifdef __FreeBSD__ + /* Should we retrieve val using a getsockopt call and then + * set the modified one? */ + val.ipx_pt = *optval; + setsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); +#else if(setsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) { ERR("IPX: could not set ipx option type; expect weird behaviour\n"); return SOCKET_ERROR; } +#endif release_sock_fd( s, fd ); return 0; break; + } case IPX_FILTERPTYPE: /* Sets the receive filter packet type, at the moment we don't support it */ FIXME("IPX_FILTERPTYPE: %x\n", *optval);
Gerald Pfeifer gerald@pfeifer.com writes:
ChangeLog: Roderick Colenbrander thunderbird2k@gmx.net Gerald Pfeifer gerald@pfeifer.com Make WS2_Send(), WS_getsockopt(), and WS_setsockopt() work on FreeBSD.
You shouldn't use #ifdef __FreeBSD__ for that, you should check for the actual features (for instance #ifdef SOL_IPX etc.), possibly adding configure checks if needed.
On Mon, 13 Sep 2004, Alexandre Julliard wrote:
You shouldn't use #ifdef __FreeBSD__ for that, you should check for the actual features (for instance #ifdef SOL_IPX etc.), possibly adding configure checks if needed.
You're right. Tested on FreeBSD 4.10 as well as SUSE Linux 9.1.
Gerald
ChangeLog: Roderick Colenbrander thunderbird2k@gmx.net Gerald Pfeifer gerald@pfeifer.com Make WS2_Send(), WS_getsockopt(), and WS_setsockopt() work on FreeBSD. Index: socket.c =================================================================== RCS file: /home/wine/wine/dlls/winsock/socket.c,v retrieving revision 1.155 diff -u -3 -p -r1.155 socket.c --- socket.c 7 Sep 2004 20:47:03 -0000 1.155 +++ socket.c 13 Sep 2004 19:02:20 -0000 @@ -1108,6 +1108,7 @@ static int WS2_send ( int fd, struct iov #ifdef HAVE_IPX if(to->sa_family == WS_AF_IPX) { +#ifdef SOL_IPX struct sockaddr_ipx* uipx = (struct sockaddr_ipx*)hdr.msg_name; int val=0; int len=sizeof(int); @@ -1122,6 +1123,7 @@ static int WS2_send ( int fd, struct iov TRACE("ptype: %d (fd:%d)\n", val, fd); uipx->sipx_type = val; } +#endif } #endif
@@ -1580,17 +1582,33 @@ INT WINAPI WS_getsockopt(SOCKET s, INT l switch(optname) { case IPX_PTYPE: + { +#ifndef SOL_IPX + struct ipx val; + socklen_t len=sizeof(struct ipx); +#endif fd = get_sock_fd( s, 0, NULL ); - + +#ifdef SOL_IPX if(getsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) { return SOCKET_ERROR; } +#else + if(getsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, &len) + == -1 ) + { + return SOCKET_ERROR; + } + *optval = (int)val.ipx_pt; +#endif + TRACE("ptype: %d (fd: %d)\n", *(int*)optval, fd); release_sock_fd( s, fd );
return 0; break; + } case IPX_ADDRESS: /* * On a Win2000 system with one network card there are useally three ipx devices one with a speed of 28.8kbps, 10Mbps and 100Mbps. @@ -2305,18 +2323,31 @@ int WINAPI WS_setsockopt(SOCKET s, int l switch(optname) { case IPX_PTYPE: + { +#ifndef SOL_IPX + struct ipx val; +#endif fd = get_sock_fd( s, 0, NULL ); TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(int*)optval, fd);
/* We try to set the ipx type on ipx socket level. */ +#ifdef SOL_IPX if(setsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) { ERR("IPX: could not set ipx option type; expect weird behaviour\n"); return SOCKET_ERROR; } +#else + /* Should we retrieve val using a getsockopt call and then + * set the modified one? */ + val.ipx_pt = *optval; + setsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); +#endif + release_sock_fd( s, fd ); return 0; break; + } case IPX_FILTERPTYPE: /* Sets the receive filter packet type, at the moment we don't support it */ FIXME("IPX_FILTERPTYPE: %x\n", *optval);