Changeset 8034579 for fedkit/fed-tun.pl


Ignore:
Timestamp:
Apr 10, 2008 5:00:03 PM (16 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
33e3537
Parents:
f64fa81
Message:

event repeater starts remotely

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/fed-tun.pl

    rf64fa81 r8034579  
    6161my $ssh_port_fwds = "";
    6262my $remote_script_dir;          # location of the other sides fed-tun.pl
     63my $event_repeater;             # The pathname of the event repeater
     64my $remote_config_file;         # Config file for the other side
    6365
    6466if ($#ARGV != 0 && !getopts('df:r', \%opts)) {
     
    9799    $type =~ tr/A-Z/a-z/;
    98100    $remote_script_dir = $opts{'remotescriptdir'} || ".";
     101    $event_repeater = $opts{'eventrepeater'};
     102    $remote_config_file = $opts{'remoteconfigfile'};
     103    $remote_config_file = "-f $remote_config_file" if $remote_config_file;
    99104
    100105    if (defined($opts{'fsname'})) {
     
    179184        # the expected single line of output when the tunnel is connected.
    180185
    181         open($SSHCMD[$count], "$SSH -w $count:$count $ssh_port_fwds -o \"StrictHostKeyChecking no\" $opts{'peer'}  \"$remote_script_dir/fed-tun.pl -r $addr $count\" |") or die "Failed to run ssh";
     186        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;
     187        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";
    182188
    183189        my $check = <$SSHCMD[$count]>;  # Make sure something ran...
     
    210216    &setup_bridging($tun, $bridge, $iface, $addr);
    211217    print "Remote connection all set up!\n";  # Trigger other end with output
     218
     219    # If this is the first remote invocation on a control gateway, start the
     220    # event repeater.
     221
     222    my $file = new IO::File(">/tmp/remote");
     223    print($file "hello!!!\n") if $file;
     224    if ( $count == 0 && $type ne "experiment" ) {
     225        my $remote_pubsub_port = $PUBSUB_PORT - 1;  # There will be a local
     226                                                    # pubsubd running, so we
     227                                                    # dodge the port on the
     228                                                    # remote tunnel node.
     229        print($file "In here!\n");
     230        # Make sure we have the relevant parameters
     231        die "Missing event repeater params (No config file ?)\n"
     232            unless $event_repeater && $opts{'remoteexperiment'} &&
     233            $opts{'localexperiment'};
     234
     235        print "Starting event repeater\n" if $debug;
     236       
     237        print($file "$event_repeater -P $remote_pubsub_port -S localhost " .
     238            "-E $opts{'remoteexperiment'} -e $opts{'localexperiment'}\n")
     239            if $file;
     240        # Connect to the forwarded pubsub port on this host to listen to the
     241        # other experiment's events, and to the local experiment to forward
     242        # events.
     243        system("$event_repeater -P $remote_pubsub_port -S localhost " .
     244            "-E $opts{'remoteexperiment'} -e $opts{'localexperiment'}");
     245        warn "Event repeater returned $?\n" if $?;
     246    }
     247    $file->close() if $file;
    212248} else {
    213249    print "inactive end of a connection, finishing" if ($debug);
Note: See TracChangeset for help on using the changeset viewer.