Last change
on this file since 5b0e6e0 was
a80a4a7,
checked in by Ted Faber <faber@…>, 11 years ago
|
Keep state for desktop disconnect/connect cycles to work
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[a80a4a7] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | |
---|
| 5 | use gateway_lib; |
---|
| 6 | |
---|
| 7 | use Getopt::Long; |
---|
| 8 | |
---|
| 9 | use IO::File; |
---|
| 10 | |
---|
| 11 | my $tapno; |
---|
| 12 | my $addr; |
---|
| 13 | my $iface; |
---|
| 14 | my $fedkit_dir= "/usr/local/federation"; |
---|
| 15 | my $perl = "/usr/bin/perl"; |
---|
| 16 | my $peer; |
---|
| 17 | my $use_file; |
---|
| 18 | my %opts = ( |
---|
| 19 | 'tapno=s' => \$tapno, |
---|
| 20 | 'addr=s' => \$addr, |
---|
| 21 | 'peer=s' => \$peer, |
---|
| 22 | 'use_file', \$use_file, |
---|
| 23 | ); |
---|
| 24 | |
---|
| 25 | exit(20) unless GetOptions(%opts); |
---|
| 26 | gateway_lib::read_config(gateway_lib::config_filename(), \%opts) |
---|
| 27 | if $use_file; |
---|
| 28 | |
---|
| 29 | die "Need an address\n" unless $addr; |
---|
| 30 | |
---|
| 31 | # Get the interface to reset |
---|
| 32 | my $f = new IO::File("/tmp/interface$tapno") || |
---|
| 33 | die "Cannot open interface file\n"; |
---|
| 34 | |
---|
| 35 | while (<$f>) { |
---|
| 36 | chomp; |
---|
| 37 | $iface = $_; |
---|
| 38 | } |
---|
| 39 | $f->close( ); |
---|
| 40 | |
---|
| 41 | print "iface is $iface\n"; |
---|
| 42 | gateway_lib::configure_outgoing_iface($iface, $addr); |
---|
| 43 | |
---|
| 44 | exit(0); |
---|
| 45 | |
---|
| 46 | =pod |
---|
| 47 | |
---|
| 48 | =head1 NAME |
---|
| 49 | |
---|
| 50 | B<unsetup_bridge.pl> - Restore the given IP address to the interface bridged to |
---|
| 51 | the given tapno. |
---|
| 52 | |
---|
| 53 | =head1 OPTIONS |
---|
| 54 | |
---|
| 55 | =over 8 |
---|
| 56 | |
---|
| 57 | =item B<addr=>I<address> |
---|
| 58 | |
---|
| 59 | Address of the local interface to restore. |
---|
| 60 | |
---|
| 61 | =item B<tapno=>I<integer> |
---|
| 62 | |
---|
| 63 | The tap interface that generated the interface save file. |
---|
| 64 | |
---|
| 65 | =item B<use_file> |
---|
| 66 | |
---|
| 67 | If given read additional parameters from the file in |
---|
| 68 | /proj/I<project>/exp/I<experiment>/tmp/I<hostname>.gw/conf where those are the |
---|
| 69 | current testbed project and experiment and the hostname is before the first |
---|
| 70 | dot. The file is option: value. |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | =back |
---|
| 74 | |
---|
| 75 | =head1 SYNOPSIS |
---|
| 76 | |
---|
| 77 | B<unsetup_bridge.pl> restores a previously assigned IP address to an interface. |
---|
| 78 | That interface name was saved by B<setup_bridge.pl>, before it was removed for |
---|
| 79 | bridging. |
---|
| 80 | |
---|
| 81 | =head1 AUTHORS |
---|
| 82 | |
---|
| 83 | Ted Faber <faber@isi.edu> |
---|
| 84 | |
---|
| 85 | =cut |
---|
Note: See
TracBrowser
for help on using the repository browser.