From f35078d3cda54f3cbdaab03d7def66bcfbb560dd Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Apr 2007 16:28:25 +0200 Subject: [PATCH] Varius MBD tweaks for TG07. --- make-all-config.sh | 3 +++ mbd/access_list.pl | 3 ++- mbd/mbd.pl | 11 ++++++++--- mbd/nets.pl | 9 --------- 4 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 mbd/nets.pl diff --git a/make-all-config.sh b/make-all-config.sh index c186b28..10d3180 100755 --- a/make-all-config.sh +++ b/make-all-config.sh @@ -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 diff --git a/mbd/access_list.pl b/mbd/access_list.pl index 2d2dfce..137f173 100644 --- a/mbd/access_list.pl +++ b/mbd/access_list.pl @@ -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) diff --git a/mbd/mbd.pl b/mbd/mbd.pl index e5c2879..cbb1237 100644 --- a/mbd/mbd.pl +++ b/mbd/mbd.pl @@ -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 index 55bec01..0000000 --- a/mbd/nets.pl +++ /dev/null @@ -1,9 +0,0 @@ - -package Config; - -our @networks = ( - "10.0.10.0/24", - "10.0.11.0/24" -); - -1; -- 2.39.2