Changeset fde165c


Ignore:
Timestamp:
Sep 22, 2009 1:05:50 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
Children:
8c9933c
Parents:
e26c240
Message:

comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/config_from_tunnelip.pl

    re26c240 rfde165c  
    22
    33use strict;
    4 use IO::File;
    54use IO::Pipe;
    65use Getopt::Long;
    76
     7# Commands to use below.  These all seem to be in the same place on FreeBSD and
     8# Lunix
    89my $TMCC = "/usr/local/etc/emulab/tmcc";
    910my $FINDIF = "/usr/local/etc/emulab/findif";
     
    1112my $ROUTE = "/sbin/route";
    1213
    13 my $tmcc = new IO::Pipe || die "Can't create tmcc pipe: $!\n";
    14 my $interface;
    15 my $ip;
    16 my $mac;
    17 my $netmask ="255.255.255.0";
    18 my $router;
    19 my $routedest;
     14my $tmcc = new IO::Pipe || die "Can't create tmcc pipe: $!\n";  # To parse tmcc
     15my $interface;                  # Interface with external address
     16my $ip;                         # IP address of external interface
     17my $mac;                        # MAC address
     18my $netmask;                    # Netmask
     19my $router;                     # Router for the internet
     20my $routedest;                  # Add host route to this address (if given)
    2021
     22# Linux and FreeBSD use slightly different route syntax, so get the OS
    2123my $os = `uname`;
    2224chomp $os;
    2325
     26# Option parsing, --destination sets $routedest
    2427GetOptions('destination=s' => \$routedest);
    2528
     29# Parse out the info about tunnelips
    2630$tmcc->reader("$TMCC tunnelip");
    2731while (<$tmcc>) {
     
    3640die "No MAC information for tunnel.\n" unless $mac;
    3741
     42# Use the emulab findif command to get the right interface to configure
    3843$interface = `$FINDIF $mac`;
    3944chomp $interface;
    4045die "Can't get interface for mac address $mac: $?" if $? || !$interface;
    4146
     47# Do the ifconfig
    4248my @ifconfig = ($IFCONFIG, $interface, $ip);
    4349push(@ifconfig, 'netmask', $netmask) if $netmask;
     
    4652die join(" ", @ifconfig) . " failed: $!\n" if $?;
    4753
     54# Add the host route, if needed
    4855if ($routedest ) {
    4956    if ($router) {
Note: See TracChangeset for help on using the changeset viewer.