]> gb7djk.dxcluster.net Git - spider.git/commitdiff
"Fix" badnode / badspotter handling
authorDirk Koopman <djk@tobit.co.uk>
Tue, 4 Feb 2025 21:11:57 +0000 (21:11 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 4 Feb 2025 21:11:57 +0000 (21:11 +0000)
Changes
perl/DXHash.pm
perl/DXProtHandle.pm

diff --git a/Changes b/Changes
index 0ff7901396681e9e4811c3428b4d7d44186d1fe9..39277cf1abaa29d8256265faae9014bdc522c2fa 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+04Feb25======================================================================
+1. Improve badspotter/node handling to handle more cases, more easily. 
+   Hopefully this won't cause problems greater than we already have.
 03Feb25======================================================================
 1. Filter cleanup (especially filter debugging)
 31Jan25======================================================================
index cf9f05211c202ff10cd42798f22542822921dd36..19658a13c56151f6dda8a892e053b919ca965bf6 100644 (file)
@@ -51,19 +51,37 @@ sub add
        my $n = uc shift;
        my $t = shift || time;
        $self->{$n} = $t;
+
+       # also add the base version if it has some ssid on it
+       my $nn = $n;
+       $nn =~ s|(?:-\d+)?(?:/\w)?$||;
+       $self->{$nn} = $t unless $n eq $nn;
 }
 
 sub del
 {
        my $self = shift;
        my $n = uc shift;
+       my $exact = shift;
        delete $self->{$n};
+       return if $exact;
+
+       my $nn = $n;
+       $nn =~ s|(?:-\d+)?(?:/\w)?$||;
+       my @ssid = (0..99);
+       delete $self->{"$nn-$_"} for @ssid;
 }
 
+
 sub in
 {
        my $self = shift;
        my $n = uc shift;
+       my $exact = shift;
+       
+       return 1 if exists $self->{$n};
+       return 0 if $exact;
+       $n =~ s/-\d+$//;
        return exists $self->{$n};
 }
 
