undo.1: Add some words about the new fake transaction id warning.
[dragonfly.git] / usr.sbin / route6d / misc / chkrt
blob656ec43d1a8ec119745a48a49bdb1dccc9d67e46
1 #!/usr/pkg/bin/perl
3 # $FreeBSD: src/usr.sbin/route6d/misc/chkrt,v 1.1 1999/12/28 02:37:10 shin Exp $
4 # $DragonFly: src/usr.sbin/route6d/misc/chkrt,v 1.2 2003/06/17 04:30:02 dillon Exp $
6 $dump="/var/tmp/route6d_dump";
7 $pidfile="/var/run/route6d.pid";
9 system("rm -f $dump");
11 open(FD, "< $pidfile") || die "Can not open $pidfile";
12 $_ = <FD>;
13 chop;
14 close(FD);
15 system("kill -INT $_");
17 open(NS, "/usr/local/v6/bin/netstat -r -n|") || die "Can not open netstat";
18 while (<NS>) {
19 chop;
20 next unless (/^3f/ || /^5f/);
21 @f = split(/\s+/);
22 $gw{$f[0]} = $f[1];
23 $int{$f[0]} = $f[3];
25 close(NS);
27 $err=0;
28 sleep(2);
29 open(FD, "< $dump") || die "Can not open $dump";
30 while (<FD>) {
31 chop;
32 next unless (/^ 3f/ || /^ 5f/);
33 @f = split(/\s+/);
34 $dst = $f[1];
35 $f[2] =~ /if\(\d:([a-z0-9]+)\)/;
36 $intf = $1;
37 $f[3] =~ /gw\(([a-z0-9:]+)\)/;
38 $gateway = $1;
39 $f[4] =~ /\[(\d+)\]/;
40 $metric = $1;
41 $f[5] =~ /age\((\d+)\)/;
42 $age = $1;
43 unless (defined($gw{$dst})) {
44 print "NOT FOUND: $dst $intf $gateway $metric $age\n";
45 $err++;
46 next;
48 if ($gw{$dst} ne $gateway && $gw{$dst} !~ /link#\d+/) {
49 print "WRONG GW: $dst $intf $gateway $metric $age\n";
50 print "kernel gw: $gw{$dst}\n";
51 $err++;
52 next;
54 if ($int{$dst} ne $intf) {
55 print "WRONG IF: $dst $intf $gateway $metric $age\n";
56 print "kernel if: $int{$dst}\n";
57 $err++;
58 next;
61 close(FD);
63 if ($err == 0) {
64 print "No error found\n";