From b2dfa977515995b8ab19611b88cfc999ad78591b Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 24 Jun 2008 22:22:44 +0100 Subject: [PATCH] change interface to Route::findroutes This change allows things like sh/route to obtain the actual routing priorities either for use or display. Add a command 'send_config' to broadcast a new PC92 C record to all interfaces. Useful for playig catchup more quickly after a restart. --- cmd/Commands_en.hlp | 6 ++++++ cmd/send_config.pl | 10 ++++++++++ cmd/show/route.pl | 4 +++- perl/Route.pm | 12 ++++++------ perl/Version.pm | 2 +- 5 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 cmd/send_config.pl diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index a7a82996..99413b3f 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1385,6 +1385,12 @@ This will show YOU the output from SH/VHFTABLE and also store it in the message. You can carry on with the message until you are ready to send it. + +=== 6^SEND_CONFIG^Broadcast PC92 C records +This is the PC92 equivalent of INIT. In that it will send out a new +PC92 C record to all interfaces. This can be used to bring other nodes +up to date quicker after a restart. + === 0^SET/ADDRESS ^Record your postal address === 9^SET/AGWENGINE^Enable the AGW Engine diff --git a/cmd/send_config.pl b/cmd/send_config.pl new file mode 100644 index 00000000..75916d3b --- /dev/null +++ b/cmd/send_config.pl @@ -0,0 +1,10 @@ +# +# send out PC92 config records manually +# + +my $self = shift; +return (1, $self->msg('e5')) unless $self->priv > 5; + +$main::me->broadcast_pc92_update($main::mycall); + +return (1, $self->msg('ok')); diff --git a/cmd/show/route.pl b/cmd/show/route.pl index c927e8dc..d055e616 100644 --- a/cmd/show/route.pl +++ b/cmd/show/route.pl @@ -17,7 +17,9 @@ foreach $l (@list) { my $ref = Route::get($l); if ($ref) { my $parents = $ref->isa('Route::Node') ? $l : join(',', $ref->parents); - push @out, $self->msg('route', $l, $parents, join(',', map {$_->call} Route::findroutes($l))); + my @n = map { $_->[1]->call . '(' . (100 - $_->[0]) . ')' } Route::findroutes($l); + @n = @n[0,1,2,3],'...' if @n > 4; + push @out, $self->msg('route', $l, $parents, join(',', @n)); } else { push @out, $self->msg('e7', $l); } diff --git a/perl/Route.pm b/perl/Route.pm index f637539c..3c1c453e 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -297,7 +297,7 @@ sub findroutes my $dxchan = DXChannel::get($call); if ($dxchan) { dbg("ROUTE: findroutes $call -> directly connected") if isdbg('findroutes'); - return $dxchan; + return [99, $dxchan]; } my $nref = Route::get($call); @@ -311,7 +311,7 @@ sub findroutes $dxchan = DXChannel::get($p); if ($dxchan) { dbg("ROUTE: findroutes $call -> connected direct via parent $p") if isdbg('findroutes'); - return $dxchan; + return [99, $dxchan]; } my $r = Route::Node::get($p); @@ -331,10 +331,10 @@ sub findroutes } # get a sorted list of dxchannels with the highest hop count first - my @nout = map {$_->[1]} sort {$b->[0] <=> $a->[0]} @out; + my @nout = sort {$b->[0] <=> $a->[0]} @out; if (isdbg('findroutes')) { - if (@out) { - foreach (sort {$b->[0] <=> $a->[0]} @out) { + if (@nout) { + for (@nout) { dbg("ROUTE: findroutes $call -> $_->[0] " . $_->[1]->call); } } @@ -348,7 +348,7 @@ sub alldxchan { my $self = shift; my @dxchan = findroutes($self->{call}); - return @dxchan; + return map {$_->[1]} @dxchan; } sub dxchan diff --git a/perl/Version.pm b/perl/Version.pm index afd61429..1f410d4b 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.55'; $subversion = '0'; -$build = '16'; +$build = '17'; 1; -- 2.43.0