2 # for best results, bring up all your interfaces before running this
6 &irix_mkfilters
|| regular_mkfilters
|| die $!;
10 ®ular_mkfilters
|| irix_mkfilters
|| die $!;
13 foreach $i (keys %ifaces) {
14 $net{$i} = $inet{$i}."/".$netmask{$i} if (defined($inet{$i}));
17 # print out route suggestions
20 print "# The following routes should be configured, if not already:\n";
22 foreach $i (keys %ifaces) {
23 next if (($i =~ /lo/) || !defined($net{$i}) || defined($ppp{$i}));
24 print "# route add $inet{$i} localhost 0\n";
29 # print out some generic filters which people should use somewhere near the top
31 print "block in log quick from any to any with ipopts\n";
32 print "block in log quick proto tcp from any to any with short\n";
36 foreach $i (keys %ifaces) {
37 if (!defined($inet{$i})) {
45 print "pass out on $i all head $grpo\n";
46 print "block out from 127.0.0.0/8 to any group $grpo\n";
47 print "block out from any to 127.0.0.0/8 group $grpo\n";
48 print "block out from any to $inet{$i}/32 group $grpo\n";
49 print "pass in on $i all head $grpi\n";
50 print "block in from 127.0.0.0/8 to any group $grpi\n";
51 print "block in from $inet{$i}/32 to any group $grpi\n";
52 foreach $j (keys %ifaces) {
53 if ($i ne $j && $j !~ /^lo/ && defined($net{$j})) {
54 print "block in from $net{$j} to any group $grpi\n";
62 open(NETSTAT
, "/usr/etc/netstat -i|") || return 0;
64 while (defined($line = <NETSTAT
>))
66 if ($line =~ m/^Name/)
70 elsif ($line =~ m/^(\S+)/)
72 open(I
, "/usr/etc/ifconfig $1|") || return 0;
74 close I
; # being neat... - Allen
77 close NETSTAT
; # again, being neat... - Allen
83 open(I
, "ifconfig -a|") || return 0;
85 close I
; # being neat... - Allen
93 if (/^[a-zA-Z]+\d+:/) {
94 ($iface = $_) =~ s/^([a-zA-Z]+\d+).*/$1/;
95 $ifaces{$iface} = $iface;
99 if (/\-\-\>/) { # PPP, (SLIP?)
100 ($inet{$iface} = $_) =~ s/.*inet ([^ ]+) \-\-\> ([^ ]+).*/$1/;
101 ($ppp{$iface} = $_) =~ s/.*inet ([^ ]+) \-\-\> ([^ ]+).*/$2/;
103 ($inet{$iface} = $_) =~ s/.*inet ([^ ]+).*/$1/;
107 ($mask = $_) =~ s/.*netmask ([^ ]+).*/$1/;
108 $mask =~ s/^/0x/ if ($mask =~ /^[0-9a-f]*$/);
109 $netmask{$iface} = $mask;
112 ($bcast{$iface} = $_) =~ s/.*broadcast ([^ ]+).*/$1/;