]> git.sesse.net Git - nms/commitdiff
Varius MBD tweaks for TG07.
authorroot <root@sysrq>
Tue, 3 Apr 2007 14:28:25 +0000 (16:28 +0200)
committerroot <root@sysrq>
Tue, 3 Apr 2007 14:28:25 +0000 (16:28 +0200)
make-all-config.sh
mbd/access_list.pl
mbd/mbd.pl
mbd/nets.pl [deleted file]

index c186b2874f7c3d6af0396c1be467388e95dc2978..10d3180e12c28a6dc3ab3ad049911bc25313ad36 100755 (executable)
@@ -8,3 +8,6 @@ cat static-switches.txt >> switches.txt
 (cd mbd && ./generate-helper-list.pl > ../mbd-ports)
 ./config/make-port-config.pl
 scp mbd-ports *-config sesse@f1:/tftpboot/portcfg/
+
+# regenerate the mbd netlist
+(echo '# Autogenerated. Do not touch!' ; echo "package Config;"; echo 'our @networks = (' ; cut -d" " -f1-2 switches.txt | perl -e 'while (<>) { chomp; my ($net,$mask) = split / /; print "\t\"$net/$mask\",\n"; }' ; echo ');' ; echo '1;')  > mbd/nets.pl 
index 2d2dfce44550639ec7af76e50ebdce60936af918..137f173e05445b40f5b5842c4813a0c68d3d7cd7 100644 (file)
@@ -62,7 +62,8 @@ our @access_list = (
        # warcraft 3 - untested (packet dump only)
        {
                ports => [ "6112..6119" ],
-               sizes => [ 16, 48 ]
+               sizes => [ 16, 48 ],
+               filter => sub { return (ord(substr(shift, 1, 1)) == 0x2f); }
        },
 
        # ut2003/ut2004 - untested (packet dump only)
index e5c2879e01b9310fe1b73becae6e1bd9743692f1..cbb1237c9d6d49c379c701d6a84db7a6b929f0ba 100644 (file)
@@ -51,10 +51,15 @@ while (1) {
                # Check against the ACL.
                my $pass = 0;
                for my $rule (@Config::access_list) {
-                       if (mbd::match_ranges($dport, $rule->{'ports'}) &&
-                           mbd::match_ranges($size, $rule->{'sizes'})) {
-                               $pass = 1;
+                       next unless (mbd::match_ranges($dport, $rule->{'ports'}));
+                       next unless (mbd::match_ranges($size, $rule->{'sizes'}));
+
+                       if ($rule->{'filter'}) {
+                               next unless ($rule->{'filter'}($data));
                        }
+
+                       $pass = 1;
+                       last;
                }
 
                if (!$pass) {
diff --git a/mbd/nets.pl b/mbd/nets.pl
deleted file mode 100644 (file)
index 55bec01..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-
-package Config;
-
-our @networks = (
-       "10.0.10.0/24",
-       "10.0.11.0/24"
-);
-
-1;