attempt to dup check pc16/17/19/21

This commit is contained in:
minima 2001-08-19 15:36:38 +00:00
parent bda1cef129
commit b50b7a1c99
2 changed files with 42 additions and 0 deletions

View File

@ -1,6 +1,7 @@
19Aug01======================================================================= 19Aug01=======================================================================
1. Fix rcmds 1. Fix rcmds
2. make isolation when there are no filters present work again? 2. make isolation when there are no filters present work again?
3. dup check PC16/17/19/21 !
17Aug01======================================================================= 17Aug01=======================================================================
1. Sort out PC41 handling to include type 5 records for QRA locators and also 1. Sort out PC41 handling to include type 5 records for QRA locators and also
remove all filtering (but retain ephemeral dup checking). remove all filtering (but retain ephemeral dup checking).

View File

@ -527,6 +527,11 @@ sub normal
if ($pcno == 16) { # add a user if ($pcno == 16) { # add a user
if (eph_dup($line)) {
dbg("PCPROT: dup PC16 detected") if isdbg('chanerr');
return;
}
# general checks # general checks
my $dxchan; my $dxchan;
my $ncall = $field[1]; my $ncall = $field[1];
@ -556,6 +561,8 @@ sub normal
my ($call, $conf, $here) = $field[$i] =~ /^(\S+) (\S) (\d)/o; my ($call, $conf, $here) = $field[$i] =~ /^(\S+) (\S) (\d)/o;
next unless $call && $conf && defined $here && is_callsign($call); next unless $call && $conf && defined $here && is_callsign($call);
next if $call eq $main::mycall; next if $call eq $main::mycall;
eph_del_regex("^PC17\^$call\^$ncall");
$conf = $conf eq '*'; $conf = $conf eq '*';
@ -594,6 +601,13 @@ sub normal
my $dxchan; my $dxchan;
my $ncall = $field[2]; my $ncall = $field[2];
my $ucall = $field[1]; 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) { if ($ncall eq $main::mycall) {
dbg("PCPROT: trying to alter config on this node from outside!") if isdbg('chanerr'); dbg("PCPROT: trying to alter config on this node from outside!") if isdbg('chanerr');
return; return;
@ -633,6 +647,11 @@ sub normal
my $i; my $i;
my $newline = "PC19^"; my $newline = "PC19^";
if (eph_dup($line)) {
dbg("PCPROT: dup PC19 detected") if isdbg('chanerr');
return;
}
# new routing list # new routing list
my @rout; my @rout;
my $parent = Route::Node::get($self->{call}); my $parent = Route::Node::get($self->{call});
@ -649,6 +668,9 @@ sub normal
my $conf = $field[$i+2]; my $conf = $field[$i+2];
my $ver = $field[$i+3]; my $ver = $field[$i+3];
next unless defined $here && defined $conf && is_callsign($call); next unless defined $here && defined $conf && is_callsign($call);
eph_del_regex("^PC21\^$call");
# check for sane parameters # check for sane parameters
$ver = 5000 if $ver eq '0000'; $ver = 5000 if $ver eq '0000';
next if $ver < 5000; # only works with version 5 software next if $ver < 5000; # only works with version 5 software
@ -718,7 +740,15 @@ sub normal
} }
if ($pcno == 21) { # delete a cluster from the list 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]; my $call = uc $field[1];
eph_del_regex("^PC19.*$call");
my @rout; my @rout;
my $parent = Route::Node::get($self->{call}); my $parent = Route::Node::get($self->{call});
unless ($parent) { unless ($parent) {
@ -1844,6 +1874,17 @@ sub eph_dup
return undef; 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 sub eph_clean
{ {
my ($key, $val); my ($key, $val);