Changeset fe53e75
- Timestamp:
- May 18, 2008 9:54:18 PM (17 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 48f7524
- Parents:
- 6115f88
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/fed-tun.pl
r6115f88 rfe53e75 64 64 my $type; 65 65 my $tunnelcfg; 66 my $ssh_port_fwds = ""; 66 my @ssh_port_fwds; # Queue of ssh portforwarders to start. The 67 # -L or -R is in here. 67 68 my $remote_script_dir; # location of the other sides fed-tun.pl 68 69 my $event_repeater; # The pathname of the event repeater … … 109 110 110 111 if (defined($opts{'fsname'})) { 111 $ssh_port_fwds = "-R :$SMBFS_PORT:$opts{'fsname'}:$SMBFS_PORT ";112 push(@ssh_port_fwds,"-R :$SMBFS_PORT:$opts{'fsname'}:$SMBFS_PORT"); 112 113 } 113 114 114 115 if (defined($opts{'bossname'})) { 115 $ssh_port_fwds .= "-R :$TMCD_PORT:$opts{'bossname'}:$TMCD_PORT ";116 push(@ssh_port_fwds, "-R :$TMCD_PORT:$opts{'bossname'}:$TMCD_PORT"); 116 117 } 117 118 118 119 if (defined($opts{'eventservername'})) { 119 $ssh_port_fwds .= "-R :$remote_pubsub_port:$opts{'eventservername'}:".120 " $PUBSUB_PORT ";120 push(@ssh_port_fwds,"-R ". 121 ":$remote_pubsub_port:$opts{'eventservername'}:$PUBSUB_PORT"); 121 122 } 122 123 if (defined($opts{'remoteeventservername'})) { 123 $ssh_port_fwds .="-L :$remote_pubsub_port:" .124 "$opts{'remoteeventservername'}:$PUBSUB_PORT ";125 } 126 127 $ssh_port_fwds = ""if ($opts{'type'} eq 'experiment');128 129 print "ssh_port_fwds = $ssh_port_fwds\n" if ($debug);124 push(@ssh_port_fwds,"-L :$remote_pubsub_port:" . 125 "$opts{'remoteeventservername'}:$PUBSUB_PORT"); 126 } 127 128 @ssh_port_fwds = () if ($opts{'type'} eq 'experiment'); 129 130 print "ssh_port_fwds = ", join("\n",@ssh_port_fwds), "\n" if ($debug); 130 131 } 131 132 … … 172 173 173 174 if ($type eq "control") { 174 system("$SSH $ssh_port_fwds -Nno \"StrictHostKeyChecking no\" $opts{'peer'} &"); #or die "Failed to run ssh"; 175 foreach my $fwd (@ssh_port_fwds) { 176 system("$SSH -N $fwd -Nno \"StrictHostKeyChecking no\" ". 177 "$opts{'peer'} &"); #or die "Failed to run ssh"; 178 } 175 179 176 180 exit; … … 184 188 my $bridge = "bridge" . $count; 185 189 my $tun = "tap" . $count; 190 my $cmd; 186 191 187 192 print "Found $iface, $addr, to bridge on $bridge\n" if ($debug); … … 191 196 # In order to check for problems, we open it this way and read 192 197 # the expected single line of output when the tunnel is connected. 193 194 print "$SSH -w $count:$count $ssh_port_fwds -o \"StrictHostKeyChecking no\" $opts{'peer'} \"$remote_script_dir/fed-tun.pl $remote_config_file -r $addr $count\"\n" if $debug; 195 open($SSHCMD[$count], "$SSH -w $count:$count $ssh_port_fwds -o \"StrictHostKeyChecking no\" $opts{'peer'} \"$remote_script_dir/fed-tun.pl $remote_config_file -r $addr $count\" |") or die "Failed to run ssh"; 198 # To make debugging easier and to degrade more gracefully, I've split 199 # these out into multiple processes. 200 201 foreach my $fwd (@ssh_port_fwds) { 202 $cmd = "$SSH -N $fwd -o \"StrictHostKeyChecking no\" ". 203 "$opts{'peer'} &"; 204 205 print "$cmd\n" if $debug; 206 system("$cmd"); # or die "Failed to run ssh"; 207 } 208 $cmd = "$SSH -w $count:$count -o \"StrictHostKeyChecking no\" " . 209 "$opts{'peer'} \"$remote_script_dir/fed-tun.pl " . 210 "$remote_config_file -r $addr $count\" & |"; 211 212 print "$cmd\n" if $debug; 213 214 open($SSHCMD[$count], $cmd) 215 or die "Failed to run ssh"; 196 216 197 217 my $check = <$SSHCMD[$count]>; # Make sure something ran... … … 200 220 &setup_bridging($tun, $bridge, $iface, $addr); 201 221 $count++; 202 $ssh_port_fwds = ""; # only do this on the first connection222 @ssh_port_fwds = (); # only do this on the first connection 203 223 } 204 224 close(IFFILE); … … 245 265 # event repeater. 246 266 247 my $file = new IO::File(">/tmp/remote");248 print($file "hello!!!\n") if $file;249 267 if ( $count == 0 && $type ne "experiment" ) { 250 268 my $remote_pubsub_port = $PUBSUB_PORT - 1; # There will be a local … … 252 270 # dodge the port on the 253 271 # remote tunnel node. 254 print($file "In here!\n");255 272 # Make sure we have the relevant parameters 256 273 die "Missing event repeater params (No config file ?)\n" … … 270 287 warn "Event repeater returned $?\n" if $?; 271 288 } 272 $file->close() if $file;273 289 } else { 274 290 print "inactive end of a connection, finishing" if ($debug);
Note: See TracChangeset
for help on using the changeset viewer.