more fixes on device based routing

This commit is contained in:
Arif Ali 2014-03-27 22:22:11 +00:00
parent abbd20549a
commit 8f3b04bd1a

View File

@ -614,7 +614,11 @@ sub set_route {
}
} else {
if (xCAT::Utils->isLinux()) {
$cmd="route add -net $net netmask $mask gw $gw_ip dev $ifname";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route add -net $net netmask $mask dev $ifname";
} else {
$cmd="route add -net $net netmask $mask gw $gw_ip";
}
} else {
$cmd="route add -net $net -netmask $mask $gw_ip";
}
@ -1125,7 +1129,11 @@ sub addPersistentRoute_Debian{
}
else { #ipv4
$cmd = "grep \"-net $net netmask $mask gw $gw_ip\" $conf_file";
$route_conf = " up route add -net $net netmask $mask gw $gw_ip dev $ifname \n down route del -net $net netmask $mask gw $gw_ip dev $ifname\n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname\n";
} else {
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
}
}
#fine the corresponding config in the config file