From 9cfc75f7c81a2b6c62a19e4d83ddc2b42b107df5 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Thu, 27 Mar 2014 22:22:11 +0000 Subject: [PATCH] more fixes on device based routing Conflicts: xCAT-server/lib/xcat/plugins/route.pm --- xCAT-server/lib/xcat/plugins/route.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/route.pm b/xCAT-server/lib/xcat/plugins/route.pm index 8ec31df6c..3acd90217 100644 --- a/xCAT-server/lib/xcat/plugins/route.pm +++ b/xCAT-server/lib/xcat/plugins/route.pm @@ -614,7 +614,11 @@ sub set_route { } } else { if (xCAT::Utils->isLinux()) { - $cmd="route add -net $net netmask $mask gw $gw_ip"; + 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 \n down route del -net $net netmask $mask gw $gw_ip \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