Changeset cd3eceb for fedkit


Ignore:
Timestamp:
Sep 17, 2007 3:35:32 PM (17 years ago)
Author:
Kevin Lahey <lahey@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
0e23fdb
Parents:
3529a90
Message:

Ouch, tighten up handling of the options I read in from the configuration
file; Perl isn't as flexible about true and false as I thought.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/fed-tun.pl

    r3529a90 rcd3eceb  
    4040
    4141my %opts;
     42my @expected_opts = qw(active tunnelcfg bossname fsname type
     43                       peer pubkeys privkeys);
    4244my $filename;
    4345my $remote;
     
    4547my $count;
    4648my $addr;
     49my $active;
     50my $type;
     51my $tunnelcfg;
     52my $ssh_port_fwds = "";
    4753
    4854if ($#ARGV != 0 && !getopts('df:r', \%opts)) {
     
    7177    &parse_config("$filename", \%opts) ||
    7278        die "Cannot read config file $filename: $!\n";
    73 }
    74 
    75 my $ssh_port_fwds = "";
    76 
    77 if (defined($opts{'fsname'})) {
     79
     80    foreach my $opt (@expected_opts) {
     81        warn "Missing $opt option\n" if (!defined($opts{$opt}));
     82    }
     83
     84    $active = 1 if ($opts{'active'} =~ /true/i);
     85    $tunnelcfg = 1 if ($opts{'tunnelcfg'} =~ /true/i);
     86    $type = $opts{'type'};
     87    $type =~ tr/A-Z/a-z/;
     88
     89    if (defined($opts{'fsname'})) {
    7890        $ssh_port_fwds = "-R :139:$opts{'fsname'}:139 ";
    79 }
    80 
    81 if (defined($opts{'bossname'})) {
     91    }
     92
     93    if (defined($opts{'bossname'})) {
    8294        $ssh_port_fwds .= "-R :7777:$opts{'bossname'}:7777 ";
    83 }
    84 
    85 $ssh_port_fwds = "" if ($opts{'type'} eq 'experiment');
    86 
    87 print "ssh_port_fwds = $ssh_port_fwds\n" if ($debug);
    88 
    89 print "opts %opts\n";
     95    }
     96
     97    $ssh_port_fwds = "" if ($opts{'type'} eq 'experiment');
     98
     99    print "ssh_port_fwds = $ssh_port_fwds\n" if ($debug);
     100}
    90101
    91102# Need these to make the Ethernet tap and bridge to work...
     
    94105system("kldload /boot/kernel/if_tap.ko");
    95106
    96 if ($opts{'tunnelcfg'} && !$remote) {
     107if ($tunnelcfg && !$remote) {
    97108    # Most Emulab-like testbeds use globally-routable addresses on the
    98109    # control net;  at DETER, we isolate the control net from the Internet.
     
    108119}
    109120
    110 if ($opts{'active'}) {
     121if ($active) {
    111122    # If we're the initiator, open up a separate tunnel to the remote
    112123    # host for each of the different experiment net interfaces on this
Note: See TracChangeset for help on using the changeset viewer.