summaryrefslogtreecommitdiff
path: root/ext/Socket/Socket.xs
Commit message (Collapse)AuthorAgeFilesLines
* A clearer layout for the fall-through logic of Socket::inet_aton()Nicholas Clark2011-03-061-6/+10
|
* In inet_aton(), use newSVpvn_flags() instead of sv_newmortal(), sv_setpvn()Nicholas Clark2011-03-061-3/+1
| | | | The API calls are equivalent, but the object code is slightly smaller.
* Minor bugfixes to Socket::getaddrinfoPaul LeoNerd Evans2011-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | Attached are two small bugfixes to getaddrinfo() Please apply, Thanks. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/ From 61fdece8ab9a729206f2633f47e25afd6f05af6a Mon Sep 17 00:00:00 2001 From: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> Date: Mon, 24 Jan 2011 18:58:40 +0000 Subject: [PATCH 2/3] canonname should only be present on the first returned result Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
* Reindent recent IPv6/getaddrinfo code consistently with the rest of the filesPaul "LeoNerd" Evans2011-01-291-147/+147
|
* Use Zero() rather than rely on C99 struct initialiser behaviourPaul "LeoNerd" Evans2011-01-041-1/+3
| | | | Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
* Give a warning if pack_sockaddr_in6 is asked to pack a non-zero scope_id on ↵Paul "LeoNerd" Evans2011-01-031-0/+4
| | | | machines that can't support it
* Use HAS_SIN6_SCOPE_ID rather than glibc version testingPaul "LeoNerd" Evans2011-01-031-5/+5
|
* Implement Socket::getaddrinfo() and Socket::getnameinfo(), with related ↵Paul "LeoNerd" Evans2011-01-031-0/+189
| | | | constants
* Conditionally set sa_len-type fields when packing sockaddr addressesPaul "LeoNerd" Evans2011-01-031-0/+9
|
* [perl #80674] Fix compilation with very old versions of glibcDavid Leadbeater2010-12-161-0/+6
| | | | | | | | | | | __priority_which_t does not exist on glibc 2.1. sin6_scope is not present in the set of kernel headers my copy of glibc 2.1 is using. (The presence of sin6_scope in sockaddr_in6 should maybe be a Configure test.) blead now compiles on a positively ancient box -- although the Socket tests fail.
* fix various compiler warnings from XS codeZefram2010-12-111-1/+1
| | | | | | | | | | | Trivial changes to fix warnings of types * unclear precedence * assignment as conditional * signed/unsigned mixing * unused parameter/variable * value computed not used * wrong argument type for a printf format * variable may be used uninitialised (due to unhandled switch case)
* Implement Socket::pack_sockaddr_in6() and unpack_sockaddr_in6()Paul "LeoNerd" Evans2010-11-251-0/+58
|
* In Socket::inet_ntoa(), use Perl_newSVpvf(), instead of sprintf and newSVpvn*.Nicholas Clark2010-10-251-9/+5
|
* Fix perl build problems on Stratus VOSPaul Green2010-10-031-12/+37
| | | | | | | | | | | | | | | | | | The attached text files contain patches to correct build problems on the Stratus VOS (recently renamed "OpenVOS") operating system. I have tested these changes on OpenVOS Release 17.0, which is the most-current customer release. None of these changes should affect any other OS. Makefile.SH: This patch removes the "miniperl" dependency of the "all" target. On an operating system that does not require an executable suffix, the miniperl$(EXE_EXT) dependency evaluates to "miniperl", too. But on an operating system like VOS that does have an executable suffix, miniperl$(EXE_EXT) evaluates to (in our case) "miniperl.pm" and the "miniperl" target is unresolved. ext/Socket/Socket.xs: Sadly, OpenVOS does not yet support IPv6. I edited the code to allow for this case, while retaining IPv6 support for operating systems that do support it.
* In Socket.xs, convert 3 croak()s to use %s and a constant string for the name.Nicholas Clark2010-04-241-3/+4
| | | | | This actually saves space, because xsubpp has to use each XS function's full name as a constant string to pass to newXS(), so any re-use of it is free.
* Make the new Socket implementation of inet_pton consistent with the existing ↵Jesse Vincent2010-02-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Socket6 implementation of inet_pton. Fix for release-blocking ticket [perl #72884] > |https://rt.cpan.org/Ticket/Display.html?id=52497|4411113f|NJH/IO-Socket-Multicast6-0.03.tar.gz | I'll describe what's happening here, and leave it to everyone else to decide which of the interacting events is the bug, or where the fix might be. So the *entire* change is this: commit 4411113f31b3f00171bb335092b02104d29d7cd7 Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com> Date: Fri Mar 27 13:19:16 2009 +0100 Add inet_pton and inet_ntop to the list of functions exported by Socket diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index 6b268ef..7d130ba 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -198,6 +198,7 @@ use XSLoader (); @ISA = qw(Exporter); @EXPORT = qw( inet_aton inet_ntoa + inet_pton inet_ntop sockaddr_family pack_sockaddr_in unpack_sockaddr_in pack_sockaddr_un unpack_sockaddr_un and test fails like this: $ /home/nick/Sandpit/snap5.9.x-v5.11.4-85-g95c9bfa/bin/perl5.11.4 -Mblib t/35mcastsend.t 1..11 Constant subroutine IO::Socket::Multicast6::AF_INET6 redefined at /home/nick/Sandpit/snap5.9.x-v5.11.4-85-g95c9bfa/lib/perl5/5.11.4/Exporter.pm line 64. at /home/nick/.cpan/build/IO-Socket-Multicast6-0.03-CqGAYT/blib/lib/IO/Socket/Multicast6.pm line 10 Prototype mismatch: sub IO::Socket::Multicast6::AF_INET6 () vs none at /home/nick/Sandpit/snap5.9.x-v5.11.4-85-g95c9bfa/lib/perl5/5.11.4/Exporter.pm line 64. at /home/nick/.cpan/build/IO-Socket-Multicast6-0.03-CqGAYT/blib/lib/IO/Socket/Multicast6.pm line 10 Constant subroutine IO::Socket::Multicast6::PF_INET6 redefined at /home/nick/Sandpit/snap5.9.x-v5.11.4-85-g95c9bfa/lib/perl5/5.11.4/Exporter.pm line 64. at /home/nick/.cpan/build/IO-Socket-Multicast6-0.03-CqGAYT/blib/lib/IO/Socket/Multicast6.pm line 10 Prototype mismatch: sub IO::Socket::Multicast6::PF_INET6 () vs none at /home/nick/Sandpit/snap5.9.x-v5.11.4-85-g95c9bfa/lib/perl5/5.11.4/Exporter.pm line 64. at /home/nick/.cpan/build/IO-Socket-Multicast6-0.03-CqGAYT/blib/lib/IO/Socket/Multicast6.pm line 10 ok 1 - use IO::Socket::Multicast6; ok 2 - Create IPv4 multicast socket ok 3 - Combined IPv4 destination address and port ok 4 - Separate IPv4 destination address and port Bad arg length for Socket::pack_sockaddr_in, length is 16, should be 4 at t/35mcastsend.t line 26. The warnings aren't actually really relevant. The "problem"s are: IO::Socket::Multicast6 isa IO::Socket::INET6 IO::Socket::INET6 isa IO::Socket so they chose to inherit all behaviour from IO::Socket. In turn IO::Socket isa IO::Handle isa Exporter. IO::Socket chooses to export everything that Socket does: sub import { my $pkg = shift; if (@_ && $_[0] eq 'sockatmark') { # not very extensible but for now, fast Exporter::export_to_level('IO::Socket', 1, $pkg, 'sockatmark'); } else { my $callpkg = caller; Exporter::export 'Socket', $callpkg, @_; } } So, this means that all those choices and delegation of behaviour (and responsibility) means that all those modules export whatever Socket exports. OO modules. So, now they also export inet_pton and inet_ntop. The test is careful to only import what it needs: use strict; use Socket6 qw/ inet_pton pack_sockaddr_in6/; use Socket qw/ pack_sockaddr_in /; use Test::More tests => 11; in particular, it wants inet_pton from Socket6, and only pack_sockaddr_in from Socket. So at that point, main::inet_pton is Socket6::inet_pton Then it does this, correctly in a BEGIN block: BEGIN { use_ok( 'IO::Socket::Multicast6' ); } The side effect of this is to import all exports from IO::Socket::Multicast6. Which, from the above chain of inheritance, is @Socket::EXPORT. So at this point, main::inet_pton is rebound to Socket::inet_pton And the test fails, because they differ, and it expected (and wanted) Socket6::inet_pton(). Socket6::inet_pton() returns 4 bytes for AF_INET, 16 bytes for AF_INET6. Socket::inet_pton() returns 16 for both. Socket::pack_sockaddr_in() wants 4 bytes. Now, to add to the fun: use IO::Socket::Multicast6 (); and use IO::Socket::Multicast6; of course mean different things. The former suppresses all exports. It turns out that with Test::More::isa_ok() has no way of doing the former: $ cat use_ok.pl use warnings; use strict; use Test::More tests => 3; package clash; BEGIN { main::use_ok 'Socket' }; package crunch; BEGIN { main::use_ok 'Socket', () }; package biff; BEGIN { main::use_ok 'Socket', 'sockaddr_family' }; package main; sub dump_lowercase_keys { my $package = shift; print "For package $package:\n"; no strict 'refs'; print " $_\n" foreach sort grep {!tr/A-Z//} keys %{"${package}::"}; print "\n"; } dump_lowercase_keys $_ foreach qw (clash crunch biff); __END__ $ perl use_ok.pl 1..3 ok 1 - use Socket; ok 2 - use Socket; ok 3 - use Socket; For package clash: inet_aton inet_ntoa pack_sockaddr_in pack_sockaddr_un sockaddr_family sockaddr_in sockaddr_un unpack_sockaddr_in unpack_sockaddr_un For package crunch: inet_aton inet_ntoa pack_sockaddr_in pack_sockaddr_un sockaddr_family sockaddr_in sockaddr_un unpack_sockaddr_in unpack_sockaddr_un For package biff: sockaddr_family So, there's no clean way to rewrite that test with use_ok to suppress imports. So, to summarise, it's due to A cascade of modules blindly exporting everything that Socket exports Socket::inet_pton() and Socket6::inet_pton() differing in behaviour A test that fails to realise that it's importing everything via use_ok This one ranks as blocker because: Socket::inet_pton() and Socket::inet_ntop() are not in any stable release Hence we have the option to change them if we do it *NOW*. I think that the right fix is the appended patch. This makes the new Socket implementation of inet_pton consistent with the existing Socket6 implementation of inet_pton.
* Replace sv_2mortal(newSVpvn(...)) with newSVpvn_flags(..., SVs_TEMP)Nicholas Clark2009-10-151-6/+6
|
* error 1539: Cannot do arithmetic with pointers to objects of unknown size.H.Merijn Brand2009-09-091-2/+2
|
* Fix unpack of abstract socket addrs with nul byteLubomir Rintel2009-08-311-8/+12
| | | | | | | | | | | | | | Addresses of Linux abstract namespace sockets are not nul-terminated C strings, but rather an arbitrary character arrays. According to unix(7) documentation from Linux, "Null bytes in the name have no special significance." unpack_sockaddr_un() was just throwing the initial nul byte away and then treating the rest like ordinary C string when computing the length of the address, which was wrong. This fix utilizes the length of the PV for addresses starting with nul instead. The regression test was extended with check for the problem.
* Add support for Abstract namespace socketsLubomir Rintel2009-08-261-1/+12
| | | | | | | | | | | | Abstract namespace sockets are Linux-specific socket type that live in AF_UNIX family, slightly abusing it to be able to use arbitrary character arrays as addresses: They start with nul byte and are not terminated by nul byte, but with the length passed to the socket() system call. Added regression test for the correct address length computation. Signed-off-by: Lubomir Rintel <lkundrak@fedoraproject.org>
* Fix declaration-after-statement in ext/Socket/Socket.xsAndy Dougherty2009-04-091-1/+2
| | | | | | This trivial patch lets C89-ish compilers compile Socket.c again. Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
* Add inet_pton() and inet_ntop() to Socket.Steve Peters2009-03-261-0/+50
|
* ext/ constingRobin Barker2007-12-221-1/+1
| | | | | | | From: "Robin Barker" <Robin.Barker@npl.co.uk> Message-ID: <46A0F33545E63740BC7563DE59CA9C6D09399D@exchsvr2.npl.ad.local> Date: Sat, 22 Dec 2007 00:39:47 -0000 p4raw-id: //depot/perl@32703
* [perl #42844] careless use of gethostbyname() in Socket.xs kan@dcit.cz2007-05-041-1/+2
| | | | | | From: kan@dcit.cz (via RT) <perlbug-followup@perl.org> Message-ID: <rt-3.6.HEAD-6655-1178036242-364.42844-75-0@perl.org> p4raw-id: //depot/perl@31138
* Coverity is flagging a potential problem because it sees a check forNicholas Clark2006-04-161-4/+1
| | | | | | | | | NULL and assumes that this means that the variable host could be NULL. It can't, and the check added in change 13291 was a little bit more than the minimal solution needed for the bug report [ID 20011126.148] Hence remove the NULL check. p4raw-id: //depot/perl@27851
* Re: janitorial work ? [patch]Jim Cromie2005-07-081-1/+1
| | | | | | | | Message-ID: <42CC3CE9.5050606@divsol.com> (reverted all dual-lived modules since they must work with older perls too so must wait for a new Devel::PPPort) p4raw-id: //depot/perl@25101
* format/casting/warning RE: perl 5.9.1Robin Barker2004-03-171-1/+1
| | | | | Message-ID: <533D273D4014D411AB1D00062938C4D90404682E@hotel.npl.co.uk> p4raw-id: //depot/perl@22521
* Add support for Linux abstract unix domain sockets to Socket.pm.Rafael Garcia-Suarez2003-10-151-9/+14
| | | | | | Based on a idea by Alex Hudson. (Basically those are unix domain sockets whose name has a '\0' as first character.) p4raw-id: //depot/perl@21450
* Ultrix tweaks: <string.h> must not be included twiceJarkko Hietaniemi2003-08-271-1/+1
| | | | | | | (otherwise one gets prototype conflicts between the <string.h> and proto.h because Ultrix thinks e.g. Perl_ninstr has been define in <string.h>...); and Configure misprobes some features. p4raw-id: //depot/perl@20916
* Re: maint @ 20537Philip Newton2003-08-071-3/+3
| | | | | Message-ID: <s0l3jvo4mju2uu4f6pkq18istk02hme6j9@4ax.com> p4raw-id: //depot/perl@20541
* More Ultrix double definition avoidance.Jarkko Hietaniemi2003-05-191-2/+4
| | | p4raw-id: //depot/perl@19569
* Ultrix: the #19435 helped the IO extension, so this shouldJarkko Hietaniemi2003-05-191-1/+3
| | | | | help the Socket extension (socket structs redefinitions). p4raw-id: //depot/perl@19561
* IRIX 5.3 can have PF_LINK defined to be AF_LINK butJarkko Hietaniemi2003-03-291-0/+3
| | | | | not defined AF_LINK. p4raw-id: //depot/perl@19082
* Misc tiny tweaks from Sarathy, good for threaded builds.Jarkko Hietaniemi2002-03-101-2/+3
| | | p4raw-id: //depot/perl@15141
* (was Re: [PATCH @13746] h2xs)Nicholas Clark2002-03-041-2/+2
| | | | | Message-ID: <20020304224837.GA4284@Bagpuss.unfortu.net> p4raw-id: //depot/perl@15023
* offsetof() is in <stddef.h>Nick Ing-Simmons2002-01-161-0/+2
| | | p4raw-id: //depot/perlio@14296
* s/SvPV/SvPVbyte/g, as suggested by Gisle Aas.Jarkko Hietaniemi2002-01-161-5/+5
| | | p4raw-id: //depot/perl@14293
* Socket::sockaddr_familyGisle Aas2002-01-151-0/+14
| | | | | Message-ID: <lr1ygrk7gv.fsf@caliper.activestate.com> p4raw-id: //depot/perl@14279
* [ID 20011126.148] Socket::inet_aton() incorrectly accepts null stringBob Dalgleish2001-11-271-1/+4
| | | | | | | | Message-Id: <B8283EBD.8414%Robert.Dalgleish@sk.sympatico.ca> Craig Berry submitted half of this patch just yesterday. Spooky cosmic resonance. p4raw-id: //depot/perl@13291
* Socket::my_inet_aton() tweakCraig A. Berry2001-11-251-1/+1
| | | | | Message-Id: <5.1.0.14.2.20011125160848.01c59690@exchi01> p4raw-id: //depot/perl@13275
* The Socket tests were wrong: they were assuming too much.Jarkko Hietaniemi2001-09-091-22/+66
| | | p4raw-id: //depot/perl@11951
* Retract the portability changes since theyJarkko Hietaniemi2001-09-081-81/+18
| | | | | | | seem to have opened a can of worms... will go back to UNICOS/mk and do the bare minimum required to get the tests working. p4raw-id: //depot/perl@11950
* Still more Socket portability tweaking.Jarkko Hietaniemi2001-09-081-53/+68
| | | | | | | | | | | Now Socket.t seems to be happy in all of Linux/x86, Tru64/alpha, Solaris/sparc, IRIX/MIPS (both 32-bit and 64-bit), and UNICOS/mk/alpha. Addendum: it seems that io_multihomed, io_sock, and hostent were broken in little-endians (linux/x86 and tru64/alpha) because of this change. Argh. p4raw-id: //depot/perl@11948
* More portability kicking on inet_ntoa().Jarkko Hietaniemi2001-09-081-9/+17
| | | p4raw-id: //depot/perl@11947
* Try to make Socket::inet_ntoa() more robust.Jarkko Hietaniemi2001-09-071-32/+45
| | | p4raw-id: //depot/perl@11926
* Document the bad assumptions currently breakingJarkko Hietaniemi2001-09-061-0/+27
| | | | | the Socket.t tests 10, 11, and 13 in UNICOS. p4raw-id: //depot/perl@11919
* Fix a typo #11889 and add a test for the same.Jarkko Hietaniemi2001-09-051-1/+1
| | | p4raw-id: //depot/perl@11895
* inet_ntoa() tweaks:Jarkko Hietaniemi2001-09-051-6/+14
| | | | | | | - don't allow addresses with > 255 characters - indent the HP-UX workaround - don't leak memory p4raw-id: //depot/perl@11889
* GCC on HP-UX 11 with 64bit support breaks inet_ntoaArtur Bergman2001-08-291-1/+6
| | | | | | This is a replacement implmentation that works on HPUX. This bug should probably be fixed in GCC. p4raw-id: //depot/perl@11789
* NetWare port from Guruprasad S <SGURUPRASAD@novell.com>.Jarkko Hietaniemi2001-06-161-0/+5
| | | p4raw-id: //depot/perl@10643