From: minima Date: Sun, 19 Aug 2001 15:36:38 +0000 (+0000) Subject: attempt to dup check pc16/17/19/21 X-Git-Tag: R_1_48~90 X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=b50b7a1c99679f3624852f29068a6cde268e9560 attempt to dup check pc16/17/19/21 --- diff --git a/Changes b/Changes index 20d4649e..2e5c2d67 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ 19Aug01======================================================================= 1. Fix rcmds 2. make isolation when there are no filters present work again? +3. dup check PC16/17/19/21 ! 17Aug01======================================================================= 1. Sort out PC41 handling to include type 5 records for QRA locators and also remove all filtering (but retain ephemeral dup checking). diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 2e43068a..72bce7c0 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -527,6 +527,11 @@ sub normal 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]; @@ -556,6 +561,8 @@ sub normal 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 '*'; @@ -594,6 +601,13 @@ sub normal 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; @@ -633,6 +647,11 @@ sub normal 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}); @@ -649,6 +668,9 @@ sub normal 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 @@ -718,7 +740,15 @@ sub normal } 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) { @@ -1844,6 +1874,17 @@ sub eph_dup 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);