X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProtHandle.pm;h=b051fad35c201533c8451443f66e8c95fcc02c17;hb=56fd7417545aa9de3101434bc88156b5eebb37ab;hp=2055a2941d861f681b6e8a41df6a6f442f19c582;hpb=3b7aa32ea996597d0e164197b06fe181a846dbf6;p=spider.git diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index 2055a294..b051fad3 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -34,7 +34,7 @@ use Route::Node; use Script; use strict; -use warnings; +use warnings qw(all); use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restime $eph_pc34_restime $last_hour $last10 %eph %pings %rcmds $ann_to_talk @@ -1558,17 +1558,27 @@ sub _decode_pc92_call my $is_extnode = $flag & 2; my $here = $flag & 1; my $ip; - $part[1] //= ''; - $part[2] //= ''; - $part[3] //= ''; - if ($part[1] =~ /[,.]/) { - $ip = $part[1]; - $part[1] = $part[2] = 0; - } elsif ($part[3] =~ /[,.]/) { - $ip = $part[3]; - } - $ip =~ s/,/:/g if $ip; - return ($call, $is_node, $is_extnode, $here, $part[1], $part[2], $ip); + my $version = $part[1] || 0; + my $build = $part[2] || 0; + my $ip = $part[3] || ''; + + if (is_ipaddr($version)) { + $ip = $version; + $version = 0; + } + $version =~ s/\D//g; + $build =~ s/^0\.//; + $build =~ s/\D//g; + $version ||= 0; + $build ||= 0; + + if ($ip) { + $ip =~ s/,/:/g; + $ip =~ s/^::ffff://i; + } + dbg("$icall = '" . join("', '", $call, $is_node, $is_extnode, $here, $version, $build, $ip) . "'") if isdbg('pc92'); + + return ($call, $is_node, $is_extnode, $here, $version+0, $build+0, $ip); } # decode a pc92 call: flag call : version : build @@ -1599,6 +1609,7 @@ sub _encode_pc92_call $ip =~ s/:/,/g; $extra .= ':' . $ip; } + return "$flag$call$extra"; } @@ -1615,11 +1626,6 @@ sub _add_thingy my ($call, $is_node, $is_extnode, $here, $version, $build, $ip) = @$s; my @rout; - # remove spurious IPV6 prefix on IPV4 addresses - $ip =~ s/^::ffff:// if $ip; - $build ||= 0; - $version ||= 0; - if ($call) { my $ncall = $parent->call; if ($ncall ne $call) { @@ -1876,7 +1882,7 @@ sub pc92_handle_first_slot } $parent->here(Route::here($here)); $parent->version($version || $pc19_version) if $version; - $build =~ s/^0\.//, $parent->build($build) if $build; + $parent->build($build) if $build; $parent->PC92C_dxchan($self->{call}, $hops) unless $self->{call} eq $parent->call; return ($parent, @radd); } @@ -2000,13 +2006,11 @@ sub handle_92 my $call = $parent->call; my $version = $ent[4] || 0; my $build = $ent[5] || 0; - $build =~ s/^0\.//; my $oldbuild = $parent->build || 0; - $oldbuild =~ s/^0\.//; my $oldversion = $parent->version || 0; my $user = check_add_user($parent->call, 'S'); my $oldsort = $user->sort // ''; - if ($version =~ /^\d+$/) { +# if ($version =~ /^\d+$/ && $oldversion =~ /^\d+$/) { if ($oldsort ne 'S' || $oldversion != $version || $build != $oldbuild) { dbg("PCProt PC92 K node $call updated version: $version (was $oldversion) build: $build (was $oldbuild) sort: 'S' (was $oldsort)"); $user->sort('S'); @@ -2014,7 +2018,9 @@ sub handle_92 $user->build($parent->build($build)); $user->put; } - } +# } else { +# dbg("DXProt PC92 K version strings new: '$version' old: '$oldversion'"); +# } dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount'); } } elsif ($sort eq 'A' || $sort eq 'D' || $sort eq 'C') {