Skip to content

Commit

Permalink
add fixes for #6636 to maintenance/11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
julsemaan committed Oct 28, 2021
1 parent 1e0200d commit 9220701
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions addons/functions/configuration.functions
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9220701

Please sign in to comment.