updatedate routes scripts so that we can route through a device
Conflicts: xCAT-server/lib/xcat/plugins/route.pm
This commit is contained in:
parent
9cfc75f7c8
commit
e4206c86b4
@ -970,7 +970,7 @@ sub addPersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$filename="/etc/sysconfig/static-routes-ipv6";
|
||||
} else {
|
||||
$filename="/etc/sysconfig/static-routes";
|
||||
$filename="/etc/sysconfig/sysconfig/route-$ifname";
|
||||
}
|
||||
my @output=getConfig($filename);
|
||||
#print "old output=" . join("\n", @output) . "\n";
|
||||
@ -991,7 +991,7 @@ sub addPersistentRoute_RH {
|
||||
|
||||
$new_config="$ifname $net/$mask $gw_ip";
|
||||
} else {
|
||||
$new_config="any net $net netmask $mask gw $gw_ip $ifname\n";
|
||||
$new_config="$net/$mask via $gw_ip dev $ifname\n";
|
||||
}
|
||||
if (!$hasConfiged) {
|
||||
push(@output, $new_config);
|
||||
@ -1028,7 +1028,7 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$filename="/etc/sysconfig/static-routes-ipv6";
|
||||
} else {
|
||||
$filename="/etc/sysconfig/static-routes";
|
||||
$filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
}
|
||||
my @output=getConfig($filename);
|
||||
#print "old output=" . join("\n", @output) . "\n";
|
||||
@ -1050,7 +1050,7 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"$ifname $net/$mask $gw_ip\" from $filename.";
|
||||
} else {
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" from $filename.";
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"$net/$mask via $gw_ip dev $ifname\" from $filename.";
|
||||
}
|
||||
$callback->($rsp);
|
||||
} else {
|
||||
@ -1058,7 +1058,7 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"$ifname $net/$mask $gw_ip\" does not exist in $filename.";
|
||||
} else {
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" does not exist in $filename.";
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"$net/$mask via $gw_ip dev $ifname\" does not exist in $filename.";
|
||||
}
|
||||
$callback->($rsp);
|
||||
}
|
||||
|
@ -278,9 +278,9 @@ add_persistent_route()
|
||||
# $net/mask does not work with sed cmd
|
||||
route1="$ifname $net\/$mask $gw";
|
||||
else
|
||||
filename="/etc/sysconfig/static-routes";
|
||||
route="any net $net netmask $mask gw $gw $ifname";
|
||||
route1="any net $net netmask $mask gw $gw $ifname";
|
||||
filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
route="$net/$mask via $gw dev $ifname";
|
||||
route1="$net\/$mask via $gw dev $ifname";
|
||||
fi
|
||||
if [ -f $filename ]; then
|
||||
grep "$route" $filename 2>&1 1>/dev/null
|
||||
@ -400,9 +400,9 @@ rm_persistent_route()
|
||||
route="$ifname $net\/$mask $gw"
|
||||
route1="$ifname $net/$mask $gw"
|
||||
else
|
||||
filename="/etc/sysconfig/static-routes";
|
||||
route="any net $net netmask $mask gw $gw $ifname";
|
||||
route1="any net $net netmask $mask gw $gw $ifname";
|
||||
filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
route="$net/$mask via $gw dev $ifname";
|
||||
route1="$net\/$mask via $gw dev $ifname";
|
||||
fi
|
||||
if [ -f $filename ]; then
|
||||
grep "$route" $filename 2>&1 1>/dev/null
|
||||
@ -438,7 +438,11 @@ if [ "$op" = "add" ]; then
|
||||
fi
|
||||
else
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
cmd="route add -net $net netmask $mask gw $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
cmd="route add -net $net netmask $mask dev $iface"
|
||||
else
|
||||
cmd="route add -net $net netmask $mask gw $gw"
|
||||
fi
|
||||
else
|
||||
cmd="route add -net $net -netmask $mask $gw"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user