diff options
-rw-r--r-- | debian/README.Debian | 10 | ||||
-rw-r--r-- | debian/changelog | 101 | ||||
-rw-r--r-- | debian/control | 34 | ||||
-rw-r--r-- | debian/copyright | 109 | ||||
-rw-r--r-- | debian/docs | 1 | ||||
-rw-r--r-- | debian/manpages | 1 | ||||
-rw-r--r-- | debian/patches/010_new-name-adjustments.patch | 558 | ||||
-rw-r--r-- | debian/patches/020_disable-few-tests.patch | 57 | ||||
-rw-r--r-- | debian/patches/series | 2 | ||||
-rwxr-xr-x | debian/rules | 20 | ||||
-rw-r--r-- | debian/salsa-ci.yml | 3 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/source/lintian-overrides | 5 | ||||
-rw-r--r-- | debian/tests/check | 4 | ||||
-rw-r--r-- | debian/tests/control | 15 | ||||
-rw-r--r-- | debian/tests/deagrregate | 2 | ||||
-rw-r--r-- | debian/tests/geo | 4 | ||||
-rw-r--r-- | debian/tests/info | 4 | ||||
-rw-r--r-- | debian/tests/json | 2 | ||||
-rw-r--r-- | debian/tests/net | 11 | ||||
-rw-r--r-- | debian/tests/random | 7 | ||||
-rw-r--r-- | debian/tests/resolv | 2 | ||||
-rw-r--r-- | debian/tests/reversedns | 2 | ||||
-rw-r--r-- | debian/tests/split | 1 | ||||
-rw-r--r-- | debian/upstream/metadata | 5 | ||||
-rw-r--r-- | debian/watch | 3 |
26 files changed, 964 insertions, 0 deletions
diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..2c2da49 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,10 @@ +ipcalc-ng for Debian +-------------------- + +The upstream project started as a fork of the ipcalc tool in the Fedora +distribution, but it has, since then, replaced the original tool. + +In Debian we still have the original ipcalc, so this software was renamed, +in Debian only, to ipcalc-ng. + + -- Fabio Augusto De Muzio Tobich <ftobich@gmail.com> Thu, 18 Jun 2020 14:24:50 -0300 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..6737305 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,101 @@ +ipcalc-ng (1.0.3-1) unstable; urgency=medium + + * New upstream release. (LP: #1983602) + * debian/control: bumped Standards-Version to 4.6.2. + * debian/copyright: updated year in packaging block. + * debian/patches/: + - All patches refreshed. + - Patches metadata updated the Author and Last-Update fields. + - Patches not forwarded upstream because it's not upstream issues, but + packaging issues. + + -- Fabio Augusto De Muzio Tobich <ftobich@debian.org> Mon, 12 Jun 2023 08:48:40 -0300 + +ipcalc-ng (1.0.2-1) unstable; urgency=medium + + * New upstream release. + * Not providing a manpage anymore since manpage generation is fixed. + Consequently: + - debian/manpage/ipcalc-ng.1: removed. + - debian/manpages: removed. + - debian/rules: override_dh_installman updated. + - debian/source/lintian-overrides: removed. + * debian/control: bumped Standards-Version to 4.6.1. + * debian/patches/: + - 010_new-name-adjustments.patch: updated. + - 020_disable-few-tests.patch: refreshed. + + -- Fabio Augusto De Muzio Tobich <ftobich@debian.org> Sun, 27 Nov 2022 12:00:11 -0300 + +ipcalc-ng (1.0.1-3) unstable; urgency=medium + + [ Debian Janitor ] + * debian/control: bumped Standards-Version to 4.6.0. + * debian/upstream/metadata: fixed Repository-Browse field. + + [ Fabio Augusto De Muzio Tobich ] + * debian/copyright: updated year in packaging block. + * debian/salsa-ci.yml: use Debian recipe for salsa CI. + * debian/upstream/metadata: removed unknown Homepage field. + + -- Fabio Augusto De Muzio Tobich <ftobich@debian.org> Mon, 11 Apr 2022 11:27:38 -0300 + +ipcalc-ng (1.0.1-2) unstable; urgency=medium + + * Upload to unstable. + + -- Fabio Augusto De Muzio Tobich <ftobich@debian.org> Mon, 16 Aug 2021 09:15:09 -0300 + +ipcalc-ng (1.0.1-1) experimental; urgency=medium + + * New upstream release. + * debian/control: changed my email in Maintainer field. + * debian/copyright: + - Changed my email in packaging block. + - Updated some years. + * debian/manpage/ipcalc-ng.1: fixed groff sequences which should generate + apostrophes but it was generating acute accents in the manpage instead. + * debian/patches/010_new-name-adjustments.patch: refreshed. + + -- Fabio Augusto De Muzio Tobich <ftobich@debian.org> Tue, 08 Jun 2021 13:29:04 -0300 + +ipcalc-ng (1.0.0-1) unstable; urgency=medium + + * New upstream release. + * debian/control: + - Added ronn in Build-Depends field to build manpages from markdown, + upstream writes manpage in markdown now. + - Bumped Standards-Version to 4.5.1. + * debian/manpage/ipcalc-ng.1: created to provide a manpage since Debian's + ruby-ronn broke upstream manpage. + * debian/manpages: created to install the manpage. + * debian/patches/: + - 010_new-name-adjustments.patch: updated. + - 020_disable-few-tests.patch: renamed from 030 to 020 and updated. + - 020_fix-random-private-description.patch: removed, fixed upstream. + * debian/rules: override_dh_installman was updated to remove the upstream + manpage and install the one we provided. + * debian/source/lintian-overrides: created to explain why upstream manpage + was replaced. + + -- Fabio Augusto De Muzio Tobich <ftobich@gmail.com> Mon, 14 Dec 2020 12:45:08 -0300 + +ipcalc-ng (0.4.1-2) unstable; urgency=medium + + * Upload to unstable. + * debian/control: updated the long description. + * debian/copyright: added GPL-2 license paragraph, keeping both, GPL-2 and + GPL-2+, separated. + * debian/patches/030_disable-few-tests.patch: fixed a spelling error on + long Description in the patch header. + * debian/tests/: + - control: Separated json test to add dependency of jq package. + - json: Changed tests validating the output json with jq. + + -- Fabio Augusto De Muzio Tobich <ftobich@gmail.com> Tue, 21 Jul 2020 13:19:40 -0300 + +ipcalc-ng (0.4.1-1) experimental; urgency=medium + + * Initial release. (Closes: #892752) + + -- Fabio Augusto De Muzio Tobich <ftobich@gmail.com> Thu, 18 Jun 2020 14:24:50 -0300 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..65d2ccc --- /dev/null +++ b/debian/control @@ -0,0 +1,34 @@ +Source: ipcalc-ng +Section: net +Priority: optional +Maintainer: Fabio Augusto De Muzio Tobich <ftobich@debian.org> +Build-Depends: debhelper-compat (= 13), + libgeoip-dev, + meson, + ninja-build, + pkg-config, + ronn +Standards-Version: 4.6.2 +Rules-Requires-Root: no +Homepage: https://gitlab.com/ipcalc/ipcalc +Vcs-Browser: https://salsa.debian.org/debian/ipcalc-ng +Vcs-Git: https://salsa.debian.org/debian/ipcalc-ng.git + +Package: ipcalc-ng +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Suggests: geoip-database +Description: parameter calculator for IPv4 and IPv6 addresses + This is a modern console tool to assist in network address calculations for + IPv4 and IPv6. + . + It acts as a tool to output human readable information about a network or + address, as well as a tool suitable to be used by scripts or other programs. + . + It's also a great tool for teach about network address calculations, as well + as learn about it. + . + It supports printing a summary about the provided network address, multiple + command line options per information to be printed, transparent IPv6 support, + and in addition it will use libGeoIP, if available, to provide geographic + information. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..2db1c54 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,109 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ipcalc +Upstream-Contact: https://gitlab.com/ipcalc/ipcalc/-/issues/new +Source: https://gitlab.com/ipcalc/ipcalc + +Files: * +Copyright: 1997-2020 Red Hat, Inc. All rights reserved. + 2019-2021 Nikos Mavrogiannopoulos <nmav@redhat.com> +License: GPL-2 + +Files: deaggregate.c + ipcalc-geoip.c + ipcalc-reverse.c + ipv6.c +Copyright: 1991-2014 Free Software Foundation, Inc. + 2015 Red Hat, Inc. All rights reserved. + 2019 Nikos Mavrogiannopoulos <nmav@redhat.com> +License: GPL-2+ + +Files: tests/ipcalc-delegate-ipv6-random.sh + tests/ipcalc-delegate-split-ipv4.sh + tests/ipcalc-delegate-split-ipv6.sh +Copyright: 2019 Nikos Mavrogiannopoulos <nmav@redhat.com> +License: GPL-3+ + +Files: netsplit.c +Copyright: 2003-2016 Simon Ekstrand <simon@routemeister.net> + 2010-2016 Joachim Nilsson <troglobit@gmail.com> + 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> +License: BSD-3-Clause + +Files: debian/* +Copyright: 2020-2023 Fabio Augusto De Muzio Tobich <ftobich@debian.org> +License: BSD-3-Clause + +License: GPL-2 + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/> + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/> + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +License: BSD-3-Clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/manpages b/debian/manpages new file mode 100644 index 0000000..6c0571a --- /dev/null +++ b/debian/manpages @@ -0,0 +1 @@ +#debian/manpage/ipcalc-ng.1 diff --git a/debian/patches/010_new-name-adjustments.patch b/debian/patches/010_new-name-adjustments.patch new file mode 100644 index 0000000..e0fb7c4 --- /dev/null +++ b/debian/patches/010_new-name-adjustments.patch @@ -0,0 +1,558 @@ +Description: some adjustments made to change the name to ipcalc-ng + The original upstream name is ipcalc, since already there's a debian + package with this name we had to rename this one to ipcalc-ng, so + some adjustments had to be made to the upstream src and manpage. +Author: Fabio Augusto De Muzio Tobich <ftobich@debian.org> +Forwarded: no +Last-Update: 2023-06-12 +Index: ipcalc-ng/deaggregate.c +=================================================================== +--- ipcalc-ng.orig/deaggregate.c ++++ ipcalc-ng/deaggregate.c +@@ -62,7 +62,7 @@ void deaggregate(char *str, unsigned fla + if (d1Str == NULL) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: bad deaggregation string: %s\n", str); ++ "ipcalc-ng: bad deaggregation string: %s\n", str); + exit(1); + } + d1Str = trim(d1Str); +@@ -72,7 +72,7 @@ void deaggregate(char *str, unsigned fla + if (d2Str == NULL) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: bad deaggregation string: %s\n", str); ++ "ipcalc-ng: bad deaggregation string: %s\n", str); + exit(1); + } + d2Str = trim(d2Str); +@@ -108,14 +108,14 @@ void deaggregate_v4(const char *ip1s, co + + if (inet_pton(AF_INET, ip1s, &ip1) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv4 address: %s\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv4 address: %s\n", + ip1s); + exit(1); + } + + if (inet_pton(AF_INET, ip2s, &ip2) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv4 address: %s\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv4 address: %s\n", + ip2s); + exit(1); + } +@@ -125,7 +125,7 @@ void deaggregate_v4(const char *ip1s, co + + if (base > end) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad range\n"); ++ fprintf(stderr, "ipcalc-ng: bad range\n"); + exit(1); + } + +@@ -183,14 +183,14 @@ void deaggregate_v6(const char *ip1s, co + + if (inet_pton(AF_INET6, ip1s, &ip1) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 address: %s\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv6 address: %s\n", + ip1s); + exit(1); + } + + if (inet_pton(AF_INET6, ip2s, &ip2) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 address: %s\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv6 address: %s\n", + ip2s); + exit(1); + } +@@ -200,7 +200,7 @@ void deaggregate_v6(const char *ip1s, co + + if (ipv6_cmp(&base, &end) > 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 range\n"); ++ fprintf(stderr, "ipcalc-ng: bad IPv6 range\n"); + exit(1); + } + +Index: ipcalc-ng/ipcalc-geoip.c +=================================================================== +--- ipcalc-ng.orig/ipcalc-geoip.c ++++ ipcalc-ng/ipcalc-geoip.c +@@ -77,7 +77,7 @@ int geo_setup(void) + + ld = dlopen(LIBNAME, RTLD_LAZY); + if (ld == NULL) { +- snprintf(err, sizeof(err), "ipcalc: could not open %s\n", LIBNAME); ++ snprintf(err, sizeof(err), "ipcalc-ng: could not open %s\n", LIBNAME); + ret = -1; + goto exit; + } +@@ -97,7 +97,7 @@ int geo_setup(void) + pGeoIP_delete == NULL || pGeoIP_record_by_ipnum == NULL || + pGeoIP_id_by_ipnum == NULL || pGeoIP_id_by_ipnum_v6 == NULL || + pGeoIP_record_by_ipnum_v6 == NULL) { +- snprintf(err, sizeof(err), "ipcalc: could not find symbols in libGeoIP\n"); ++ snprintf(err, sizeof(err), "ipcalc-ng: could not find symbols in libGeoIP\n"); + ret = -1; + goto exit; + } +Index: ipcalc-ng/ipcalc-maxmind.c +=================================================================== +--- ipcalc-ng.orig/ipcalc-maxmind.c ++++ ipcalc-ng/ipcalc-maxmind.c +@@ -77,7 +77,7 @@ int geo_setup(void) + + ld = dlopen(LIBNAME, RTLD_LAZY); + if (ld == NULL) { +- snprintf(err, sizeof(err), "ipcalc: could not open %s\n", LIBNAME); ++ snprintf(err, sizeof(err), "ipcalc-ng: could not open %s\n", LIBNAME); + ret = -1; + goto exit; + } +@@ -91,7 +91,7 @@ int geo_setup(void) + pMMDB_get_value == NULL || + pMMDB_lookup_string == NULL || + pMMDB_open == NULL) { +- snprintf(err, sizeof(err), "ipcalc: could not find symbols in libmaxmind\n"); ++ snprintf(err, sizeof(err), "ipcalc-ng: could not find symbols in libmaxmind\n"); + ret = -1; + goto exit; + } +Index: ipcalc-ng/ipcalc.1.md +=================================================================== +--- ipcalc-ng.orig/ipcalc.1.md ++++ ipcalc-ng/ipcalc.1.md +@@ -1,12 +1,12 @@ +-# ipcalc(1) - Perform simple operations on IP addresses and networks ++# ipcalc-ng(1) - Perform simple operations on IP addresses and networks + + ## SYNOPSIS +-**ipcalc** [OPTION]... <IP address>[/prefix] [netmask] ++**ipcalc-ng** [OPTION]... <IP address>[/prefix] [netmask] + + + ## Description + +-**ipcalc** provides a simple way to calculate IP information for a host ++**ipcalc-ng** provides a simple way to calculate IP information for a host + or network. Depending on the options specified, it may be used to provide + IP network information in human readable format, in a format suitable for + parsing in scripts, generate random private addresses, resolve an IP address, +@@ -18,7 +18,7 @@ Otherwise the output is JSON formatted w + or when specific options are given (e.g., **--prefix**) the output is + in the **VAR=VALUE** format. + +-The various options specify what information **ipcalc** should display ++The various options specify what information **ipcalc-ng** should display + on standard output. Multiple options may be specified. It is required + to specify an IP address; several operations require + a netmask or a CIDR prefix as well. +@@ -41,7 +41,7 @@ a netmask or a CIDR prefix as well. + Split the provided network using the specified prefix or netmask. That is, + split up the network into smaller chunks of a specified prefix. When + combined with no-decorate mode (**--no-decorate**), the split networks +- will be printed in raw form. Example "ipcalc -S 26 192.168.1.0/24". ++ will be printed in raw form. Example "ipcalc-ng -S 26 192.168.1.0/24". + + * **-d**, **--deaggregate** + Deaggregates the provided address range. That is, print the networks that +@@ -138,7 +138,7 @@ a netmask or a CIDR prefix as well. + + ### Display all information of an IPv4 + +- $ ipcalc --all-info 193.92.150.2/24 ++ $ ipcalc-ng --all-info 193.92.150.2/24 + Address: 193.92.150.2 + Network: 193.92.150.0/24 + Netmask: 255.255.255.0 = 24 +@@ -156,7 +156,7 @@ a netmask or a CIDR prefix as well. + + ### Display information in key-value format + +- $ ipcalc -pnmb --minaddr --maxaddr --geoinfo --addrspace 193.92.150.2/255.255.255.224 ++ $ ipcalc-ng -pnmb --minaddr --maxaddr --geoinfo --addrspace 193.92.150.2/255.255.255.224 + NETMASK=255.255.255.224 + PREFIX=27 + BROADCAST=193.92.150.31 +@@ -168,7 +168,7 @@ a netmask or a CIDR prefix as well. + + ### Display all information of an IPv6 + +- $ ipcalc --all-info 2a03:2880:20:4f06:face:b00c:0:14/64 ++ $ ipcalc-ng --all-info 2a03:2880:20:4f06:face:b00c:0:14/64 + Full Address: 2a03:2880:0020:4f06:face:b00c:0000:0014 + Address: 2a03:2880:20:4f06:face:b00c:0:14 + Full Network: 2a03:2880:0020:4f06:0000:0000:0000:0000/64 +@@ -186,7 +186,7 @@ a netmask or a CIDR prefix as well. + + ### Display JSON output + +- $ ipcalc --all-info -j 2a03:2880:20:4f06:face:b00c:0:14/64 ++ $ ipcalc-ng --all-info -j 2a03:2880:20:4f06:face:b00c:0:14/64 + { + "FULLADDRESS":"2a03:2880:0020:4f06:face:b00c:0000:0014", + "ADDRESS":"2a03:2880:20:4f06:face:b00c:0:14", +@@ -206,17 +206,17 @@ a netmask or a CIDR prefix as well. + + ### Lookup of a hostname + +- $ ipcalc --lookup-host localhost --no-decorate ++ $ ipcalc-ng --lookup-host localhost --no-decorate + ::1 + + ### IPv4 lookup of a hostname + +- $ ipcalc --lookup-host localhost --no-decorate -4 ++ $ ipcalc-ng --lookup-host localhost --no-decorate -4 + 127.0.0.1 + + ### Reverse lookup of a hostname + +- $ ipcalc -h 127.0.0.1 --no-decorate ++ $ ipcalc-ng -h 127.0.0.1 --no-decorate + localhost + + ## Authors +Index: ipcalc-ng/ipcalc.c +=================================================================== +--- ipcalc-ng.orig/ipcalc.c ++++ ipcalc-ng/ipcalc.c +@@ -46,13 +46,13 @@ static unsigned flags = 0; + \file ipcalc.c + \brief provides utilities for manipulating IP addresses. + +- ipcalc provides utilities and a front-end command line interface for ++ ipcalc-ng provides utilities and a front-end command line interface for + manipulating IP addresses, and calculating various aspects of an ip + address/netmask/network address/prefix/etc. + + Functionality can be accessed from other languages from the library +- interface, documented here. To use ipcalc from the shell, read the +- ipcalc(1) manual page. ++ interface, documented here. To use ipcalc-ng from the shell, read the ++ ipcalc-ng(1) manual page. + + When passing parameters to the various functions, take note of whether they + take host byte order or network byte order. Most take host byte order, and +@@ -588,7 +588,7 @@ int get_ipv4_info(const char *ipStr, int + + if (inet_pton(AF_INET, ipStr, &ip) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv4 address: %s\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv4 address: %s\n", + ipStr); + return -1; + } +@@ -625,14 +625,14 @@ int get_ipv4_info(const char *ipStr, int + + if (prefix > 32) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv4 prefix %d\n", prefix); ++ fprintf(stderr, "ipcalc-ng: bad IPv4 prefix %d\n", prefix); + return -1; + } + + if (inet_ntop(AF_INET, &ip, namebuf, sizeof(namebuf)) == 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: error calculating the IPv4 network\n"); ++ "ipcalc-ng: error calculating the IPv4 network\n"); + return -1; + } + info->ip = safe_strdup(namebuf); +@@ -695,7 +695,7 @@ int get_ipv4_info(const char *ipStr, int + if (inet_ntop(AF_INET, &maxhost, namebuf, sizeof(namebuf)) == 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: error calculating the IPv4 network\n"); ++ "ipcalc-ng: error calculating the IPv4 network\n"); + return -1; + } + +@@ -718,7 +718,7 @@ int get_ipv4_info(const char *ipStr, int + if (info->hostname == NULL) { + if (!beSilent) { + sprintf(errBuf, +- "ipcalc: cannot find hostname for %s", ++ "ipcalc-ng: cannot find hostname for %s", + ipStr); + herror(errBuf); + } +@@ -897,7 +897,7 @@ int get_ipv6_info(const char *ipStr, int + + if (inet_pton(AF_INET6, ipStr, &ip6) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 address: %s\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv6 address: %s\n", + ipStr); + return -1; + } +@@ -908,7 +908,7 @@ int get_ipv6_info(const char *ipStr, int + if (inet_ntop(AF_INET6, &ip6, errBuf, sizeof(errBuf)) == 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: error calculating the IPv6 network\n"); ++ "ipcalc-ng: error calculating the IPv6 network\n"); + return -1; + } + +@@ -916,7 +916,7 @@ int get_ipv6_info(const char *ipStr, int + + if (prefix > 128) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 prefix: %d\n", ++ fprintf(stderr, "ipcalc-ng: bad IPv6 prefix: %d\n", + prefix); + return -1; + } else if (prefix < 0) { +@@ -928,7 +928,7 @@ int get_ipv6_info(const char *ipStr, int + if (ipv6_prefix_to_mask(prefix, &mask) == -1) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: error converting IPv6 prefix: %d\n", ++ "ipcalc-ng: error converting IPv6 prefix: %d\n", + prefix); + return -1; + } +@@ -941,7 +941,7 @@ int get_ipv6_info(const char *ipStr, int + if (inet_ntop(AF_INET6, &network, errBuf, sizeof(errBuf)) == 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: error calculating the IPv6 network\n"); ++ "ipcalc-ng: error calculating the IPv6 network\n"); + return -1; + } + +@@ -960,7 +960,7 @@ int get_ipv6_info(const char *ipStr, int + if (inet_ntop(AF_INET6, &network, errBuf, sizeof(errBuf)) == 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: error calculating the IPv6 network\n"); ++ "ipcalc-ng: error calculating the IPv6 network\n"); + return -1; + } + +@@ -983,7 +983,7 @@ int get_ipv6_info(const char *ipStr, int + if (info->hostname == NULL) { + if (!beSilent) { + sprintf(errBuf, +- "ipcalc: cannot find hostname for %s", ++ "ipcalc-ng: cannot find hostname for %s", + ipStr); + herror(errBuf); + } +@@ -1131,7 +1131,7 @@ static + void usage(unsigned verbose) + { + if (verbose) { +- fprintf(stderr, "Usage: ipcalc [OPTION...]\n"); ++ fprintf(stderr, "Usage: ipcalc-ng [OPTION...]\n"); + fprintf(stderr, " -c, --check Validate IP address\n"); + fprintf(stderr, " -r, --random-private=PREFIX Generate a random private IP network using\n"); + fprintf(stderr, " the supplied prefix or mask.\n"); +@@ -1175,7 +1175,7 @@ void usage(unsigned verbose) + fprintf(stderr, " -?, --help Show this help message\n"); + fprintf(stderr, " --usage Display brief usage message\n"); + } else { +- fprintf(stderr, "Usage: ipcalc [-46sv?] [-c|--check] [-r|--random-private=STRING] [-i|--info]\n"); ++ fprintf(stderr, "Usage: ipcalc-ng [-46sv?] [-c|--check] [-r|--random-private=STRING] [-i|--info]\n"); + fprintf(stderr, " [--all-info] [-4|--ipv4] [-6|--ipv6] [-a|--address] [-b|--broadcast]\n"); + fprintf(stderr, " [-h|--hostname] [-o|--lookup-host=STRING] [-g|--geoinfo]\n"); + fprintf(stderr, " [-m|--netmask] [-n|--network] [-p|--prefix] [--minaddr] [--maxaddr]\n"); +@@ -1425,12 +1425,12 @@ dist_printf(unsigned * const jsonfirst, + + /*! + \fn main(int argc, const char **argv) +- \brief wrapper program for ipcalc functions. ++ \brief wrapper program for ipcalc-ng functions. + +- This is a wrapper program for the functions that the ipcalc library provides. ++ This is a wrapper program for the functions that the ipcalc-ng library provides. + It can be used from shell scripts or directly from the command line. + +- For more information, please see the ipcalc(1) man page. ++ For more information, please see the ipcalc-ng(1) man page. + */ + int main(int argc, char **argv) + { +@@ -1565,7 +1565,7 @@ int main(int argc, char **argv) + if (ipStr != NULL) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: superfluous option given\n"); ++ "ipcalc-ng: superfluous option given\n"); + exit(1); + } + +@@ -1591,14 +1591,14 @@ int main(int argc, char **argv) + if (bit_count(app) > 1) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: you cannot mix these options\n"); ++ "ipcalc-ng: you cannot mix these options\n"); + return 1; + } + + if ((flags & FLAG_IPV6) && (flags & FLAG_IPV4)) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: you cannot specify both IPv4 and IPv6\n"); ++ "ipcalc-ng: you cannot specify both IPv4 and IPv6\n"); + return 1; + } + +@@ -1613,7 +1613,7 @@ int main(int argc, char **argv) + + switch (app) { + case APP_VERSION: +- printf("ipcalc %s\n", VERSION); ++ printf("ipcalc-ng %s\n", VERSION); + return 0; + case APP_DEAGGREGATE: + deaggregate(ipStr, flags); +@@ -1631,7 +1631,7 @@ int main(int argc, char **argv) + if (ipStr) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: provided superfluous parameter '%s'\n", ipStr); ++ "ipcalc-ng: provided superfluous parameter '%s'\n", ipStr); + return 1; + } + +@@ -1639,7 +1639,7 @@ int main(int argc, char **argv) + if (prefix < 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: bad %s prefix: %s\n", (flags&FLAG_IPV6)?"IPv6":"IPv4", randomStr); ++ "ipcalc-ng: bad %s prefix: %s\n", (flags&FLAG_IPV6)?"IPv6":"IPv4", randomStr); + return 1; + } + +@@ -1647,7 +1647,7 @@ int main(int argc, char **argv) + if (ipStr == NULL) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: cannot generate network with prefix: %u\n", ++ "ipcalc-ng: cannot generate network with prefix: %u\n", + prefix); + return 1; + } +@@ -1656,7 +1656,7 @@ int main(int argc, char **argv) + if (hostname == NULL && ipStr == NULL) { + if (!beSilent) { + fprintf(stderr, +- "ipcalc: ip address expected\n"); ++ "ipcalc-ng: ip address expected\n"); + usage(1); + } + return 1; +@@ -1674,7 +1674,7 @@ int main(int argc, char **argv) + if (ipStr == NULL) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: could not resolve %s\n", hostname); ++ "ipcalc-ng: could not resolve %s\n", hostname); + return 1; + } + +@@ -1688,7 +1688,7 @@ int main(int argc, char **argv) + prefixStr = chptr; + } else { + if (!beSilent) { +- fprintf(stderr, "ipcalc: unexpected argument: %s\n", ++ fprintf(stderr, "ipcalc-ng: unexpected argument: %s\n", + chptr); + usage(1); + } +@@ -1707,7 +1707,7 @@ int main(int argc, char **argv) + if (prefix < 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: bad %s prefix: %s\n", (flags & FLAG_IPV6)?"IPv6":"IPv4", prefixStr); ++ "ipcalc-ng: bad %s prefix: %s\n", (flags & FLAG_IPV6)?"IPv6":"IPv4", prefixStr); + return 1; + } + } +@@ -1719,7 +1719,7 @@ int main(int argc, char **argv) + if (netmaskStr && prefix >= 0) { + if (!beSilent) { + fprintf(stderr, +- "ipcalc: both netmask and prefix specified\n"); ++ "ipcalc-ng: both netmask and prefix specified\n"); + usage(1); + } + return 1; +@@ -1731,7 +1731,7 @@ int main(int argc, char **argv) + if (prefix < 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: bad IPv4 prefix: %s\n", prefixStr); ++ "ipcalc-ng: bad IPv4 prefix: %s\n", prefixStr); + return 1; + } + } +@@ -1748,7 +1748,7 @@ int main(int argc, char **argv) + if (splitPrefix < 0) { + if (!beSilent) + fprintf(stderr, +- "ipcalc: bad %s prefix: %s\n", (flags & FLAG_IPV6)?"IPv6":"IPv4", splitStr); ++ "ipcalc-ng: bad %s prefix: %s\n", (flags & FLAG_IPV6)?"IPv6":"IPv4", splitStr); + return 1; + } + +Index: ipcalc-ng/netsplit.c +=================================================================== +--- ipcalc-ng.orig/netsplit.c ++++ ipcalc-ng/netsplit.c +@@ -67,14 +67,14 @@ void show_split_networks_v4(unsigned spl + + if (inet_pton(AF_INET, info->network, &net) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv4 address: %s\n", info->network); ++ fprintf(stderr, "ipcalc-ng: bad IPv4 address: %s\n", info->network); + exit(1); + } + net.s_addr = ntohl(net.s_addr); + + if (inet_pton(AF_INET, info->broadcast, &broadcast) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad broadcast address: %s\n", info->broadcast); ++ fprintf(stderr, "ipcalc-ng: bad broadcast address: %s\n", info->broadcast); + exit(1); + } + broadcast.s_addr = ntohl(broadcast.s_addr); +@@ -145,25 +145,25 @@ void show_split_networks_v6(unsigned spl + + if (inet_pton(AF_INET6, info->network, &net) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 address: %s\n", info->network); ++ fprintf(stderr, "ipcalc-ng: bad IPv6 address: %s\n", info->network); + exit(1); + } + + if (inet_pton(AF_INET6, info->hostmax, &netlast) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 address: %s\n", info->hostmax); ++ fprintf(stderr, "ipcalc-ng: bad IPv6 address: %s\n", info->hostmax); + exit(1); + } + + if (inet_pton(AF_INET6, info->netmask, &netmask) <= 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: bad IPv6 mask: %s\n", info->netmask); ++ fprintf(stderr, "ipcalc-ng: bad IPv6 mask: %s\n", info->netmask); + exit(1); + } + + if (ipv6_prefix_to_mask(split_prefix, &splitmask) < 0) { + if (!beSilent) +- fprintf(stderr, "ipcalc: IPv6 prefix: %d\n", split_prefix); ++ fprintf(stderr, "ipcalc-ng: IPv6 prefix: %d\n", split_prefix); + exit(1); + } + diff --git a/debian/patches/020_disable-few-tests.patch b/debian/patches/020_disable-few-tests.patch new file mode 100644 index 0000000..78f280e --- /dev/null +++ b/debian/patches/020_disable-few-tests.patch @@ -0,0 +1,57 @@ +Description: disable two upstream tests + Two of the tests provided by upstream is failing when building using + cowbuilder, it works on a clean jail and on salsa tests. + Not an upstream problem. +Author: Fabio Augusto De Muzio Tobich <ftobich@debian.org> +Forwarded: no +Last-Update: 2023-06-12 +Index: ipcalc-ng/tests/meson.build +=================================================================== +--- ipcalc-ng.orig/tests/meson.build ++++ ipcalc-ng/tests/meson.build +@@ -71,14 +71,14 @@ test('RandomIPv6Explicit', + ipcalc.full_path() + ' -6 -r 24' + '|grep Address' + ] + ) +-test('HostnameIPv6Localhost', +- testrunner, +- args : [ +- '--test-outfile', +- ipcalc.full_path() + ' -6 -o localhost', +- files('hostname-localhost-ipv6') +- ] +-) ++#test('HostnameIPv6Localhost', ++# testrunner, ++# args : [ ++# '--test-outfile', ++# ipcalc.full_path() + ' -6 -o localhost', ++# files('hostname-localhost-ipv6') ++# ] ++#) + test('HostnameIPv4Localhost', + testrunner, + args : [ +@@ -95,14 +95,14 @@ test('HostnameIPv4LocalhostJson', + files('hostname-localhost-ipv4-json') + ] + ) +-test('IPIPv6Localhost', +- testrunner, +- args : [ +- '--test-outfile', +- ipcalc.full_path() + ' -h ::1', +- files('ip-localhost-ipv6') +- ] +-) ++#test('IPIPv6Localhost', ++# testrunner, ++# args : [ ++# '--test-outfile', ++# ipcalc.full_path() + ' -h ::1', ++# files('ip-localhost-ipv6') ++# ] ++#) + test('IPIPv4Localhost', + testrunner, + args : [ diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..1843c00 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +010_new-name-adjustments.patch +020_disable-few-tests.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..5709dbb --- /dev/null +++ b/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +BINDEST=debian/ipcalc-ng/usr/bin +MANDEST=debian/ipcalc-ng/usr/share/man/man1 + +%: + dh $@ --buildsystem=meson + +override_dh_installchangelogs: + dh_installchangelogs NEWS + +override_dh_installman: + dh_installman + mv $(MANDEST)/ipcalc.1 $(MANDEST)/ipcalc-ng.1 + +override_dh_auto_install: + dh_auto_install + mv $(BINDEST)/ipcalc $(BINDEST)/ipcalc-ng diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..8424db4 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,3 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 0000000..8ac5213 --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,5 @@ +# Temporarily replacing the upstream manpage because Debian's ruby-ronn has a +# bug that causes the manpage to be built incorrectly. Once the ruby-ronn is +# fixed in Debian the upstream manpage will be used. +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964322 +#ipcalc-ng source: maintainer-manual-page debian/manpage/ipcalc-ng.1 diff --git a/debian/tests/check b/debian/tests/check new file mode 100644 index 0000000..12f860a --- /dev/null +++ b/debian/tests/check @@ -0,0 +1,4 @@ +ipcalc-ng -c 192.168.0.1 +ipcalc-ng -c 192.168.0.256 2>&1 | grep 'bad IPv4 address' +ipcalc-ng -c 2804:14c:87c5:d3f8:6245:cbff:fe6d:d19/64 +ipcalc-ng -c 2804:14c:87c5:d3f8:6245:cbff:fe6d:g19/64 2>&1 | grep 'bad IPv6 address' diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..520037c --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,15 @@ +Test-Command: ipcalc-ng -v +Restrictions: superficial + +Test-Command: ipcalc-ng --help 2>&1 | grep '^Usage:' +Restrictions: superficial + +Tests: check, deagrregate, geo, info, net, random, reversedns, split +Depends: @, geoip-database, libgeoip1 + +Tests: json +Depends: @, geoip-database, libgeoip1, jq + +Tests: resolv +Depends: @, geoip-database, libgeoip1 +Restrictions: flaky diff --git a/debian/tests/deagrregate b/debian/tests/deagrregate new file mode 100644 index 0000000..416b6ce --- /dev/null +++ b/debian/tests/deagrregate @@ -0,0 +1,2 @@ +ipcalc-ng -d 192.168.1.3-192.168.1.23 | grep -A4 'Deaggregated' +ipcalc-ng --no-decorate -d 192.168.1.3-192.168.1.23 | grep '^192\.' diff --git a/debian/tests/geo b/debian/tests/geo new file mode 100644 index 0000000..b01728a --- /dev/null +++ b/debian/tests/geo @@ -0,0 +1,4 @@ +ipcalc-ng -g 200.189.123.110 | egrep '(COUNTRYCODE=BR|COUNTRY=Brazil)' +ipcalc-ng -g 193.92.150.2/255.255.255.224 | egrep '(COUNTRYCODE=GR|COUNTRY=Greece)' +ipcalc-ng -g 2a03:2880:20:4f06:face:b00c:0:14/64 | egrep '(COUNTRYCODE=IE|COUNTRY=Ireland)' +ipcalc-ng -g 2804:14c:87c5:d3f8:6245:cbff:fe6d:d19/64 | egrep '(COUNTRYCODE=BR|COUNTRY=Brazil)' diff --git a/debian/tests/info b/debian/tests/info new file mode 100644 index 0000000..8f11db7 --- /dev/null +++ b/debian/tests/info @@ -0,0 +1,4 @@ +ipcalc-ng --all-info 193.92.150.2/24 +ipcalc-ng --all-info 2a03:2880:20:4f06:face:b00c:0:14/64 +ipcalc-ng -pnmb --minaddr --maxaddr --geoinfo --addrspace 193.92.150.2/255.255.255.224 +ipcalc-ng -pnmb --minaddr --maxaddr --addrspace --geoinfo 2a03:2880:20:4f06:face:b00c:0:14/64 diff --git a/debian/tests/json b/debian/tests/json new file mode 100644 index 0000000..a8c16ff --- /dev/null +++ b/debian/tests/json @@ -0,0 +1,2 @@ +ipcalc-ng --all-info -j 2a03:2880:20:4f06:face:b00c:0:14/64 | jq . +ipcalc-ng --all-info -j 200.202.17.0/24 | jq . diff --git a/debian/tests/net b/debian/tests/net new file mode 100644 index 0000000..d679754 --- /dev/null +++ b/debian/tests/net @@ -0,0 +1,11 @@ +ipcalc-ng -a 192.168.1.1 +ipcalc-ng -b 192.168.1.1 +ipcalc-ng -b 192.168.1.0 +ipcalc-ng -b 192.168.1.0/24 +ipcalc-ng -b 192.168.1.0/32 +ipcalc-ng -b 192.168.1.0/24 +ipcalc-ng -a 192.168.1.0/24 +ipcalc-ng -m 192.168.1.0/24 +ipcalc-ng -m 192.168.1.1 +ipcalc-ng -p 192.168.1.1 +ipcalc-ng -p 192.168.1.0/255.255.255.0 diff --git a/debian/tests/random b/debian/tests/random new file mode 100644 index 0000000..a05244b --- /dev/null +++ b/debian/tests/random @@ -0,0 +1,7 @@ +ipcalc-ng -r 24 | grep '255.255.255.0 = 24' +ipcalc-ng -r 29 | grep '255.255.255.248 = 29' +ipcalc-ng -r 30 | grep '255.255.255.252 = 30' +ipcalc-ng -r 255.255.255.0 | grep '255.255.255.0 = 24' +ipcalc-ng -r 255.255.255.248 | grep '255.255.255.248 = 29' +ipcalc-ng -r 255.255.255.252 | grep '255.255.255.252 = 30' + diff --git a/debian/tests/resolv b/debian/tests/resolv new file mode 100644 index 0000000..9c4defb --- /dev/null +++ b/debian/tests/resolv @@ -0,0 +1,2 @@ +ipcalc-ng -h 8.8.8.8 | grep 'HOSTNAME=.*google*' +ipcalc-ng -o pr.gov.br diff --git a/debian/tests/reversedns b/debian/tests/reversedns new file mode 100644 index 0000000..b364534 --- /dev/null +++ b/debian/tests/reversedns @@ -0,0 +1,2 @@ +ipcalc-ng --reverse-dns 10.0.0.1 | grep '1.0.0.10.in-addr.arpa' +ipcalc-ng --reverse-dns 10.0.0.0/8 | grep '10.in-addr.arpa' diff --git a/debian/tests/split b/debian/tests/split new file mode 100644 index 0000000..2b50a63 --- /dev/null +++ b/debian/tests/split @@ -0,0 +1 @@ +ipcalc-ng -S 30 192.168.0.0/24 | grep -A2 'Total.*64' diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..4896264 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,5 @@ +Bug-Database: https://gitlab.com/ipcalc/ipcalc/-/issues +Bug-Submit: https://gitlab.com/ipcalc/ipcalc/-/issues/new +Changelog: https://gitlab.com/ipcalc/ipcalc/-/blob/master/NEWS +Repository: https://gitlab.com/ipcalc/ipcalc.git +Repository-Browse: https://gitlab.com/ipcalc/ipcalc diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..5b55845 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts=filenamemangle=s/.*\/archive\/(\d\S+)\/ipcalc.*\.tar\.gz/ipcalc-$1\.tar\.gz/g \ + https://gitlab.com/ipcalc/ipcalc/-/tags?sort=updated_desc .*/archive/(\d\S+)/.*\.tar\.gz.* |