Fix busybox anomaly

This commit is contained in:
Tom Eastep 2011-08-31 16:38:58 -07:00
parent d08ddd30ff
commit 3fa646845f
2 changed files with 27 additions and 16 deletions

View File

@ -514,6 +514,9 @@ sub add_a_provider( $$ ) {
} }
} }
#
# /proc for this interface
#
setup_interface_proc( $interface ); setup_interface_proc( $interface );
if ( $mark ne '-' ) { if ( $mark ne '-' ) {
@ -555,10 +558,10 @@ sub add_a_provider( $$ ) {
emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $number $realm"; emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $number $realm";
} }
balance_default_route $balance , $gateway, $physical, $realm if $balance; balance_default_route( $balance , $gateway, $physical, $realm ) if $balance;
if ( $default > 0 ) { if ( $default > 0 ) {
balance_fallback_route $default , $gateway, $physical, $realm; balance_fallback_route( $default , $gateway, $physical, $realm );
} elsif ( $default ) { } elsif ( $default ) {
emit ''; emit '';
if ( $gateway ) { if ( $gateway ) {
@ -616,34 +619,39 @@ sub add_a_provider( $$ ) {
'if [ $COMMAND = enable ]; then' 'if [ $COMMAND = enable ]; then'
); );
push_indent;
my ( $tbl, $weight ); my ( $tbl, $weight );
if ( $balance || $default ) { if ( $balance || $default ) {
$tbl = $default || $config{USE_DEFAULT_RT} ? DEFAULT_TABLE : MAIN_TABLE; $tbl = $default || $config{USE_DEFAULT_RT} ? DEFAULT_TABLE : MAIN_TABLE;
$weight = $balance ? $balance : $default; $weight = $balance ? $balance : $default;
push_indent;
if ( $gateway ) { if ( $gateway ) {
emit qq(add_gateway "nexthop via $gateway dev $physical weight $weight $realm" ) . $tbl; emit qq(add_gateway "nexthop via $gateway dev $physical weight $weight $realm" ) . $tbl;
} else { } else {
emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl; emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl;
} }
pop_indent;
} }
emit " setup_${dev}_tc" if $tcdevices->{$interface}; emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
emit ( qq( progress_message2 " Provider $table ($number) Started"), emit ( qq(progress_message2 " Provider $table ($number) Started") );
'else',
pop_indent;
emit( 'else',
qq( progress_message " Provider $table ($number) Started"), qq( progress_message " Provider $table ($number) Started"),
"fi\n" "fi\n"
); );
pop_indent; pop_indent;
emit 'else'; emit 'else';
push_indent;
if ( $optional ) { if ( $optional ) {
if ( $shared ) { if ( $shared ) {
emit ( "error_message \"WARNING: Gateway $gateway is not reachable -- Provider $table ($number) not Started\"" ); emit ( "error_message \"WARNING: Gateway $gateway is not reachable -- Provider $table ($number) not Started\"" );
@ -658,6 +666,8 @@ sub add_a_provider( $$ ) {
} }
} }
pop_indent;
emit 'fi'; emit 'fi';
pop_indent; pop_indent;

View File

@ -1507,6 +1507,7 @@ hits_command() {
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.*SRC=\)\(.*\)\( DST=.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2 \4/ $g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.*SRC=\)\(.*\)\( DST=.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2 \4/
t t
s/\(.*SRC=\)\(.*\)\( DST=.*\)/\2/' | sort | uniq -c | sort -rn | while read count address port; do s/\(.*SRC=\)\(.*\)\( DST=.*\)/\2/' | sort | uniq -c | sort -rn | while read count address port; do
[ -z "$port" ] && port=0
printf '%7d %-15s %d\n' $count $address $port printf '%7d %-15s %d\n' $count $address $port
done done