p5-net-pcap: initial commit, v0.18

This commit is contained in:
Alexandr Savca 2020-11-22 12:58:23 +02:00
parent 0b4b2cb80d
commit 436d43d9d1
9 changed files with 222 additions and 0 deletions

20
p5-net-pcap/.footprint Normal file
View File

@ -0,0 +1,20 @@
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-r-xr-xr-x root/root usr/bin/pcapinfo
drwxr-xr-x root/root usr/lib/
drwxr-xr-x root/root usr/lib/perl5/
drwxr-xr-x root/root usr/lib/perl5/site_perl/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.28/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/Net/
-r--r--r-- root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/Net/Pcap.pm
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/auto/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/auto/Net/
drwxr-xr-x root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/auto/Net/Pcap/
-r-xr-xr-x root/root usr/lib/perl5/site_perl/5.28/linux-thread-multi/auto/Net/Pcap/Pcap.so
drwxr-xr-x root/root usr/share/
drwxr-xr-x root/root usr/share/man/
drwxr-xr-x root/root usr/share/man/man1/
-r--r--r-- root/root usr/share/man/man1/pcapinfo.1pm.gz
drwxr-xr-x root/root usr/share/man/man3/
-r--r--r-- root/root usr/share/man/man3/Net::Pcap.3pm.gz

10
p5-net-pcap/.signature Normal file
View File

@ -0,0 +1,10 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF3xo2yBv576NX/LGVzvhbCBw1N6C8QgBYLhr1AKd2LdTOEoq7sEKlVGhwFFQoOGEpIBgrvyI7hsVauYXX4d+GQQA=
SHA256 (Pkgfile) = f9ed391106a01c7e0b11ffef4e653001c0b99a318e77838e5b60816444fd5703
SHA256 (.footprint) = d6bf3b19e32bb0862cdafaa33a0f288c33ac8d49852061be241daa84bad550c3
SHA256 (Net-Pcap-0.18.tar.gz) = cb9bd44948c23544bb9d4e28261dbd0dbb3e7564709487a7855576e0d9b68307
SHA256 (makefile.patch) = c9a63eca539435e3ab973fec6a9d6033e204fedb942510b082ae0cb233e786cd
SHA256 (listdatalinks.patch) = cb5f042b146ecf7636347f13a3989b34d0d0802680e1e5617f1603e592dbbe5b
SHA256 (pcapapi.patch) = f9425ba8e992d7cbe8f7f0e3920f10345eb7acee3f2e49a83155acde355af88d
SHA256 (pcapapi2.patch) = 300f4c474f0f3d07c865f683f1e41b995bdb5d16d578464b19955be0fef1a031
SHA256 (newapi.patch) = f222e81c8b542552131ffc677f53d1dd071f3f41cccc21b96eba0de56617e23a

42
p5-net-pcap/Pkgfile Normal file
View File

@ -0,0 +1,42 @@
# Description: Interface to the pcap(3) LBL packet capture library
# URL: https://metacpan.org/pod/Net::Pcap
# Maintainer: Alexandr Savca, alexandrsavca89 at gmail dot com
# Depends on: libpcap
name=p5-net-pcap
version=0.18
release=1
source=(https://cpan.metacpan.org/authors/id/S/SA/SAPER/Net-Pcap-$version.tar.gz
makefile.patch
listdatalinks.patch
pcapapi.patch
pcapapi2.patch
newapi.patch)
build() {
cd Net-Pcap-$version
patch -Np2 -b -z .orig < $SRC/makefile.patch
patch -Np2 -b -z .orig < $SRC/listdatalinks.patch
patch -Np1 -b -z .orig < $SRC/pcapapi.patch
# patch -Np1 -b -z .orig <$SRC/pcapapi2.patch
patch -Np2 -b -z .orig < $SRC/newapi.patch
perl Makefile.PL
# remove default -pipe flag
sed -i -e '/CCFLAGS = /s/ -pipe / /' Makefile
make OPTIMIZE="$CFLAGS"
make DESTDIR=$PKG install
# remove perlcrap
find $PKG -name perllocal.pod \
-o -name "*.bs" \
-o -name .packlist \
-o -name autosplit.ix \
| xargs rm -f
# remove empty dirs
find $PKG -depth -type d -empty -delete
}

58
p5-net-pcap/fixups.patch Normal file
View File

@ -0,0 +1,58 @@
diff -up src/Net-Pcap-0.18/Makefile.PL.orig src/Net-Pcap-0.18/Makefile.PL
--- src/Net-Pcap-0.18/Makefile.PL.orig 2016-05-09 15:23:13.000000000 -0600
+++ src/Net-Pcap-0.18/Makefile.PL 2018-02-20 21:56:00.000000000 -0700
@@ -62,40 +62,6 @@ Or get and install the WinPcap developer
http://www.winpcap.org/install/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REASON
-
-} else { # other systems (Unix)
- die <<"REASON" unless have_library('pcap');
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-You appear to lack the pcap(3) library. \a
-
-If it is installed in a non-standard location, please try setting the LIBS
-and INC values on the command line.
-
-Or get the sources and install the pcap library from http://www.tcpdump.org/
-
-If you install the pcap library using a system package, make sure to also
-install the corresponding -devel package, which contains the C headers needed
-to compile this module.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-REASON
-
- die <<"REASON" unless have_library('pcap', 'pcap_lib_version');
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-You appear to have an old version of the pcap library. \a
-
-This module need a recent version of the pcap library in order to provide
-access to all its features. You can still compile it with your old pcap
-library but some functions won't be available, and trying to use them in
-Perl programs will generate errors. Programs only using the old functions
-should perform as previously. If not, don't hesitate to fill a bug.
-
-You can get the latest sources of the pcap library at http://www.tcpdump.org/
-
-If you install the pcap library using a system package, make sure to also
-install the corresponding -devel package, which contains the C headers needed
-to compile this module.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-REASON
}
# Now trying to detect which functions are actually available.
diff -up src/Net-Pcap-0.18/Pcap.pm.orig src/Net-Pcap-0.18/Pcap.pm
--- src/Net-Pcap-0.18/Pcap.pm.orig 2016-05-15 07:24:03.000000000 -0600
+++ src/Net-Pcap-0.18/Pcap.pm 2018-02-20 21:56:00.000000000 -0700
@@ -714,6 +714,10 @@ Close the savefile associated with the d
=over
+=item B<pcap_list_datalinks($pcap)>
+
+Returns a list of link layer types supported by the given pcap descriptor.
+
=item B<pcap_datalink($pcap)>

