X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=8364aca903e9f779ebd16054c5e2b9ff6b63a3fe;hb=b212ea3fe562d1c3ebc8ac64c5a7d8c3e656a8e4;hp=dffb2055407c700ea8fe831d95241b7c630d2d93;hpb=eca912fbdcba8f6ee91f757aac3bf95f4d6bafab;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index dffb2055..8364aca9 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -275,10 +275,8 @@ sub normal # print join(',', @field), "\n"; - # ignore any lines that don't start with PC - return if !$field[0] =~ /^PC/; - # process PC frames + # process PC frames, this will fail unless the frame starts PCnn my ($pcno) = $field[0] =~ /^PC(\d\d)/; # just get the number return unless $pcno; return if $pcno < 10 || $pcno > 99; @@ -388,7 +386,7 @@ sub normal if ($self->{inspotsfilter}) { my ($filter, $hops) = $self->{inspotsfilter}->it(@spot); unless ($filter) { - dbg("PCPROT: Rejected by filter") if isdbg('chanerr'); + dbg("PCPROT: Rejected by input spot filter") if isdbg('chanerr'); return; } } @@ -502,7 +500,7 @@ sub normal my ($filter, $hops) = $self->{inannfilter}->it(@field[1..6], $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq); unless ($filter) { - dbg("PCPROT: Rejected by filter") if isdbg('chanerr'); + dbg("PCPROT: Rejected by input announce filter") if isdbg('chanerr'); return; } } @@ -556,15 +554,20 @@ sub normal for ($i = 2; $i < $#field; $i++) { my ($call, $conf, $here) = $field[$i] =~ /^(\S+) (\S) (\d)/o; next unless $call && $conf && defined $here && is_callsign($call); + next if $call eq $main::mycall; + $conf = $conf eq '*'; my $r = Route::User::get($call); my $flags = Route::here($here)|Route::conf($conf); - if ($r && $r->flags != $flags) { - $r->flags($flags); - push @rout, $r; - } elsif (!$r) { + if ($r) { + if ($r->flags != $flags) { + $r->flags($flags); + push @rout, $r; + } + $r->addparent($ncall); + } else { push @rout, $parent->add_user($call, $flags); } @@ -632,6 +635,11 @@ sub normal # new routing list my @rout; my $parent = Route::Node::get($self->{call}); + unless ($parent) { + dbg("DXPROT: my parent $self->{call} has disappeared"); + $self->disconnect; + return; + } # parse the PC19 for ($i = 1; $i < $#field-1; $i += 4) { @@ -644,31 +652,38 @@ sub normal $ver = 5000 if $ver eq '0000'; next if $ver < 5000; # only works with version 5 software next if length $call < 3; # min 3 letter callsigns + next if $call eq $main::mycall; # update it if required my $r = Route::Node::get($call); my $flags = Route::here($here)|Route::conf($conf); - if ($parent->call eq $call && ($parent->version ne $ver || $parent->flags != $flags)) { - $parent->version($ver); - $parent->flags($flags); - push @rout, $parent; - } elsif ($r) { - my $ar = $parent->add($r); - push @rout, $ar if $ar; + if ($r) { + my $ar; + if ($call ne $parent->call) { + if ($self->in_filter_route($r)) { + $ar = $parent->add($call, $ver, $flags); + push @rout, $ar if $ar; + } else { + next; + } + } if ($r->version ne $ver || $r->flags != $flags) { $r->version($ver); - $r->flags(Route::here($here)|Route::conf($conf)); + $r->flags($flags); push @rout, $r unless $ar; } - } elsif ($parent->call ne $call) { - next if $call eq $main::mycall || $call eq $self->{call}; + } else { + if ($call eq $self->{call}) { + dbg("DXPROT: my channel route for $call has disappeared"); + next; + }; - my $new = Route::Node->new($call, $ver, Route::here($here)|Route::conf($conf)); + my $new = Route->new($call); # throw away if ($self->in_filter_route($new)) { - $parent->add($new); - push @rout, $new; + my $r = $parent->add($call, $ver, $flags); + push @rout, $r; } else { - $new->del($parent); + next; } } @@ -706,7 +721,8 @@ sub normal my @rout; my $parent = Route::Node::get($self->{call}); unless ($parent) { - dbg("PCPROT: Route::Node $call not in config") if isdbg('chanerr'); + dbg("DXPROT: my parent $self->{call} has disappeared"); + $self->disconnect; return; } my $node = Route::Node::get($call); @@ -782,15 +798,18 @@ sub normal if ($pcno == 24) { # set here status my $call = uc $field[1]; - my $ref = Route::Node::get($call); - $ref->here($field[2]) if $ref; - $ref = Route::User::get($call); - $ref->here($field[2]) if $ref; + my ($nref, $uref); + $nref = Route::Node::get($call); + $uref = Route::User::get($call); + return unless $nref || $uref; # if we don't know where they are, it's pointless sending it on - # input filter if required - return unless $self->in_filter_route($ref); - - $self->route_pc24($ref, $field[3]) if $ref && !eph_dup($line); + unless (eph_dup($line)) { + $nref->here($field[2]) if $nref; + $uref->here($field[2]) if $uref; + my $ref = $nref || $uref; + return unless $self->in_filter_route($ref); + $self->route_pc24($ref, $field[3]); + } return; } @@ -928,7 +947,7 @@ sub normal } $user->lastoper($main::systime); # to cut down on excessive for/opers being generated $user->put; - my $ref = Route::get($call); + my $ref = Route::get($call) || Route->new($call); # input filter if required return unless $self->in_filter_route($ref); @@ -1445,7 +1464,7 @@ sub send_local_config # and are not themselves isolated, this to make sure that isolated nodes # don't appear outside of this node my @dxchan = grep { $_->call ne $main::mycall && $_->call ne $self->{call} } DXChannel::get_all_nodes(); - @localnodes = map { Route::Node::get($_->{call}) or die "connot find node $_->{call}" } @dxchan if @dxchan; + @localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan; my @intcalls = map { $_->nodes } @localnodes if @localnodes; my $ref = Route::Node::get($self->{call}); my @rnodes = $ref->nodes; @@ -1484,7 +1503,7 @@ sub route # always send it down the local interface if available my $dxchan = DXChannel->get($call); unless ($dxchan) { - my $cl = Route::Node::get($call); + my $cl = Route::get($call); $dxchan = $cl->dxchan if $cl; if (ref $dxchan) { if (ref $self && $dxchan eq $self) { @@ -1759,7 +1778,7 @@ sub send_route if ($filter) { push @rin, $r; } else { - dbg('DXPROT: Rejected by filter') if isdbg('chanerr'); + dbg("DXPROT: $self->{call}/" . $r->call . " rejected by output filter") if isdbg('chanerr'); } } else { dbg("was sent a null value") if isdbg('chanerr'); @@ -1793,7 +1812,7 @@ sub broadcast_route foreach $dxchan (@dxchan) { next if $dxchan == $self; next if $dxchan == $me; - if ($self->{routefilter} || !$self->{isolate}) { + if ($dxchan->{routefilter} || !$self->{isolate}) { $dxchan->send_route($generate, @_) } else { dbg('DXPROT: isolated') if isdbg('chanerr'); @@ -1851,7 +1870,7 @@ sub in_filter_route if ($self->{inroutefilter}) { ($filter, $hops) = $self->{inroutefilter}->it($self->{call}, $self->{dxcc}, $self->{itu}, $self->{cq}, $r->call, $r->dxcc, $r->itu, $r->cq); - dbg('PCPROT: rejected by filter') if !$filter && isdbg('chanerr'); + dbg("PCPROT: $self->{call}/" . $r->call . ' rejected by in_filter_route') if !$filter && isdbg('chanerr'); } return $filter; }