source: fedkit/ospf_routing.pl @ c6d6c43

axis_examplecompt_changesinfo-ops
Last change on this file since c6d6c43 was dc803a7, checked in by Ted Faber <faber@…>, 14 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
File size: 1.1 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use IO::File;
5use IO::Pipe;
6
7my $IFCONFIG = "/sbin/ifconfig";
8my $OSPFD= "/usr/local/sbin/ospfd";
9my $SYSCTL= "/sbin/sysctl";
10my $PKG_ADD="/usr/sbin/pkg_add";
11
12my $fn = "/usr/local/federation/etc/ospfd.conf";
13my @pkgs = ('/usr/local/federation/pkg/libevent-1.3b.tbz', 
14    '/usr/local/federation/pkg/openospfd-4.0.tbz');
15my @live_ones;
16
17for my $p (@pkgs) {
18    die "No such package $p\n" unless -r $p;
19}
20
21system("$PKG_ADD " . join(" ", @pkgs));
22
23chomp (my $cif = `/usr/local/etc/emulab/control_interface`);
24
25my $ifp = new IO::Pipe();
26$ifp->reader("$IFCONFIG");
27while (<$ifp>) {
28    /^(\S+):.*UP/ && do {
29        push(@live_ones, $1) unless $1 eq $cif || $1 eq "lo0";
30    };
31}
32$ifp->close();
33
34my $f = new IO::File(">$fn") || die "Can't open $fn: $!\n";
35print $f <<END;
36area 0.0.0.1 {
37    interface $cif {
38        passive
39    }
40}
41END
42print $f <<END;
43area 0.0.0.2 {
44    auth-type none
45END
46foreach my $i (@live_ones) {
47    print $f "\tinterface $i {\n\t}\n";
48}
49print $f "}\n";
50$f->close();
51system("chmod 600 $fn");
52system("$SYSCTL -w net.inet.ip.forwarding=1");
53system("$OSPFD -f $fn");
54
Note: See TracBrowser for help on using the repository browser.