@@ -80,11 +98,11 @@ sub set
        
        foreach $f (@f) {
 
-               if ($self->in($f)) {
+               if ($self->in($f, 1)) {
                        push @out, $dxchan->msg('hasha',uc $f, $self->{name});
                        next;
                }
-               $self->add($f);
+               $self->add($f, 1);
                push @out, $dxchan->msg('hashb', uc $f, $self->{name});
        }
        $self->put;
@@ -104,11 +122,11 @@ sub unset
        
        foreach $f (@f) {
 
-               unless ($self->in($f)) {
+               unless ($self->in($f, 1)) {
                        push @out, $dxchan->msg('hashd', uc $f, $self->{name});
                        next;
                }
-               $self->del($f);
+               $self->del($f, 1);
                push @out, $dxchan->msg('hashc', uc $f, $self->{name});
        }
        $self->put;
index 77ccd11a576d63fe8db8a0eb0de70114c38ef145..32ba0db0d931ab6c492962608ea547fab75d23fa 100644 (file)
@@ -49,7 +49,9 @@ use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restim
                        $eph_pc15_restime $pc9x_past_age $pc9x_dupe_age
                        $pc10_dupe_age $pc92_slug_changes $last_pc92_slug
                        $pc92Ain $pc92Cin $pc92Din $pc92Kin $pc9x_time_tolerance
-                       $pc92filterdef $senderverify $pc11_dwell_time $pc61_extract_route $pc92_ad_enabled $pc92c_ipaddr_enabled
+                       $pc92filterdef $senderverify $pc11_dwell_time $pc61_extract_route
+                       $pc92_ad_enabled $pc92c_ipaddr_enabled
+                       $preserve_node_ssid
                   );
 
 $pc9x_dupe_age = 60;                   # catch loops of circular (usually) D records
@@ -65,6 +67,7 @@ $senderverify = 0;                            # 1 - check for forged PC11 or PC61.
 $pc11_dwell_time = 2;                  # number of seconds to wait for a PC61 to come to substitute the PC11
 $pc61_extract_route = 0;               # generate missing  user route entry and IP address from passing PC61s
 
+$preserve_node_ssid = 0;               # With the changes to badnode set this to 1 to preserve badnode ssids
 
 $pc92filterdef = bless ([
                          # tag, sort, field, priv, special parser
@@ -122,18 +125,16 @@ sub handle_10
        }
 
        # if this is a 'nodx' node then ignore it
-       if ($badnode->in($pc->[6]) || ($via && $badnode->in($via))) {
+       if ($badnode->in($pc->[6], $preserve_node_ssid) || ($via && $badnode->in($via, $preserve_node_ssid))) {
                dbg($line) if isdbg('nologchan');
                dbg("PCPROT: Bad Node $pc->[6]/$via, dropped");
                return;
        }
 
 
-       my $nossid = $from;
-       $nossid =~ s/-\d+$//;
-       if ($badspotter->in($nossid)) {
+       if ($badspotter->in($from)) {
                dbg($line) if isdbg('nologchan');
-               dbg("PCPROT: Bad Spotter $nossid, dropped");
+               dbg("PCPROT: Bad Spotter $from, dropped");
                return;
        }
 
@@ -208,7 +209,7 @@ sub handle_11
 
 
        # if this is a 'nodx' node then ignore it
-       if ($badnode->in($pc->[7])) {
+       if ($badnode->in($pc->[7], $preserve_node_ssid)) {
                dbg($line) if isdbg('nologchan');
                dbg("PCPROT: Bad Node $pc->[7], dropped");
                return;
@@ -242,6 +243,13 @@ sub handle_11
        my $nossid = $pc->[6];
     $nossid =~ s/-\d+$//;
 
+       # is this is a 'bad spotter' or an unknown user then ignore it. 
+       if ($badspotter->in($nossid)) {
+               dbg($line) if isdbg('nologchan');
+               dbg("PCPROT: Bad Spotter $nossid, dropped");
+               return;
+       }
+
        my @spot = Spot::prepare($pc->[1], $pc->[2], $d, $pc->[5], $nossid, $pc->[7], $pc->[8]);
 
        #   $f0 = frequency
@@ -261,13 +269,6 @@ sub handle_11
        #   $f14 = ip address
 
 
-       # is this is a 'bad spotter' or an unknown user then ignore it. 
-       if ($badspotter->in($nossid)) {
-               dbg($line) if isdbg('nologchan');
-               dbg("PCPROT: Bad Spotter $nossid, dropped");
-               return;
-       }
-
        # global spot filtering on INPUT
        if ($self->{inspotsfilter}) {
                my ($filter, $hops) = $self->{inspotsfilter}->it(@spot);
@@ -597,18 +598,16 @@ sub handle_12
        $pc->[3] =~ s/^\s+//;                   # remove leading blanks
 
        # if this is a 'nodx' node then ignore it
-       if ($badnode->in($pc->[5])) {
+       if ($badnode->in($pc->[5], $preserve_node_ssid)) {
                dbg($line) if isdbg('nologchan');
                dbg("PCPROT: Bad Node $pc->[5], dropped");
                return;
        }
 
        # if this is a 'bad spotter' user then ignore it
-       my $nossid = $pc->[1];
-       $nossid =~ s/-\d+$//;
-       if ($badspotter->in($nossid)) {
+       if ($badspotter->in($pc->[1])) {
                dbg($line) if isdbg('nologchan');
-               dbg("PCPROT: Bad Spotter $nossid, dropped");
+               dbg("PCPROT: Bad Spotter $pc->[1], dropped");
                return;
        }
 
@@ -2512,12 +2511,17 @@ sub handle_93
                dbg($s);
        }
 
+       # if this is a 'bad node' user then ignore it
+       if ($badnode->in($onode, $preserve_node_ssid)) {
+               dbg($line) if isdbg('nologchan');
+               dbg("PCPROT: Bad Node $onode, dropped");
+               return;
+       }
+
        # if this is a 'bad spotter' user then ignore it
-       my $nossid = $from;
-       $nossid =~ s/-\d+$//;
-       if ($badspotter->in($nossid)) {
+       if ($badspotter->in($from)) {
                dbg($line) if isdbg('nologchan');
-               dbg("PCPROT: Bad Spotter $nossid, dropped");
+               dbg("PCPROT: Bad Spotter $from, dropped");
                return;
        }