[LON-CAPA-cvs] cvs: loncom / LondConnection.pm development_hosts.tab lond
albertel
lon-capa-cvs@mail.lon-capa.org
Sun, 06 Feb 2005 07:39:49 -0000
This is a MIME encoded message
--albertel1107675589
Content-Type: text/plain
albertel Sun Feb 6 02:39:49 2005 EDT
Modified files:
/loncom lond LondConnection.pm development_hosts.tab
Log:
- The second part of BUG#2330, removing the IPs from hosts.tab, converting loncnew/d to not expect them in there. Right now lond still needs them, so it does lookups on start up and SIGUSR2
--albertel1107675589
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20050206023949.txt"
Index: loncom/lond
diff -u loncom/lond:1.276 loncom/lond:1.277
--- loncom/lond:1.276 Wed Jan 26 07:13:58 2005
+++ loncom/lond Sun Feb 6 02:39:49 2005
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.276 2005/01/26 12:13:58 foxr Exp $
+# $Id: lond,v 1.277 2005/02/06 07:39:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,14 +58,13 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.276 $'; #' stupid emacs
+my $VERSION='$Revision: 1.277 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
my $client;
my $clientip; # IP address of client.
-my $clientdns; # DNS name of client.
my $clientname; # LonCAPA name of client.
my $server;
@@ -178,7 +177,6 @@
# $initcmd - The full text of the init command.
#
# Implicit inputs:
-# $clientdns - The DNS name of the remote client.
# $thisserver - Our DNS name.
#
# Returns:
@@ -187,10 +185,10 @@
#
sub LocalConnection {
my ($Socket, $initcmd) = @_;
- Debug("Attempting local connection: $initcmd client: $clientdns me: $thisserver");
- if($clientdns ne $thisserver) {
+ Debug("Attempting local connection: $initcmd client: $clientip me: $thisserver");
+ if($clientip ne "127.0.0.1") {
&logthis('<font color="red"> LocalConnection rejecting non local: '
- ."$clientdns ne $thisserver </font>");
+ ."$clientip ne $thisserver </font>");
close $Socket;
return undef;
} else {
@@ -4281,12 +4279,18 @@
my $myloncapaname = $perlvar{'lonHostID'};
Debug("My loncapa name is : $myloncapaname");
while (my $configline=<CONFIG>) {
- if (!($configline =~ /^\s*\#/)) {
- my ($id,$domain,$role,$name,$ip)=split(/:/,$configline);
- chomp($ip); $ip=~s/\D+$//;
+ if ($configline !~ /^\s*\#/ && $configline !~ /^\s*$/ ) {
+ my ($id,$domain,$role,$name)=split(/:/,$configline);
+ $name=~s/\s//g;
+ my (undef,undef,undef,undef,$ip) = gethostbyname($name);
+ if (length($ip) ne 4) {
+ &logthis("Skipping host $id name $name no IP $ip found\n");
+ next;
+ }
+ $ip=inet_ntoa($ip);
$hostid{$ip}=$id; # LonCAPA name of host by IP.
$hostdom{$id}=$domain; # LonCAPA domain name of host.
- $hostip{$id}=$ip; # IP address of host.
+ $hostip{$id}=$ip; # IP address of host.
$hostdns{$name} = $id; # LonCAPA name of host by DNS.
if ($id eq $perlvar{'lonHostID'}) {
@@ -4698,8 +4702,6 @@
if (defined($iaddr)) {
$clientip = inet_ntoa($iaddr);
Debug("Connected with $clientip");
- $clientdns = gethostbyaddr($iaddr, AF_INET);
- Debug("Connected with $clientdns by name");
} else {
&logthis("Unable to determine clientip");
$clientip='Unavailable';
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.35 loncom/LondConnection.pm:1.36
--- loncom/LondConnection.pm:1.35 Tue Sep 21 06:51:42 2004
+++ loncom/LondConnection.pm Sun Feb 6 02:39:49 2005
@@ -1,7 +1,7 @@
# This module defines and implements a class that represents
# a connection to a lond daemon.
#
-# $Id: LondConnection.pm,v 1.35 2004/09/21 10:51:42 foxr Exp $
+# $Id: LondConnection.pm,v 1.36 2005/02/06 07:39:49 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -234,6 +234,9 @@
my @ConfigLine = @{$hostshash{$Hostname}};
my $DnsName = $ConfigLine[3]; # 4'th item is dns of host.
Debug(5, "Connecting to ".$DnsName);
+ # if it is me use loopback for connection
+ if ($DnsName eq $LocalDns) { $DnsName="127.0.0.1"; }
+ Debug(8, "Connecting to $DnsName I am $LocalDns");
# Now create the object...
my $self = { Host => $DnsName,
LoncapaHim => $Hostname,
@@ -259,16 +262,16 @@
Type => SOCK_STREAM,
Proto => "tcp",
Timeout => 3)) {
+ Debug(8, "Error? \n$@ \n$!");
return undef; # Inidicates the socket could not be made.
}
my $socket = $self->{Socket}; # For local use only.
# If we are local, we'll first try local auth mode, otherwise, we'll try
# the ssl auth mode:
- Debug(8, "Connecting to $DnsName I am $LocalDns");
my $key;
my $keyfile;
- if ($DnsName eq $LocalDns) {
+ if ($DnsName eq '127.0.0.1') {
$self->{AuthenticationMode} = "local";
($key, $keyfile) = lonlocal::CreateKeyFile();
Debug(8, "Local key: $key, stored in $keyfile");
@@ -1185,7 +1188,7 @@
#---------------------- Subroutine read_hosts: Read a LON-CAPA hosts.tab
# formatted configuration file.
#
-my $RequiredCount = 5; # Required item count in hosts.tab.
+my $RequiredCount = 4; # Required item count in hosts.tab.
my $DefaultMaxCon = 5; # Default value for maximum connections.
my $DefaultIdle = 1000; # Default connection idle time in seconds.
my $DefaultMinCon = 0; # Default value for minimum connections.
@@ -1194,9 +1197,10 @@
my $Filename = shift;
my %HostsTab;
- open(CONFIG,'<'.$Filename) or die("Can't read $Filename");
+ open(CONFIG,'<'.$Filename) or die("Can't read $Filename");
while (my $line = <CONFIG>) {
- if (!($line =~ /^\s*\#/)) {
+ if ($line !~ /^\s*\#/) {
+ $line=~s/\s*$//;
my @items = split(/:/, $line);
if(scalar @items >= $RequiredCount) {
if (scalar @items == $RequiredCount) { # Only required items:
Index: loncom/development_hosts.tab
diff -u loncom/development_hosts.tab:1.54 loncom/development_hosts.tab:1.55
--- loncom/development_hosts.tab:1.54 Wed Jan 5 17:55:01 2005
+++ loncom/development_hosts.tab Sun Feb 6 02:39:49 2005
@@ -1,52 +1,50 @@
#Florida machines
-fsul1:fsu:library:frootmig.physics.fsu.edu:128.186.7.43
-fsul2:fsu:library:tycho.physics.fsu.edu:128.186.7.100
+fsul1:fsu:library:frootmig.physics.fsu.edu
+fsul2:fsu:library:tycho.physics.fsu.edu
# FSUoddl
-fsuoddll1:fsuoddl:library:webmc.oddl.fsu.edu:146.201.101.157
+fsuoddll1:fsuoddl:library:webmc.oddl.fsu.edu
#MSU devmachines
-103l1:103:library:deepthought.lite.msu.edu:35.8.63.54
-103l2:103:library:oscar.lite.msu.edu:35.8.63.88
-103l3:103:library:kirk.lite.msu.edu:35.8.63.41
-103l4:103:library:s18.lite.msu.edu:35.8.63.28
-103l5:103:library:uhura.lite.msu.edu:35.8.63.44
-# 103l6:103:library:tmp8.lite.msu.edu:35.8.63.98
-msua1:msu:access:agrajag.lite.msu.edu:35.8.63.68
-pnetl1:physnet:library:bistromath.lite.msu.edu:35.8.63.67
-msul1:msu:library:data.lite.msu.edu:35.8.63.49
-msul3:msu:library:fenchurch.lite.msu.edu:35.8.63.61
-# msul40:msu:library:tmp7.lite.msu.edu:35.8.63.97
-gerdl1:gerd:library:phy1.lbs.msu.edu:35.8.156.71
-basementl1:basement:library:pcp09229616pcs.sanarb01.mi.comcast.net:69.241.238.75
-casal1:casadepopo:library:pcp09229616pcs.sanarb01.mi.comcast.net:69.241.238.75
-annarborl1:annarbor:library:pcp09229616pcs.sanarb01.mi.comcast.net:69.241.238.75
-annarborl2:annarbor:library:albertel.user.msu.edu:35.10.113.122
-tacey1:tacey:library:taceyjo1-3.user.msu.edu:35.11.72.172
-northwood5l1:northwood5:library:raeburn-4.user.msu.edu:35.10.113.104
-conferencel1:conference:library:tmp1.lite.msu.edu:35.8.63.91
-
+103l1:103:library:deepthought.lite.msu.edu
+103l2:103:library:oscar.lite.msu.edu
+103l3:103:library:kirk.lite.msu.edu
+103l4:103:library:s18.lite.msu.edu
+103l5:103:library:uhura.lite.msu.edu
+# 103l6:103:library:tmp8.lite.msu.edu
+msua1:msu:access:agrajag.lite.msu.edu
+pnetl1:physnet:library:bistromath.lite.msu.edu
+msul1:msu:library:data.lite.msu.edu
+msul3:msu:library:fenchurch.lite.msu.edu
+# msul40:msu:library:tmp7.lite.msu.edu
+gerdl1:gerd:library:phy1.lbs.msu.edu
+basementl1:basement:library:pcp09229616pcs.sanarb01.mi.comcast.net
+casal1:casadepopo:library:pcp09229616pcs.sanarb01.mi.comcast.net
+annarborl1:annarbor:library:pcp09229616pcs.sanarb01.mi.comcast.net
+annarborl2:annarbor:library:albertel.user.msu.edu
+tacey1:tacey:library:taceyjo1-3.user.msu.edu
+northwood5l1:northwood5:library:raeburn-4.user.msu.edu
+conferencel1:conference:library:tmp1.lite.msu.edu
# Banghart
-banghartl1:banghart:library:c-24-5-46-246.client.comcast.net:24.5.46.246
+banghartl1:banghart:library:c-24-5-46-246.client.comcast.net
#Truckee
-tmccbifrost:tmcc:library:bifrost.tmcc.edu:134.197.153.204
+tmccbifrost:tmcc:library:bifrost.tmcc.edu
#Ohio University
-oucapa2:ohiou:library:capa1.phy.ohiou.edu:132.235.24.28
+oucapa2:ohiou:library:capa1.phy.ohiou.edu
#Umich
-umichwebsvcs:umich:library:141.213.237.107:141.213.237.107
-volverine:umich:library:instructor.physics.lsa.umich.edu:141.211.100.160
+umichwebsvcs:umich:library:wsloncapa.us.itd.umich.edu
+volverine:umich:library:instructor.physics.lsa.umich.edu
#UIUC
-uiucdev1:uiuc:library:dev1.lon-capa.uiuc.edu:128.174.234.26
-
+uiucdev1:uiuc:library:dev1.lon-capa.uiuc.edu
#Northern Arizona
-naudev0:nau:library:naudev0.chm.nau.edu:134.114.204.112
+naudev0:nau:library:naudev0.chm.nau.edu
#No longer around
-itdslon:msu:library:itdsvh2.cl.msu.edu:35.8.3.172
-nscll1:nscl:library:lonkashy.nscl.msu.edu:35.8.8.29
+itdslon:msu:library:itdsvh2.cl.msu.edu
+nscll1:nscl:library:lonkashy.nscl.msu.edu
--albertel1107675589--