[7e50f69] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | |
---|
| 5 | use gateway_lib; |
---|
| 6 | |
---|
| 7 | use Getopt::Long; |
---|
| 8 | |
---|
| 9 | my $tapno; |
---|
| 10 | my $addr; |
---|
| 11 | my $dest; |
---|
| 12 | my $iface; |
---|
| 13 | my $fedkit_dir= "/usr/local/federation"; |
---|
| 14 | my $perl = "/usr/bin/perl"; |
---|
| 15 | my $use_file; |
---|
| 16 | my %opts = ( |
---|
| 17 | 'tapno=s' => \$tapno, |
---|
| 18 | 'addr=s' => \$addr, |
---|
| 19 | 'dest=s' => \$dest, |
---|
| 20 | 'use_file', \$use_file, |
---|
| 21 | ); |
---|
| 22 | |
---|
| 23 | exit(20) unless GetOptions(%opts); |
---|
| 24 | gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts) |
---|
| 25 | if $use_file; |
---|
| 26 | |
---|
| 27 | die "Only one of dest and addr is allowed\n" if $addr && $dest; |
---|
| 28 | |
---|
| 29 | $iface = $dest ? |
---|
| 30 | gateway_lib::dest_to_iface($dest) : gateway_lib::addr_to_iface($addr) |
---|
| 31 | if !$iface; |
---|
| 32 | |
---|
| 33 | print "iface is $iface\n"; |
---|
| 34 | |
---|
| 35 | gateway_lib::bind_tap_to_iface($tapno, $iface); |
---|
| 36 | |
---|
| 37 | exit(0); |
---|
| 38 | |
---|
| 39 | =pod |
---|
| 40 | |
---|
| 41 | =head1 NAME |
---|
| 42 | |
---|
| 43 | B<setup_bridge.pl> - Connect a tap and local interface. Called both remotely |
---|
| 44 | and locally to establish the two sides of the bridge. |
---|
| 45 | |
---|
| 46 | =head1 OPTIONS |
---|
| 47 | |
---|
| 48 | =over 8 |
---|
| 49 | |
---|
| 50 | =item B<addr=>I<address> |
---|
| 51 | |
---|
| 52 | Address of the local interface to connect to the given tap interface on the |
---|
| 53 | given bridge interface. |
---|
| 54 | |
---|
| 55 | =item B<dest=>I<destination> |
---|
| 56 | |
---|
| 57 | Attach the interface on which I<destination> can be reached to the given |
---|
| 58 | tap/bridge combo. |
---|
| 59 | |
---|
| 60 | =item B<tapno=>I<integer> |
---|
| 61 | |
---|
| 62 | The tap interafce to connect. This will be the integer that follows tap and |
---|
| 63 | bridge in the interface names. |
---|
| 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<setup_bridge.pl> Connects the established ssh tunnel (a tap interface) to |
---|
| 78 | a local interface through a bridge interface. Traffic on the local interface |
---|
| 79 | will cross the network over the ssh tunnel and be released onto the net via a |
---|
| 80 | symmetrical setup on the peer. |
---|
| 81 | |
---|
| 82 | The interface to attach can be given either by its interface or an address/DNS |
---|
| 83 | name to reach. In either case, all IP addresses are removed from the |
---|
| 84 | bound interface. |
---|
| 85 | |
---|
| 86 | =head1 AUTHORS |
---|
| 87 | |
---|
| 88 | Ted Faber <faber@isi.edu> |
---|
| 89 | |
---|
| 90 | =cut |
---|