if ($pcno == 16) { # add a user
+ if (eph_dup($line)) {
+ dbg("PCPROT: dup PC16 detected") if isdbg('chanerr');
+ return;
+ }
+
# general checks
my $dxchan;
my $ncall = $field[1];
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;
+
+ eph_del_regex("^PC17\^$call\^$ncall");
$conf = $conf eq '*';
my $dxchan;
my $ncall = $field[2];
my $ucall = $field[1];
+ if (eph_dup($line)) {
+ dbg("PCPROT: dup PC17 detected") if isdbg('chanerr');
+ return;
+ }
+
+ eph_del_regex("^PC16.*$ncall.*$ucall");
+
if ($ncall eq $main::mycall) {
dbg("PCPROT: trying to alter config on this node from outside!") if isdbg('chanerr');
return;
my $i;
my $newline = "PC19^";
+ if (eph_dup($line)) {
+ dbg("PCPROT: dup PC19 detected") if isdbg('chanerr');
+ return;
+ }
+
# new routing list
my @rout;
my $parent = Route::Node::get($self->{call});
my $conf = $field[$i+2];
my $ver = $field[$i+3];
next unless defined $here && defined $conf && is_callsign($call);
+
+ eph_del_regex("^PC21\^$call");
+
# check for sane parameters
$ver = 5000 if $ver eq '0000';
next if $ver < 5000; # only works with version 5 software
}
if ($pcno == 21) { # delete a cluster from the list
+ if (eph_dup($line)) {
+ dbg("PCPROT: dup PC21 detected") if isdbg('chanerr');
+ return;
+ }
+
my $call = uc $field[1];
+
+ eph_del_regex("^PC19.*$call");
+
my @rout;
my $parent = Route::Node::get($self->{call});
unless ($parent) {
($filter, $hops) = $self->{spotsfilter}->it(@_);
return unless $filter;
}
- send_prot_line($self, $filter, $hops, $isolate, $line)
+ send_prot_line($self, $filter, $hops, $isolate, $line);
}
sub send_prot_line
return unless $routeit;
}
if ($filter) {
- $self->send($routeit) if $routeit;
+ $self->send($routeit);
} else {
$self->send($routeit) unless $self->{isolate} || $isolate;
}
my $s = $rcmds{$fromnode};
if ($s) {
my $dxchan = DXChannel->get($s->{call});
- my $ref = DXChannel->get($user) || $dxchan;
- if ($ref->{call} eq $main::mycall) {
- $ref = DXChannel->get($main::myalias) || $ref;
- }
+ my $ref = $user eq $tonode ? $dxchan : (DXChannel->get($user) || $dxchan);
$ref->send($line) if $ref;
delete $rcmds{$fromnode} if !$dxchan;
} else {
$routeit = adjust_hops($self, $line); # adjust its hop count by node name
next unless $routeit;
}
- $self->send($routeit) if $self->{routefilter} || !$self->{isolate};
+ $self->send($routeit);
}
}
}
foreach $dxchan (@dxchan) {
next if $dxchan == $self;
next if $dxchan == $me;
- if ($dxchan->{routefilter} || !$self->{isolate}) {
- $dxchan->send_route($generate, @_)
+ if ($dxchan->{routefilter}) {
+ $dxchan->send_route($generate, @_);
} else {
- dbg('DXPROT: isolated') if isdbg('chanerr');
+ $dxchan->send_route($generate, @_) unless $self->{isolate} || $dxchan->{isolate};
}
}
}
return undef;
}
+sub eph_del_regex
+{
+ my $regex = shift;
+ my ($key, $val);
+ while (($key, $val) = each %eph) {
+ if ($key =~ m{$regex}) {
+ delete $eph{$key};
+ }
+ }
+}
+
sub eph_clean
{
my ($key, $val);