summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Bonaccorso <carnil@debian.org>2015-07-21 19:32:46 +0200
committerSalvatore Bonaccorso <carnil@debian.org>2015-07-21 19:32:46 +0200
commitd75f7ec87fa777499adb7bcd157bab7cc1f6b846 (patch)
tree0fdbd337d0b1f9b6a19563a6a46cde2d4c53bab6
parentf744cb66662903ff6d26719ac82a8d68b9f4467f (diff)
parent4a980be355585c0342b788113d979898fa051b92 (diff)
Merge tag 'upstream/1.09'
Upstream version 1.09
-rw-r--r--Build.PL26
-rw-r--r--Changes35
-rw-r--r--LICENSE202
-rw-r--r--MANIFEST14
-rw-r--r--META.json49
-rw-r--r--META.yml43
-rw-r--r--Makefile.PL52
-rw-r--r--README11
-rw-r--r--README.md32
-rw-r--r--lib/IO/Interface.pm (renamed from Interface.pm)15
-rw-r--r--lib/IO/Interface.xs (renamed from Interface.xs)14
-rw-r--r--lib/IO/Interface/Simple.pm (renamed from Interface/Simple.pm)12
12 files changed, 395 insertions, 110 deletions
diff --git a/Build.PL b/Build.PL
new file mode 100644
index 0000000..8f93f76
--- /dev/null
+++ b/Build.PL
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use Module::Build;
+
+my $build = Module::Build->new(
+ module_name => 'IO::Interface',
+ dist_version_from => 'lib/IO/Interface.pm',
+ dist_author => 'Lincoln Stein <lincoln.stein@gmail.com>',
+ dist_abstract => 'Access and modify network interface card configuration',
+ license => 'perl',
+ build_requires => {
+ 'ExtUtils::CBuilder' => 0,
+ },
+ requires => {
+ 'perl' => '5.005',
+ },
+ );
+
+$build->create_build_script();
+
+# get rid of annoying warning from ExtUtils::ParseXS
+my $sub = 's/\$\^W\s*=\s*1/\$^W = 0/';
+system "perl -pi -e '$sub' Build";
+
+exit 0;
diff --git a/Changes b/Changes
index d2b411d..4952898 100644
--- a/Changes
+++ b/Changes
@@ -1,41 +1,48 @@
Revision history for Perl extension IO::Interface.
+1.09 Tue Dec 9 11:22:56 EST 2014
+ -Converted to use Module::Build
+
+1.08 Mon Dec 8 10:38:42 EST 2014
+ -First Git version
+ -Apply segfault patches for OpenBSD from Mikolaj Kucharski.
+
1.07 Sun Jun 8 21:29:58 EDT 2014
- Apply patch from Miolaj Kucharski to fix segfault on OpenBSD.
+ -Apply patch from Miolaj Kucharski to fix segfault on OpenBSD.
1.06 Thu Jul 21 13:40:49 EDT 2011
- Address test 5 failure on systems with aliases on loopback.
+ -Address test 5 failure on systems with aliases on loopback.
1.05 Fri Jun 6 11:53:21 EDT 2008
- Fix from Mitsuru Yoshida to compile on FreeBSD.
+ -Fix from Mitsuru Yoshida to compile on FreeBSD.
1.04 Wed Dec 26 13:38:53 EST 2007
- Fix from John Lightsey to avoid dmesg warnings on BSD systems.
+ -Fix from John Lightsey to avoid dmesg warnings on BSD systems.
1.03 Mon Jan 22 16:38:24 EST 2007
- Fix to compile cleanly on solaris systems.
+ -Fix to compile cleanly on solaris systems.
1.02 Thu Sep 14 08:54:04 EDT 2006
- More documentation fixes.
+ -More documentation fixes.
1.01 Wed Sep 13 20:52:32 EDT 2006
- Documentation fix.
+ -Documentation fix.
1.00 Wed Sep 13 17:01:46 EDT 2006
- Introduced IO::Interface::Simple.
- Added index methods.
- Compiles on CygWin.
+ -Introduced IO::Interface::Simple.
+ -Added index methods.
+ -Compiles on CygWin.
0.98 Sep 03 18:20:20 EST 2003
- Fixed minor documentation error.
+ -Fixed minor documentation error.
0.97 May 14 16:50:46 EDT 2001
- BSD portability fixes from Anton Berezin <tobez@tobez.org> and Jan L. Peterson <jlp@flipdog.com>
+ -BSD portability fixes from Anton Berezin <tobez@tobez.org> and Jan L. Peterson <jlp@flipdog.com>
0.96 May 7 10:44:48 EDT 2001
- Documentation fixes
+ -Documentation fixes
0.94 July 17, 2000
- Added the addr_to_interface function, and the pseudo device "any"
+ -Added the addr_to_interface function, and the pseudo device "any"
which corresponds to INADDR_ANY
0.90 First release
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..10d46d2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+The Artistic License 2.0
+
+ Copyright (c) 2014 Lincoln Stein
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+This license establishes the terms under which a given free software
+Package may be copied, modified, distributed, and/or redistributed.
+The intent is that the Copyright Holder maintains some artistic
+control over the development of that Package while still keeping the
+Package available as open source and free software.
+
+You are always permitted to make arrangements wholly outside of this
+license directly with the Copyright Holder of a given Package. If the
+terms of this license do not permit the full use that you propose to
+make of the Package, you should contact the Copyright Holder and seek
+a different licensing arrangement.
+
+Definitions
+
+ "Copyright Holder" means the individual(s) or organization(s)
+ named in the copyright notice for the entire Package.
+
+ "Contributor" means any party that has contributed code or other
+ material to the Package, in accordance with the Copyright Holder's
+ procedures.
+
+ "You" and "your" means any person who would like to copy,
+ distribute, or modify the Package.
+
+ "Package" means the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection and/or of
+ those files. A given Package may consist of either the Standard
+ Version, or a Modified Version.
+
+ "Distribute" means providing a copy of the Package or making it
+ accessible to anyone else, or in the case of a company or
+ organization, to others outside of your company or organization.
+
+ "Distributor Fee" means any fee that you charge for Distributing
+ this Package or providing support for this Package to another
+ party. It does not mean licensing fees.
+
+ "Standard Version" refers to the Package if it has not been
+ modified, or has been modified only in ways explicitly requested
+ by the Copyright Holder.
+
+ "Modified Version" means the Package, if it has been changed, and
+ such changes were not explicitly requested by the Copyright
+ Holder.
+
+ "Original License" means this Artistic License as Distributed with
+ the Standard Version of the Package, in its current version or as
+ it may be modified by The Perl Foundation in the future.
+
+ "Source" form means the source code, documentation source, and
+ configuration files for the Package.
+
+ "Compiled" form means the compiled bytecode, object code, binary,
+ or any other form resulting from mechanical transformation or
+ translation of the Source form.
+
+
+Permission for Use and Modification Without Distribution
+
+(1) You are permitted to use the Standard Version and create and use
+Modified Versions for any purpose without restriction, provided that
+you do not Distribute the Modified Version.
+
+
+Permissions for Redistribution of the Standard Version
+
+(2) You may Distribute verbatim copies of the Source form of the
+Standard Version of this Package in any medium without restriction,
+either gratis or for a Distributor Fee, provided that you duplicate
+all of the original copyright notices and associated disclaimers. At
+your discretion, such verbatim copies may or may not include a
+Compiled form of the Package.
+
+(3) You may apply any bug fixes, portability changes, and other
+modifications made available from the Copyright Holder. The resulting
+Package will still be considered the Standard Version, and as such
+will be subject to the Original License.
+
+
+Distribution of Modified Versions of the Package as Source
+
+(4) You may Distribute your Modified Version as Source (either gratis
+or for a Distributor Fee, and with or without a Compiled form of the
+Modified Version) provided that you clearly document how it differs
+from the Standard Version, including, but not limited to, documenting
+any non-standard features, executables, or modules, and provided that
+you do at least ONE of the following:
+
+ (a) make the Modified Version available to the Copyright Holder
+ of the Standard Version, under the Original License, so that the
+ Copyright Holder may include your modifications in the Standard
+ Version.
+
+ (b) ensure that installation of your Modified Version does not
+ prevent the user installing or running the Standard Version. In
+ addition, the Modified Version must bear a name that is different
+ from the name of the Standard Version.
+
+ (c) allow anyone who receives a copy of the Modified Version to
+ make the Source form of the Modified Version available to others
+ under
+
+ (i) the Original License or
+
+ (ii) a license that permits the licensee to freely copy,
+ modify and redistribute the Modified Version using the same
+ licensing terms that apply to the copy that the licensee
+ received, and requires that the Source form of the Modified
+ Version, and of any works derived from it, be made freely
+ available in that license fees are prohibited but Distributor
+ Fees are allowed.
+
+
+Distribution of Compiled Forms of the Standard Version
+or Modified Versions without the Source
+
+(5) You may Distribute Compiled forms of the Standard Version without
+the Source, provided that you include complete instructions on how to
+get the Source of the Standard Version. Such instructions must be
+valid at the time of your distribution. If these instructions, at any
+time while you are carrying out such distribution, become invalid, you
+must provide new instructions on demand or cease further distribution.
+If you provide valid instructions or cease distribution within thirty
+days after you become aware that the instructions are invalid, then
+you do not forfeit any of your rights under this license.
+
+(6) You may Distribute a Modified Version in Compiled form without
+the Source, provided that you comply with Section 4 with respect to
+the Source of the Modified Version.
+
+
+Aggregating or Linking the Package
+
+(7) You may aggregate the Package (either the Standard Version or
+Modified Version) with other packages and Distribute the resulting
+aggregation provided that you do not charge a licensing fee for the
+Package. Distributor Fees are permitted, and licensing fees for other
+components in the aggregation are permitted. The terms of this license
+apply to the use and Distribution of the Standard or Modified Versions
+as included in the aggregation.
+
+(8) You are permitted to link Modified and Standard Versions with
+other works, to embed the Package in a larger work of your own, or to
+build stand-alone binary or bytecode versions of applications that
+include the Package, and Distribute the result without restriction,
+provided the result does not expose a direct interface to the Package.
+
+
+Items That are Not Considered Part of a Modified Version
+
+(9) Works (including, but not limited to, modules and scripts) that
+merely extend or make use of the Package, do not, by themselves, cause
+the Package to be a Modified Version. In addition, such works are not
+considered parts of the Package itself, and are not subject to the
+terms of this license.
+
+
+General Provisions
+
+(10) Any use, modification, and distribution of the Standard or
+Modified Versions is governed by this Artistic License. By using,
+modifying or distributing the Package, you accept this license. Do not
+use, modify, or distribute the Package, if you do not accept this
+license.
+
+(11) If your Modified Version has been derived from a Modified
+Version made by someone other than you, you are nevertheless required
+to ensure that your Modified Version complies with the requirements of
+this license.
+
+(12) This license does not grant you the right to use any trademark,
+service mark, tradename, or logo of the Copyright Holder.
+
+(13) This license includes the non-exclusive, worldwide,
+free-of-charge patent license to make, have made, use, offer to sell,
+sell, import and otherwise transfer the Package with respect to any
+patent claims licensable by the Copyright Holder that are necessarily
+infringed by the Package. If you institute patent litigation
+(including a cross-claim or counterclaim) against any party alleging
+that the Package constitutes direct or contributory patent
+infringement, then this Artistic License to you shall terminate on the
+date that such litigation is filed.
+
+(14) Disclaimer of Warranty:
+THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
+IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
+LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/MANIFEST b/MANIFEST
index f4e0dc7..e8d2d0d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,10 +1,12 @@
+Build.PL
Changes
-README
-Interface.pm
-Interface.xs
-Interface/Simple.pm
+lib/IO/Interface.pm
+lib/IO/Interface.xs
+lib/IO/Interface/Simple.pm
+LICENSE
MANIFEST
-Makefile.PL
+META.json
+META.yml Module meta-data (added by MakeMaker)
+README.md
t/basic.t
t/simple.t
-META.yml Module meta-data (added by MakeMaker)
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..1dee62e
--- /dev/null
+++ b/META.json
@@ -0,0 +1,49 @@
+{
+ "abstract" : "Access and modify network interface card configuration",
+ "author" : [
+ "Lincoln Stein <lincoln.stein@gmail.com>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "Module::Build version 0.4205",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "IO-Interface",
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::CBuilder" : "0"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "Module::Build" : "0.42"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "perl" : "5.005"
+ }
+ }
+ },
+ "provides" : {
+ "IO::Interface" : {
+ "file" : "lib/IO/Interface.pm",
+ "version" : "1.09"
+ },
+ "IO::Interface::Simple" : {
+ "file" : "lib/IO/Interface/Simple.pm"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "license" : [
+ "http://dev.perl.org/licenses/"
+ ]
+ },
+ "version" : "1.09"
+}
diff --git a/META.yml b/META.yml
index 99045c2..539bf96 100644
--- a/META.yml
+++ b/META.yml
@@ -1,20 +1,27 @@
---- #YAML:1.0
-name: IO-Interface
-version: 1.07
-abstract: ~
-author: []
-license: unknown
-distribution_type: module
-configure_requires:
- ExtUtils::MakeMaker: 0
+---
+abstract: 'Access and modify network interface card configuration'
+author:
+ - 'Lincoln Stein <lincoln.stein@gmail.com>'
build_requires:
- ExtUtils::MakeMaker: 0
-requires: {}
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.57_05
+ ExtUtils::CBuilder: '0'
+configure_requires:
+ Module::Build: '0.42'
+dynamic_config: 1
+generated_by: 'Module::Build version 0.4205, CPAN::Meta::Converter version 2.120351'
+license: perl
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: IO-Interface
+provides:
+ IO::Interface:
+ file: lib/IO/Interface.pm
+ version: '1.09'
+ IO::Interface::Simple:
+ file: lib/IO/Interface/Simple.pm
+ version: 0
+requires:
+ perl: '5.005'
+resources:
+ license: http://dev.perl.org/licenses/
+version: '1.09'
diff --git a/Makefile.PL b/Makefile.PL
deleted file mode 100644
index 55b79f0..0000000
--- a/Makefile.PL
+++ /dev/null
@@ -1,52 +0,0 @@
-use ExtUtils::MakeMaker;
-use Config;
-
-my @libs = ();
-push @libs,'-lresolv' unless $Config{d_inetaton};
-
-my $guess_cfg = {
- 'freebsd' => {
- 'defs' => '-D__USE_BSD',
- },
- 'netbsd' => {
- 'defs' => '-D__USE_BSD',
- },
- 'openbsd' => {
- 'defs' => '-D__USE_BSD',
- }
-};
-
-my $guess = $guess_cfg->{$^O};
-unless (ref $guess eq 'HASH') {
- $guess = {'defs' => ''};
-}
-
-WriteMakefile(
- 'NAME' => 'IO::Interface',
- 'VERSION_FROM' => 'Interface.pm', # finds $VERSION
- 'LIBS' => ["@libs"], # e.g., '-lm'
- 'INC' => '', # e.g., '-I/usr/include/other'
- PMLIBDIRS => ['Interface'],
- CONFIGURE => sub {
- my %attrs;
- $attrs{DEFINE} = $guess->{'defs'};
-
- print "Checking for getifaddrs()...";
- eval { require 'ifaddrs.ph' };
- if ($@ && !-r "/usr/include/ifaddrs.h") {
- print " Nope, will not use it.\n";
- } else {
- $attrs{DEFINE} .= ' -DUSE_GETIFADDRS';
- print " Okay, I will use it.\n";
- }
- print "Checking for sockaddr_dl...";
- if (!-r "/usr/include/net/if_dl.h") {
- print " Nope, will not use it.\n";
- } else {
- $attrs{DEFINE} .= ' -DHAVE_SOCKADDR_DL_STRUCT';
- print " Okay, I will use it.\n";
- }
-
- \%attrs;
- },
-);
diff --git a/README b/README
deleted file mode 100644
index ded1098..0000000
--- a/README
+++ /dev/null
@@ -1,11 +0,0 @@
-IO::Interface adds object-methods to IO::Socket objects to allow them
-to get and set operational characteristics of network interface cards,
-such as IP addresses, net masks, and so forth. It is useful for
-identifying runtime characteristics of cards, such as broadcast
-addresses, and finding interfaces that satisfy certain criteria, such
-as the ability to multicast.
-
-See the POD for more information.
-
-Lincoln Stein <lstein@cshl.org>
-
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9587106
--- /dev/null
+++ b/README.md
@@ -0,0 +1,32 @@
+LibIO-Interface-Perl
+====================
+
+Perl interface to Unix network interface API
+
+IO::Interface adds object methods to IO::Socket objects to allow them
+to get and set operational characteristics of network interface
+cards, such as IP addresses, net masks, and so forth. It is useful
+for identifying runtime characteristics of cards, such as broadcast
+addresses, and finding interfaces that satisfy certain criteria,
+such Perl interface to Unix network interface API as the ability to
+multicast.
+
+For support, please use the GitHub repository at
+https://github.com/lstein/LibIO-Interface-Perl
+
+Author
+======
+
+Lincoln D. Stein <lincoln.stein@gmail.com>
+
+License
+=======
+
+Copyright 2001-2014, Lincoln D. Stein.
+
+This library is distributed under the Perl Artistic License
+2.0. Please see LICENSE for more information.
+
+
+
+
diff --git a/Interface.pm b/lib/IO/Interface.pm
index 72a8646..419aa00 100644
--- a/Interface.pm
+++ b/lib/IO/Interface.pm
@@ -9,7 +9,6 @@ use IO::Socket;
require Exporter;
require DynaLoader;
-use AutoLoader;
my @functions = qw(if_addr if_broadcast if_netmask if_dstaddr if_hwaddr if_flags if_list if_mtu if_metric
addr_to_interface if_index if_indextoname );
@@ -28,7 +27,7 @@ my @flags = qw(IFF_ALLMULTI IFF_AUTOMEDIA IFF_BROADCAST
@EXPORT = qw( );
@ISA = qw(Exporter DynaLoader);
-$VERSION = '1.07';
+$VERSION = '1.09';
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
@@ -285,9 +284,17 @@ This example determines whether interface 'tu0' supports multicasting:
=head1 AUTHOR
-Lincoln Stein E<lt>lstein@cshl.orgE<gt>
+Lincoln D. Stein <lincoln.stein@gmail.com>
+Copyright 2001-2014, Lincoln D. Stein.
-This module is distributed under the same license as Perl itself.
+This library is distributed under the Perl Artistic License
+2.0. Please see LICENSE for more information.
+
+=head1 SUPPORT
+
+For feature requests, bug reports and code contributions, please use
+the GitHub repository at
+https://github.com/lstein/LibIO-Interface-Perl
=head1 SEE ALSO
diff --git a/Interface.xs b/lib/IO/Interface.xs
index 479cdef..9d500d9 100644
--- a/Interface.xs
+++ b/lib/IO/Interface.xs
@@ -1,7 +1,15 @@
+/* Interface.xs: part of LibIO-Interface-Perl */
+/* Copyright 2014 Lincoln D. Stein */
+/* Licensed under Perl Artistic License 2.0 */
+/* Please see LICENSE and README.md for more information. */
+
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
+#include <stdio.h>
+#include <string.h>
+
/* socket definitions */
#include <sys/types.h>
#include <sys/socket.h>
@@ -511,6 +519,9 @@ if_netmask(sock, name, ...)
operation = SIOCGIFNETMASK;
}
if (!Ioctl(sock,operation,&ifr)) XSRETURN_UNDEF;
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ ifr.ifr_addr.sa_family = AF_INET;
+#endif
if (ifr.ifr_addr.sa_family != AF_INET) croak ("Address is not in the AF_INET family.\n");
RETVAL = inet_ntoa(((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr);
#endif
@@ -582,7 +593,6 @@ if_hwaddr(sock, name, ...)
#if (defined(USE_GETIFADDRS) && defined(HAVE_SOCKADDR_DL_STRUCT))
getifaddrs(&ifap);
- while(1) {
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (strncmp(name, ifa->ifa_name, IFNAMSIZ) == 0) {
family = ifa->ifa_addr->sa_family;
@@ -593,9 +603,7 @@ if_hwaddr(sock, name, ...)
break;
}
}
- ifap = ifap -> ifa_next;
}
- freeifaddrs(ifap);
s = hwaddr;
s[0] = '\0';
diff --git a/Interface/Simple.pm b/lib/IO/Interface/Simple.pm
index 189a26f..def0b1e 100644
--- a/Interface/Simple.pm
+++ b/lib/IO/Interface/Simple.pm
@@ -267,9 +267,17 @@ operating system may not let you set some of these.
=head1 AUTHOR
-Lincoln Stein E<lt>lstein@cshl.orgE<gt>
+Lincoln D. Stein <lincoln.stein@gmail.com>
+Copyright 2001-2014, Lincoln D. Stein.
-This module is distributed under the same license as Perl itself.
+This library is distributed under the Perl Artistic License
+2.0. Please see LICENSE for more information.
+
+=head1 SUPPORT
+
+For feature requests, bug reports and code contributions, please use
+the GitHub repository at
+https://github.com/lstein/LibIO-Interface-Perl
=head1 SEE ALSO