From: Jeremy Sowden <jeremy@azazel.net>
To: Jan Engelhardt <jengelh@inai.de>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: [PATCH xtables-addons 1/4] geoip: remove superfluous xt_geoip_fetch_maxmind script.
Date: Sun, 22 Nov 2020 14:05:27 +0000 [thread overview]
Message-ID: <20201122140530.250248-2-jeremy@azazel.net> (raw)
In-Reply-To: <20201122140530.250248-1-jeremy@azazel.net>
xt_geoip_fetch and xt_geoip_fetch_maxmind are identical. Remove the
latter.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
geoip/Makefile.am | 2 +-
geoip/xt_geoip_fetch_maxmind | 95 ------------------------------------
2 files changed, 1 insertion(+), 96 deletions(-)
delete mode 100755 geoip/xt_geoip_fetch_maxmind
diff --git a/geoip/Makefile.am b/geoip/Makefile.am
index 7bbf3bcf3815..5323c82eb7c4 100644
--- a/geoip/Makefile.am
+++ b/geoip/Makefile.am
@@ -1,6 +1,6 @@
# -*- Makefile -*-
-bin_SCRIPTS = xt_geoip_fetch xt_geoip_fetch_maxmind
+bin_SCRIPTS = xt_geoip_fetch
pkglibexec_SCRIPTS = xt_geoip_build xt_geoip_build_maxmind xt_geoip_dl xt_geoip_dl_maxmind
diff --git a/geoip/xt_geoip_fetch_maxmind b/geoip/xt_geoip_fetch_maxmind
deleted file mode 100755
index 06245195fb51..000000000000
--- a/geoip/xt_geoip_fetch_maxmind
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/perl
-#
-# Utility to query GeoIP database
-# Copyright Philip Prindeville, 2018
-#
-use Getopt::Long;
-use Socket qw(AF_INET AF_INET6 inet_ntop);
-use warnings;
-use strict;
-
-sub AF_INET_SIZE() { 4 }
-sub AF_INET6_SIZE() { 16 }
-
-my $target_dir = ".";
-my $ipv4 = 0;
-my $ipv6 = 0;
-
-&Getopt::Long::Configure(qw(bundling));
-&GetOptions(
- "D=s" => \$target_dir,
- "4" => \$ipv4,
- "6" => \$ipv6,
-);
-
-if (!-d $target_dir) {
- print STDERR "Target directory $target_dir does not exit.\n";
- exit 1;
-}
-
-# if neither specified, assume both
-if (! $ipv4 && ! $ipv6) {
- $ipv4 = $ipv6 = 1;
-}
-
-foreach my $cc (@ARGV) {
- if ($cc !~ m/^([a-z]{2}|a[12]|o1)$/i) {
- print STDERR "Invalid country code '$cc'\n";
- exit 1;
- }
-
- my $file = $target_dir . '/' . uc($cc) . '.iv4';
-
- if (! -f $file) {
- printf STDERR "Can't find data for country '$cc'\n";
- exit 1;
- }
-
- my ($contents, $buffer, $bytes, $fh);
-
- if ($ipv4) {
- open($fh, '<', $file) || die "Couldn't open file for '$cc'\n";
-
- binmode($fh);
-
- while (($bytes = read($fh, $buffer, AF_INET_SIZE * 2)) == AF_INET_SIZE * 2) {
- my ($start, $end) = unpack('a4a4', $buffer);
- $start = inet_ntop(AF_INET, $start);
- $end = inet_ntop(AF_INET, $end);
- print $start, '-', $end, "\n";
- }
- close($fh);
- if (! defined $bytes) {
- printf STDERR "Error reading file for '$cc'\n";
- exit 1;
- } elsif ($bytes != 0) {
- printf STDERR "Short read on file for '$cc'\n";
- exit 1;
- }
- }
-
- substr($file, -1) = '6';
-
- if ($ipv6) {
- open($fh, '<', $file) || die "Couldn't open file for '$cc'\n";
-
- binmode($fh);
-
- while (($bytes = read($fh, $buffer, AF_INET6_SIZE * 2)) == AF_INET6_SIZE * 2) {
- my ($start, $end) = unpack('a16a16', $buffer);
- $start = inet_ntop(AF_INET6, $start);
- $end = inet_ntop(AF_INET6, $end);
- print $start, '-', $end, "\n";
- }
- close($fh);
- if (! defined $bytes) {
- printf STDERR "Error reading file for '$cc'\n";
- exit 1;
- } elsif ($bytes != 0) {
- printf STDERR "Short read on file for '$cc'\n";
- exit 1;
- }
- }
-}
-
-exit 0;
--
2.29.2
next prev parent reply other threads:[~2020-11-22 14:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-22 14:05 [PATCH xtables-addons 0/4] geoip: script fixes Jeremy Sowden
2020-11-22 14:05 ` Jeremy Sowden [this message]
2020-11-22 14:05 ` [PATCH xtables-addons 2/4] geoip: fix man-page typo' Jeremy Sowden
2020-11-22 16:23 ` Jan Engelhardt
2020-11-22 14:05 ` [PATCH xtables-addons 3/4] geoip: add man-pages for MaxMind scripts Jeremy Sowden
2020-11-22 14:05 ` [PATCH xtables-addons 4/4] geoip: use correct download URL for MaxMind DB's Jeremy Sowden
2020-11-22 16:55 ` [PATCH xtables-addons 0/4] geoip: script fixes Jan Engelhardt
2020-11-24 17:29 ` Jeremy Sowden
2020-11-24 17:39 ` Jan Engelhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201122140530.250248-2-jeremy@azazel.net \
--to=jeremy@azazel.net \
--cc=jengelh@inai.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).