axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change
on this file since 0b799e0 was
d101c8c,
checked in by Ted Faber <faber@…>, 15 years ago
|
import
|
-
Property mode set to
100644
|
File size:
923 bytes
|
Rev | Line | |
---|
[d101c8c] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use IO::File; |
---|
| 5 | use IO::Pipe; |
---|
| 6 | |
---|
| 7 | my $IFCONFIG = "/sbin/ifconfig"; |
---|
| 8 | my $GATED= "/usr/sbin/gated"; |
---|
| 9 | |
---|
| 10 | my $fn = "/usr/local/federation/etc/gated.conf"; |
---|
| 11 | my @live_ones; |
---|
| 12 | |
---|
| 13 | chomp (my $cif = `/usr/local/etc/emulab/control_interface`); |
---|
| 14 | |
---|
| 15 | my $ifp = new IO::Pipe(); |
---|
| 16 | $ifp->reader("$IFCONFIG"); |
---|
| 17 | while (<$ifp>) { |
---|
| 18 | /^(eth\d+)/ && do { |
---|
| 19 | push(@live_ones, $1) unless $1 eq $cif; |
---|
| 20 | }; |
---|
| 21 | } |
---|
| 22 | $ifp->close(); |
---|
| 23 | |
---|
| 24 | my $f = new IO::File(">$fn") || die "Can't open $fn: $!\n"; |
---|
| 25 | print $f <<END; |
---|
| 26 | smux off; |
---|
| 27 | rip off; |
---|
| 28 | ospf on { |
---|
| 29 | backbone { |
---|
| 30 | END |
---|
| 31 | print $f "\tinterface $cif { passive; };\n"; |
---|
| 32 | print $f <<END; |
---|
| 33 | }; |
---|
| 34 | area 0.0.0.2 { |
---|
| 35 | authtype none; |
---|
| 36 | END |
---|
| 37 | foreach my $i (@live_ones) { |
---|
| 38 | print $f "\tinterface $i { priority 1; };\n"; |
---|
| 39 | } |
---|
| 40 | print $f <<END; |
---|
| 41 | }; |
---|
| 42 | }; |
---|
| 43 | END |
---|
| 44 | $f->close(); |
---|
| 45 | |
---|
| 46 | $f = new IO::File(">/proc/sys/net/ipv4/ip_forward") || |
---|
| 47 | die "Can't open sys forwarding file:$!\n"; |
---|
| 48 | print $f "1\n"; |
---|
| 49 | $f->close(); |
---|
| 50 | system("$GATED -f $fn"); |
---|
| 51 | |
---|
Note: See
TracBrowser
for help on using the repository browser.