|
Revision dc803a7e0d75d04bb0a1aec1f88bac4810b722a6, 1.1 KB
(checked in by Ted Faber <faber@…>, 2 years ago)
|
|
Set up all routing daemons from the fedkit and note interfaces we've added in a way that SEER's federated testbed will grok them.
|
-
Property mode set to
100644
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use IO::File; |
|---|
| 5 | use IO::Pipe; |
|---|
| 6 | |
|---|
| 7 | my $IFCONFIG = "/sbin/ifconfig"; |
|---|
| 8 | my @GATEDS= ("/usr/sbin/gated", "/sbin/gated" ); |
|---|
| 9 | my $GATED; |
|---|
| 10 | |
|---|
| 11 | my $fn = "/usr/local/federation/etc/gated.conf"; |
|---|
| 12 | my @live_ones; |
|---|
| 13 | |
|---|
| 14 | chomp (my $cif = `/usr/local/etc/emulab/control_interface`); |
|---|
| 15 | |
|---|
| 16 | my $ifp = new IO::Pipe(); |
|---|
| 17 | $ifp->reader("$IFCONFIG"); |
|---|
| 18 | while (<$ifp>) { |
|---|
| 19 | /^(eth\d+)/ && do { |
|---|
| 20 | push(@live_ones, $1) unless $1 eq $cif; |
|---|
| 21 | }; |
|---|
| 22 | } |
|---|
| 23 | $ifp->close(); |
|---|
| 24 | |
|---|
| 25 | foreach my $g (@GATEDS) { |
|---|
| 26 | if (-x $g ) { |
|---|
| 27 | $GATED = $g; |
|---|
| 28 | last; |
|---|
| 29 | } |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | die "Can't find gated in " . join(",", @GATEDS) . "\n" unless $GATED; |
|---|
| 33 | |
|---|
| 34 | my $f = new IO::File(">$fn") || die "Can't open $fn: $!\n"; |
|---|
| 35 | print $f <<END; |
|---|
| 36 | smux off; |
|---|
| 37 | rip off; |
|---|
| 38 | ospf on { |
|---|
| 39 | backbone { |
|---|
| 40 | END |
|---|
| 41 | print $f "\tinterface $cif { passive; };\n"; |
|---|
| 42 | print $f <<END; |
|---|
| 43 | }; |
|---|
| 44 | area 0.0.0.2 { |
|---|
| 45 | authtype none; |
|---|
| 46 | END |
|---|
| 47 | foreach my $i (@live_ones) { |
|---|
| 48 | print $f "\tinterface $i { priority 1; };\n"; |
|---|
| 49 | } |
|---|
| 50 | print $f <<END; |
|---|
| 51 | }; |
|---|
| 52 | }; |
|---|
| 53 | END |
|---|
| 54 | $f->close(); |
|---|
| 55 | |
|---|
| 56 | $f = new IO::File(">/proc/sys/net/ipv4/ip_forward") || |
|---|
| 57 | die "Can't open sys forwarding file:$!\n"; |
|---|
| 58 | print $f "1\n"; |
|---|
| 59 | $f->close(); |
|---|
| 60 | system("$GATED -f $fn"); |
|---|
| 61 | |
|---|