Patch adds a check to make sure that the user specified static_ip_range
argument (Ex. 192.168.0.10,192.168.0.20) falls within the valid public
subnet of the host (the same subnet as the default gateway).
JIRA: APEX-19
Change-Id: Ifc0b79074b887509617c2749e50d97d1800abad0
Signed-off-by: Tim Rozet <trozet@redhat.com>
(cherry picked from commit
50fe670726f2229ef963517a890fef2d821b8821)
##set variable info
if [ ! -z "$static_ip_range" ]; then
new_ip=$(echo $static_ip_range | cut -d , -f1)
+ subnet_mask=$(find_netmask $this_default_gw_interface)
+ host_subnet=$(find_subnet $interface_ip $subnet_mask)
+ ip_range_subnet=$(find_subnet $new_ip $subnet_mask)
+ if [ "$ip_range_subnet" != "$host_subnet" ]; then
+ echo "${red}static_ip_range: ${static_ip_range} is not in the same subnet as your default gateway interface: ${host_subnet}. Please use a correct range!${reset}"
+ exit 1
+ fi
else
new_ip=$(next_usable_ip $interface_ip)
if [ ! "$new_ip" ]; then