View File

@ -0,0 +1,14 @@
diff -up src/Net-Pcap-0.18/Pcap.pm.orig src/Net-Pcap-0.18/Pcap.pm
--- src/Net-Pcap-0.18/Pcap.pm.orig 2016-05-15 07:24:03.000000000 -0600
+++ src/Net-Pcap-0.18/Pcap.pm 2018-02-20 21:56:00.000000000 -0700
@@ -714,6 +714,10 @@ Close the savefile associated with the d
=over
+=item B<pcap_list_datalinks($pcap)>
+
+Returns a list of link layer types supported by the given pcap descriptor.
+
=item B<pcap_datalink($pcap)>

View File

@ -0,0 +1,44 @@
diff -up src/Net-Pcap-0.18/Makefile.PL.orig src/Net-Pcap-0.18/Makefile.PL
--- src/Net-Pcap-0.18/Makefile.PL.orig 2016-05-09 15:23:13.000000000 -0600
+++ src/Net-Pcap-0.18/Makefile.PL 2018-02-20 21:56:00.000000000 -0700
@@ -62,40 +62,6 @@ Or get and install the WinPcap developer
http://www.winpcap.org/install/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REASON
-
-} else { # other systems (Unix)
- die <<"REASON" unless have_library('pcap');
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-You appear to lack the pcap(3) library. \a
-
-If it is installed in a non-standard location, please try setting the LIBS
-and INC values on the command line.
-
-Or get the sources and install the pcap library from http://www.tcpdump.org/
-
-If you install the pcap library using a system package, make sure to also
-install the corresponding -devel package, which contains the C headers needed
-to compile this module.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-REASON
-
- die <<"REASON" unless have_library('pcap', 'pcap_lib_version');
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-You appear to have an old version of the pcap library. \a
-
-This module need a recent version of the pcap library in order to provide
-access to all its features. You can still compile it with your old pcap
-library but some functions won't be available, and trying to use them in
-Perl programs will generate errors. Programs only using the old functions
-should perform as previously. If not, don't hesitate to fill a bug.
-
-You can get the latest sources of the pcap library at http://www.tcpdump.org/
-
-If you install the pcap library using a system package, make sure to also
-install the corresponding -devel package, which contains the C headers needed
-to compile this module.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-REASON
}
# Now trying to detect which functions are actually available.

12
p5-net-pcap/newapi.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up src/Net-Pcap-0.18/Pcap.xs.orig src/Net-Pcap-0.18/Pcap.xs
--- src/Net-Pcap-0.18/Pcap.xs.orig 2020-04-05 01:33:02.900000000 -0600
+++ src/Net-Pcap-0.18/Pcap.xs 2020-04-05 01:33:11.070000000 -0600
@@ -937,7 +937,7 @@ pcap_parsesrcstr(source, type, host, por
pcap_t *
pcap_open(source, snaplen, flags, read_timeout, auth, err)
- char *source
+ const char *source
int snaplen
int flags
int read_timeout

11
p5-net-pcap/pcapapi.patch Normal file
View File

@ -0,0 +1,11 @@
diff -up Net-Pcap-0.18/Makefile.PL.orig Net-Pcap-0.18/Makefile.PL
--- Net-Pcap-0.18/Makefile.PL.orig 2019-06-13 00:50:15.000000000 -0600
+++ Net-Pcap-0.18/Makefile.PL 2019-06-13 01:00:15.000000000 -0600
@@ -107,6 +107,7 @@ REASON
# corresponding tests.
my @funcs = have_functions(find_functions());
$options{DEFINE} .= cpp_defines(@funcs);
+$options{DEFINE} .= " -DPCAP_API=\"\" -DHAVE_PCAP_OPEN -DHAVE_PCAP_SETSAMPLING";
open(FUNCS, '>funcs.txt') or warn "warning: can't write 'funcs.txt': $!\n";
print FUNCS join("\n", @funcs), "\n";
close(FUNCS);

View File

@ -0,0 +1,11 @@
diff -up Net-Pcap-0.18/Makefile.PL.orig Net-Pcap-0.18/Makefile.PL
--- Net-Pcap-0.18/Makefile.PL.orig 2019-06-13 00:50:15.000000000 -0600
+++ Net-Pcap-0.18/Makefile.PL 2019-06-13 01:00:15.000000000 -0600
@@ -107,6 +107,7 @@ REASON
# corresponding tests.
my @funcs = have_functions(find_functions());
$options{DEFINE} .= cpp_defines(@funcs);
+$options{DEFINE} .= " -DPCAP_API=\"\" -UPCAP_OPEN -UPCAP_SETSAMPLING";
open(FUNCS, '>funcs.txt') or warn "warning: can't write 'funcs.txt': $!\n";
print FUNCS join("\n", @funcs), "\n";
close(FUNCS);