+19Jan23=======================================================================
+1. Introduce aliasing for localhost in DX Spots and outgoing PC92 A records
+ on login. There are two variables which can be set with the alias to use:
+ $main::localhost_alias_ipv4
+ $main::localhost_alias_ipv6
+ These can be set in the /spider/scripts/startup, but this is only
+ necessary if the node has more than one interface, or virtual hosts. If
+ there is ONLY ONE ipv4 and/or ipv6 IP address on the node machine then
+ these variables will be automatically populated on first use. But the SAFE
+ thing to do is to set them in the startup file.
+
+ THIS FEATURE IS EXPERIMENTAL...
18Jan23=======================================================================
1. Make sure than *every* channel has an IP address. Thank you (I think) Kin
for pointing out that PC92 A records were not going out with IP addresses.
my $addr = $self->hostname || '127.0.0.1';
+$addr = $main::localhost_alias_ipv6 if $addr eq '::1' && $main::localhost_alias_ipv6;
+$addr = $main::localhost_alias_ipv4 if $addr =~ /^127\./ && $main::localhost_alias_ipv4;
+
Log('cmd', "$self->{call}|$addr|dx|$line");
my @bad;
}
$self->{inqueue} = [];
- $self->{hostname} = $self->{conn}->peerhost if $conn;
+ if ($conn) {
+ $self->{hostname} = $self->{conn}->peerhost;
+ $self->{sockhost} = $self->{conn}->sockhost;
+ }
$count++;
dbg("DXChannel $self->{call} created ($count)") if isdbg('chan');
# routing, this must go out here to prevent race condx
my $pkg = shift;
my $call = shift;
-# my @rout = $main::routeroot->add_user($call, Route::here(1));
- DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1, undef, undef, $self->hostname], );
+ # my @rout = $main::routeroot->add_user($call, Route::here(1));
+ my $ipaddr = $self->hostname;
+ $ipaddr = $main::localhost_alias_ipv6 if $ipaddr eq '::1' && $main::localhost_alias_ipv6;
+ $ipaddr = $main::localhost_alias_ipv4 if $ipaddr =~ /^127\./ && $main::localhost_alias_ipv4;
+ DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1, undef, undef, $ipaddr], );
# ALWAYS output the user
my $ref = Route::User::get($call);
@listen = (
# remove the '#' character from the next line to enable the listener!
- # ["0.0.0.0", 7300],
+ # ["0.0.0.0", 7300], # IPV4 only
+# ^
+# |
+#
+# OR (IF you listen on IPV6 as well) This one!!!!!
+ # ["::", 7300], # IPV4 and IPV6
# ^
# |
# This one!!!!!
);
-
+
+$
1;
return $conn->{peerhost};
}
+sub sockhost
+{
+ my $conn = shift;
+ unless ($conn->{sockhost}) {
+ $conn->{sockhost} ||= 'ax25' if $conn->ax25;
+ $conn->{sockhost} ||= $conn->{sock}->handle->sockhost if $conn->{sock};
+ $conn->{sockhost} ||= 'UNKNOWN';
+ }
+ $conn->{sockhost} =~ s/^::ffff://;
+ if (! defined $main::localhost_alias_ipv4 && $conn->{sockhost} =~ /\./ && $conn->{sockhost} !~ /^127\./) {
+ $main::localhost_alias_ipv4 = $conn->{sockhost};
+ dbg("Msg: localhost_alias_ipv4 = '$main::localhost_alias_ipv4'");
+ } elsif (! defined $main::localhost_alias_ipv6 && $conn->{sockhost} =~ /:/ && $conn->{sockhost} !~ /^::1$/) {
+ $main::localhost_alias_ipv6 = $conn->{sockhost};
+ dbg("Msg: localhost_alias_ipv6 = '$main::localhost_alias_ipv6'");
+ }
+ return $conn->{sockhost};
+}
#-----------------------------------------------------------------
# Send side routines
$sock->timeout(0);
$sock->start;
$conn->{peerhost} = eval { $handle->peerhost; };
- dbg((ref $conn) . " connected $conn->{cnum} to $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg ('connect');
+ $conn->{sockhost} = eval { $handle->sockhost; };
+ dbg((ref $conn) . " connected $conn->{cnum}:$conn->{sockhost} to $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg ('connect');
if ($conn->{on_connect}) {
&{$conn->{on_connect}}($conn, $handle);
}
my $msg = shift;
my $sock = $conn->{sock};
return unless defined($sock);
- return if $conn->{disconnecting};
+ return if $conn->{disonnecting};
$total_in += length $msg;
$conn->{datain} += length $msg;
$sock->timeout(0);
$sock->start;
$conn->{peerhost} = $handle->peerhost || 'unknown';
- $conn->{peerhost} =~ s|^::ffff:||; # chop off leading pseudo IPV6 stuff on dual stack listeners
$conn->{peerport} = $handle->peerport || 0;
- dbg((ref $conn) . " accept $conn->{cnum} from $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg('connect');
+ $conn->{sockhost} = $handle->sockhost || '';
+ dbg((ref $conn) . " accept $conn->{cnum}:$conn->{sockhost} from $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg('connect');
my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost}, $conn->{peerport});
$conn->{sort} = 'Incoming';
if ($eproc) {
our $cldsecs; # the amount of cpu time any child processes have consumed
our $allowslashcall; # Allow / in connecting callsigns (ie PA0/G1TLH, or even PA0/G1TLH/2)
+our $localhost_alias_ipv4; # these are the IPV4 & 6 aliases for localhost connected clients
+our $localhost_alias_ipv6; # for things (PC92, PC61 etc) that expose IP addresses. These *may*
+ # be set by Msg.pm stuff if they are left undefined but, if you need
+ # certanty then set/var them in the startup file.
use vars qw($version $subversion $build $gitversion $gitbranch);
AGWMsg::init(\&new_channel);
}
-
sub setup_start
{
#############################################################