Commit 1be3d150 authored by Mike Hibler's avatar Mike Hibler
Browse files

Make the generated rc.route file a little more readable (whoohoo!)

parent 77d60454
......@@ -876,11 +876,11 @@ sub doifconfig (;$)
os_ifconfig_line($iface, $inet,
$mask, $speed, $duplex, $aliases,$rtabid);
$upcmds .= "$upline\n";
$upcmds .= "$upline\n ";
$upcmds .= TMROUTECONFIG . " $routearg up\n";
$downcmds .= TMROUTECONFIG . " $routearg down\n";
$downcmds .= "$downline\n"
$downcmds .= TMROUTECONFIG . " $routearg down\n ";
$downcmds .= "$downline\n "
if (defined($downline));
# There could be routes for each alias.
......@@ -914,16 +914,17 @@ sub doifconfig (;$)
if ($pmac eq "none" ||
($iface = findiface($pmac))) {
print XIFS "$iface\n";
print XIFS "$iface\n"
if (defined($iface));
my ($upline, $downline) =
os_ifconfig_veth($iface, $inet, $mask, $id, $vmac,$rtabid);
$upcmds .= "$upline\n";
$upcmds .= "$upline\n ";
$upcmds .= TMROUTECONFIG . " $routearg up\n";
$downcmds .= TMROUTECONFIG . " $routearg down\n";
$downcmds .= "$downline\n"
$downcmds .= TMROUTECONFIG . " $routearg down\n ";
$downcmds .= "$downline\n "
if (defined($downline));
}
else {
......@@ -949,11 +950,11 @@ sub doifconfig (;$)
print IFC "if [ x\$1 = x ]; then action=enable; else action=\$1; fi\n";
print IFC "case \"\$action\" in\n";
print IFC " enable)\n";
print IFC " $upcmds\n";
print IFC " ;;\n";
print IFC " $upcmds\n";
print IFC " ;;\n";
print IFC " disable)\n";
print IFC " $downcmds\n";
print IFC " ;;\n";
print IFC " $downcmds\n";
print IFC " ;;\n";
print IFC "esac\n";
close(IFC);
chmod(0755, TMIFC);
......
......@@ -205,16 +205,21 @@ sub os_ifconfig_veth($$$$$;$)
if (defined($iface)) {
$uplines .= "$IFCONFIGBIN $iface up $IFC_100MBS $IFC_FDUPLEX\n";
}
$uplines .= "$IFCONFIGBIN veth${id} create\n" .
$uplines .= "$IFCONFIGBIN veth${id} create\n " .
"$IFCONFIGBIN veth${id} vethaddr $vmac/$vtag" .
(defined($iface) ? " vethdev $iface\n" : "\n");
(defined($iface) ? " vethdev $iface\n " : "\n ");
#
# Must set route table id before assigning IP address so that interface
# route winds up in the correct table.
#
if (defined($rtabid)) {
$uplines .= "$IFCONFIGBIN veth${id} rtabid $rtabid\n";
$uplines .= "$IFCONFIGBIN veth${id} rtabid $rtabid\n ";
}
$uplines .= "$IFCONFIGBIN veth${id} inet $inet netmask $mask\n";
$downlines = "$IFCONFIGBIN veth${id} down\n".
"$IFCONFIGBIN veth${id} destroy\n";
$uplines .= "$IFCONFIGBIN veth${id} inet $inet netmask $mask";
$downlines = "$IFCONFIGBIN veth${id} down\n ".
"$IFCONFIGBIN veth${id} destroy";
return ($uplines, $downlines);
}
......@@ -380,7 +385,9 @@ sub os_routing_enable_forward()
if (REMOTE()) {
$cmd = "echo 'IP forwarding not turned on!'";
}
else {
elsif (JAILED()) {
$cmd = "# IP forwarding is enabled outside the jail";
} else {
# No Fast Forwarding when operating with linkdelays.
$cmd = "sysctl -w net.inet.ip.forwarding=1\n" .
" if [ ! -e $BOOTDIR/rc.linkdelay ]; then\n" .
......
......@@ -876,11 +876,11 @@ sub doifconfig (;$)
os_ifconfig_line($iface, $inet,
$mask, $speed, $duplex, $aliases,$rtabid);
$upcmds .= "$upline\n";
$upcmds .= "$upline\n ";
$upcmds .= TMROUTECONFIG . " $routearg up\n";
$downcmds .= TMROUTECONFIG . " $routearg down\n";
$downcmds .= "$downline\n"
$downcmds .= TMROUTECONFIG . " $routearg down\n ";
$downcmds .= "$downline\n "
if (defined($downline));
# There could be routes for each alias.
......@@ -914,16 +914,17 @@ sub doifconfig (;$)
if ($pmac eq "none" ||
($iface = findiface($pmac))) {
print XIFS "$iface\n";
print XIFS "$iface\n"
if (defined($iface));
my ($upline, $downline) =
os_ifconfig_veth($iface, $inet, $mask, $id, $vmac,$rtabid);
$upcmds .= "$upline\n";
$upcmds .= "$upline\n ";
$upcmds .= TMROUTECONFIG . " $routearg up\n";
$downcmds .= TMROUTECONFIG . " $routearg down\n";
$downcmds .= "$downline\n"
$downcmds .= TMROUTECONFIG . " $routearg down\n ";
$downcmds .= "$downline\n "
if (defined($downline));
}
else {
......@@ -949,11 +950,11 @@ sub doifconfig (;$)
print IFC "if [ x\$1 = x ]; then action=enable; else action=\$1; fi\n";
print IFC "case \"\$action\" in\n";
print IFC " enable)\n";
print IFC " $upcmds\n";
print IFC " ;;\n";
print IFC " $upcmds\n";
print IFC " ;;\n";
print IFC " disable)\n";
print IFC " $downcmds\n";
print IFC " ;;\n";
print IFC " $downcmds\n";
print IFC " ;;\n";
print IFC "esac\n";
close(IFC);
chmod(0755, TMIFC);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment