Changeset fd7a59b
- Timestamp:
- Oct 16, 2007 6:47:07 PM (17 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- e5fee75
- Parents:
- e863014
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/fed-tun.pl
re863014 rfd7a59b 14 14 # 15 15 # * Create a layer 2 ssh tunnel, set up bridging, and hang loose. 16 # 16 17 17 18 use strict; … … 26 27 my $NC = "/usr/bin/nc"; 27 28 my $SSH_PORT = 22; 29 my $ROUTE_GET = "/sbin/route get"; # XXX: works on FreeBSD, but should 30 # should be 'ip route get' for Linux 28 31 29 32 sub setup_bridging; … … 40 43 my $usage = "Usage: fed-tun.pl [-r] [-d] [-f config-filename] [count addr]\n"; 41 44 42 my %opts; 45 my %opts; # Note that this is used for both getops and the options file 43 46 my @expected_opts = qw(active tunnelcfg bossname fsname type 44 47 peer pubkeys privkeys); … … 176 179 close(IFFILE); 177 180 } elsif ($remote) { 178 # We're on the remote system; for now, we just grab and use 179 # the one experimental interface. Later, we'll actually look 180 # at the address passed to match up the appropriate interfaces. 181 # We're on the remote system; figure out which interface to 182 # tweak, based on the IP address passed in. 181 183 182 184 my $iter = 0; 183 184 open(IFFILE, "/var/emulab/boot/ifmap") || die "couldn't open ifmap\n"; 185 while (<IFFILE>) {186 die "Argh, too many experimental interfaces!" if ($iter > 0); 187 my @a = split(' '); 188 my $iface = $a[0];189 my $addr = $a[1];190 my $bridge = "bridge" . $count; 191 my $tun = "tap" . $count;192 193 &setup_bridging($tun, $bridge, $iface, $addr);194 $iter++;195 }196 close(IFFILE); 197 185 my $iface; 186 187 open(RTFILE, "$ROUTE_GET $addr |") || die "couldn't do $ROUTE_GET\n"; 188 while (<RTFILE>) { 189 if (/interface: (\w+)/) { 190 $iface = $1; 191 } 192 } 193 close(RTFILE); 194 195 die "Couldn't find interface to use." if (!defined($iface)); 196 my $bridge = "bridge" . $count; 197 my $tun = "tap" . $count; 198 199 &setup_bridging($tun, $bridge, $iface, $addr); 198 200 print "Remote connection all set up!\n"; # Trigger other end with output 199 201 } else {
Note: See TracChangeset
for help on using the changeset viewer.