/[mdap]/mdap-server.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /mdap-server.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 31 by dpavlin, Tue Apr 24 15:44:20 2007 UTC revision 33 by dpavlin, Tue Apr 24 18:57:19 2007 UTC
# Line 28  GetOptions( Line 28  GetOptions(
28  );  );
29    
30  $quiet = 0 if $verbose;  $quiet = 0 if $verbose;
31    $credentials = 1 if $debug;
32    
33  # tab-delimited list of user id/passwd to try on ants  # tab-delimited list of user id/passwd to try on ants
34  my @try_accounts = ( "Administrator\t" );  my @try_accounts = ( "Administrator\t" );
# Line 98  sub mdap_send { Line 99  sub mdap_send {
99    
100          $sock->mcast_send( $data, "${GROUP}:${PORT}" );          $sock->mcast_send( $data, "${GROUP}:${PORT}" );
101          if ($debug) {          if ($debug) {
102                  warn ">> ", dump( $data ), $/;                  warn ">> ${GROUP}:${PORT} >> ", dump( $data ), $/;
103          } elsif( ! $quiet ) {          } elsif( ! $quiet ) {
104                  $data =~ s/\s+/ /gi;                  $data =~ s/\s+/ /gi;
105                  warn ">> ", substr($data,0,70), $/;                  warn ">> ", substr($data,0,70), $/;
# Line 192  while (1) { Line 193  while (1) {
193    
194                  print "<< $type $proto/$mdap_ver << ", length($data), " bytes\n" unless $quiet;                  print "<< $type $proto/$mdap_ver << ", length($data), " bytes\n" unless $quiet;
195    
196                  warn dump($h),$/ if ($debug);                  warn dump( $data, $h ),$/ if ($debug);
197    
198                  # we are getting our own messages (since our source port                  # we are getting our own messages (since our source port
199                  # is same as destination)                  # is same as destination)
# Line 219  while (1) { Line 220  while (1) {
220                                  next;                                  next;
221                          } else {                          } else {
222                                  $ant_ok_password->{$ant}++;                                  $ant_ok_password->{$ant}++;
223                                  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;
224                          }                          }
225    
226                          my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?";                          my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?";
# Line 229  while (1) { Line 230  while (1) {
230                                  if ( $build ne $new_build ) {                                  if ( $build ne $new_build ) {
231                                          print "+ $ant version $build -> $new_build\n";                                          print "+ $ant version $build -> $new_build\n";
232                                          mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:software upgrade\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n");                                          mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:software upgrade\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n");
233                                            $ant_flashing->{$ant}++;
234                                  } else {                                  } else {
235                                          once "$ant OK version $build",                                          once "$ant OK version $build",
236                                                  $ant_unknown_password->{$ant} ? ' with unknown password' :                                                  $ant_unknown_password->{$ant} ? ' with unknown password' :
237                                                  $ant_ok_password->{$ant} ? ' password protected' :                                                  $ant_passwd->{$ant} ? ' password protected' :
238                                                  '',                                                  '',
239                                                  "\n";                                                  "\n";
240    
241                                          $ant_flashing->{$ant} = 0;                                          $ant_flashing->{$ant} = 0;
242                                            # green|red|orange|flash|off
243                                            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");
244                                          my $waiting = 0;                                          my $waiting = 0;
245                                          my $count = 0;                                          my $count = 0;
246                                          map {                                          map {
# Line 252  while (1) { Line 257  while (1) {
257                          } else {                          } else {
258                                  once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update\n";                                  once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update\n";
259                          }                          }
260                  } elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) {                  } elsif ( $type eq 'REPLY-EXEC-CLI' ) {
261                                  print "+ $ant bootp mode re-flash started\n" if ($verbose);                          print "+ $type ", dump( $data ), "\n" if ($verbose);
262                            if ( $seq_nr == 1 ) {
263                                  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");                                  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");
264                                  forget_ant( $ant );                                  forget_ant( $ant ) if ( $ant_flashing->{$ant} );
265                                  $ant_flashing->{$ant}++;                          }
266                  } else {                  } else {
267                          print "!! reply ignored ", dump( $h ), $/;                          print "!! reply $type ignored ", dump( $h ), $/;
268                  }                  }
269    
270          } else {          } else {

Legend:
Removed from v.31  
changed lines
  Added in v.33

  ViewVC Help
Powered by ViewVC 1.1.26