Skip to content

Commit

Permalink
use ipcalc-ng on debian 11
Browse files Browse the repository at this point in the history
related to #6636
  • Loading branch information
julsemaan committed Oct 21, 2021
1 parent 378723f commit f53eca1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions addons/functions/configuration.functions
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

function ipcalc_wrapper() {
if is_deb_based; then
ipcalc-ng $@
else
ipcalc $@
fi
}

function get_config_files() {
files=`perl -I/usr/local/pf/lib_perl/lib/perl5 -I/usr/local/pf/lib -Mpf::file_paths -e 'print join("\n", @pf::file_paths::stored_config_files) . "\n"'`
files="$files /usr/local/pf/conf/pfconfig.conf"
Expand Down Expand Up @@ -36,7 +44,7 @@ function get_os_ip_address() {

function get_os_netmask() {
os_ip=`get_os_ip_address $1`
ipcalc $os_ip | grep "^Netmask:" | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'
ipcalc_wrapper $os_ip | grep "^Netmask:" | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'
}

function get_os_network() {
Expand All @@ -45,11 +53,7 @@ function get_os_network() {
}

function get_ip_network() {
if is_rpm_based; then
ipcalc $1 --class-prefix | grep '^Network' | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'
else
ipcalc $1 | grep '^Network' | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'
fi
ipcalc_wrapper $1 --class-prefix | grep '^Network' | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'
}

function get_pf_ip_address() {
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Depends: ${misc:Depends}, vlan,
mariadb-client (>= 10.5.10),
snmp, snmptrapfmt, snmptrapd, snmp-mibs-downloader, conntrack, rsyslog,
# for import/export scripts
ipcalc,
ipcalc, ipcalc-ng,
# apache related
apache2, apache2-utils,
libapache2-mod-apreq2, libapache2-mod-perl2,
Expand Down

0 comments on commit f53eca1

Please sign in to comment.