From 9220701dae03ccd8c88c7ece084ccfaf07fdbb1e Mon Sep 17 00:00:00 2001 From: Julien Semaan Date: Thu, 28 Oct 2021 09:19:11 -0400 Subject: [PATCH] add fixes for #6636 to maintenance/11.0 --- addons/functions/configuration.functions | 12 ++++++++---- debian/control | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/functions/configuration.functions b/addons/functions/configuration.functions index 46be758647a9..34ab9abf1eec 100644 --- a/addons/functions/configuration.functions +++ b/addons/functions/configuration.functions @@ -42,13 +42,17 @@ function get_os_ip_address() { ip -br -o a show dev $1 | egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 } +function get_os_ip_cidr() { + ip -br -o a show dev $1 | egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+' | head -1 +} + function get_os_netmask() { - os_ip=`get_os_ip_address $1` - ipcalc_wrapper $os_ip | grep "^Netmask:" | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' + ip_cidr=`get_os_ip_cidr $1` + ipcalc_wrapper $ip_cidr | grep "^Netmask:" | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' } function get_os_network() { - ip_cidr=`ip -br -o a show dev $1 | egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+' | head -1` + ip_cidr=`get_os_ip_cidr $1` get_ip_network $ip_cidr } @@ -86,7 +90,7 @@ function rewrite_pf_ip_address() { # This will rewrite references to the old IP in any routed networks echo "Rewriting $old_ip to $new_ip in networks.conf" old_ip_escaped=`echo "$old_ip" | sed 's/\./\\./g'` - sed -i 's/'$old_ip_escaped'/'$new_ip'/g' conf/networks.conf + sed -i 's/=\s*'$old_ip_escaped'\s*$/='$new_ip'/g' /usr/local/pf/conf/networks.conf else echo "The new IP ($new_ip) is not in the same network as the previous IP address ($old_ip). This tool will not be able to migrate the configuration in networks.conf. Make sure you adjust it manually with the new IP settings after this script completes. Press enter to continue..." read diff --git a/debian/control b/debian/control index 3b700d5bc3d2..720d7a24510a 100644 --- a/debian/control +++ b/debian/control @@ -33,7 +33,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,