From 6233296917572e7ceaff68ce44035e1ba5c78f58 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 13 May 2011 07:15:18 -0700 Subject: [PATCH] Don't allow non-leaf default class Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Tc.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Tc.pm b/Shorewall/Perl/Shorewall/Tc.pm index 70c30c86c..f2dfb7aa4 100644 --- a/Shorewall/Perl/Shorewall/Tc.pm +++ b/Shorewall/Perl/Shorewall/Tc.pm @@ -840,9 +840,11 @@ sub validate_tc_class( ) { # Nested Class # $parentref = $tcref->{$parentclass}; - fatal_error "Unknown Parent class ($parentclass)" unless $parentref && $parentref->{occurs} == 1; - fatal_error "The class ($parentclass) specifies UMAX and/or DMAX; it cannot serve as a parent" if $parentref->{dmax}; - fatal_error "The class ($parentclass) specifies flow; it cannot serve as a parent" if $parentref->{flow}; + my $parentnum = in_hexp $parentclass; + fatal_error "Unknown Parent class ($parentnum)" unless $parentref && $parentref->{occurs} == 1; + fatal_error "The class ($parentnum) specifies UMAX and/or DMAX; it cannot serve as a parent" if $parentref->{dmax}; + fatal_error "The class ($parentnum) specifies flow; it cannot serve as a parent" if $parentref->{flow}; + fatal_error "The default class ($parentnum) may not have sub-classes" if $devref->{default} == $parentclass; $parentref->{leaf} = 0; $ratemax = $parentref->{rate}; $ratename = q(the parent class's RATE);