source: fedkit/unsetup_bridge.pl

Last change on this file was a80a4a7, checked in by Ted Faber <faber@…>, 10 years ago

Keep state for desktop disconnect/connect cycles to work

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