--- mdap-server.pl 2007/04/24 15:44:20 31 +++ mdap-server.pl 2007/04/24 17:02:41 32 @@ -28,6 +28,7 @@ ); $quiet = 0 if $verbose; +$credentials = 1 if $debug; # tab-delimited list of user id/passwd to try on ants my @try_accounts = ( "Administrator\t" ); @@ -98,7 +99,7 @@ $sock->mcast_send( $data, "${GROUP}:${PORT}" ); if ($debug) { - warn ">> ", dump( $data ), $/; + warn ">> ${GROUP}:${PORT} >> ", dump( $data ), $/; } elsif( ! $quiet ) { $data =~ s/\s+/ /gi; warn ">> ", substr($data,0,70), $/; @@ -192,7 +193,7 @@ print "<< $type $proto/$mdap_ver << ", length($data), " bytes\n" unless $quiet; - warn dump($h),$/ if ($debug); + warn dump( $data, $h ),$/ if ($debug); # we are getting our own messages (since our source port # is same as destination) @@ -219,7 +220,7 @@ next; } else { $ant_ok_password->{$ant}++; - print "$ant credentials $user_id $user_pwd\n" if ($credentials && $ant_ok_password->{$ant} == 1); + print "$ant credentials $user_id $user_pwd\n" if ( $credentials && $ant_ok_password->{$ant} == 1 ) || $debug; } my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?"; @@ -235,7 +236,10 @@ $ant_ok_password->{$ant} ? ' password protected' : '', "\n"; + $ant_flashing->{$ant} = 0; + # green|red|orange|flash|off + mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:system config led=flash\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); my $waiting = 0; my $count = 0; map { @@ -252,13 +256,17 @@ } else { once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update\n"; } - } elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) { + } elsif ( $type eq 'REPLY-EXEC-CLI' ) { + if ( $seq_nr == 1 ) { print "+ $ant bootp mode re-flash started\n" if ($verbose); mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); forget_ant( $ant ); $ant_flashing->{$ant}++; + } elsif ( $seq_nr == 2 ) { + print "+ $ant led\n" if ($verbose); + } } else { - print "!! reply ignored ", dump( $h ), $/; + print "!! reply $type ignored ", dump( $h ), $/; } } else {