diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-06 14:20:10 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-06 14:20:10 +0000 |
commit | 219c81c4f6abd5217ce0ed0fc6c58f15ded1b83f (patch) | |
tree | 6a247b0bda54ce644e1257d3bc730d059d305dde /ext | |
parent | 40fee94577535e58810d39c7cb522a3551ea435a (diff) | |
download | perl-219c81c4f6abd5217ce0ed0fc6c58f15ded1b83f.tar.gz |
Document the bad assumptions currently breaking
the Socket.t tests 10, 11, and 13 in UNICOS.
p4raw-id: //depot/perl@11919
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Socket/Socket.xs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index b048e59d62..ba8c221452 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -217,6 +217,33 @@ inet_ntoa(ip_address_sv) if (DO_UTF8(ip_address_sv) && !sv_utf8_downgrade(ip_address_sv, 1)) croak("Wide character in Socket::inet_ntoa"); ip_address = SvPV(ip_address_sv,addrlen); + /* Bad assumptions here. + * + * Bad Assumption 1: struct in_addr has no other fields than + * the s_addr (which is the field we really care about here). + * + * Bad Assumption 2: the s_addr field is the first field + * in struct in_addr (the Copy() assumes that). + * + * Bad Assumption 3: the s_addr field is a simple type + * (such as an int). It can be a bit field, in which + * case using & (address-of) on it or taking sizeof() + * wouldn't go over too well. (Those are not attempted + * now but in case someone thinks to fix the below uses + * of addr (both in the length check and the Copy()) + * by using addr.s_addr. + * + * These bad assumptions currently break UNICOS which has + * struct in_addr struct { u_long st_addr:32; } s_da; + * #define s_addr s_da.st_addr + * + * and u_long is 64 bits. + * + * The bold soul attempting to fix this should also + * fix pack_sockaddr_in() to agree. + * + * --jhi + */ if (addrlen != sizeof(addr)) { croak("Bad arg length for %s, length is %d, should be %d", "Socket::inet_ntoa", |