From e0f85edab3aca5374b9ed9ed71a4725e12ce8643 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 13 Sep 2012 09:30:11 -0700 Subject: [PATCH] Assign sequential priorities to filters - Also remove a redundant 0x prefix from a table number. Signed-off-by: Tom Eastep $mtu, mpu => $mpu, tsize => $tsize, + filterpri => 1, } , push @tcdevices, $device; @@ -1408,9 +1409,7 @@ sub process_tc_filter() { fatal_error "Invalid INTERFACE:CLASS ($devclass)" if defined $rest || ! ($device && $class ); - my ( $ip, $ip32, $prio , $lo ) = $family == F_IPV4 ? ('ip', 'ip', 10, 2 ) : ('ipv6', 'ip6', 11 , 4 ); - - $prio = validate_filter_priority( $priority, 'filter' ) unless $priority eq '-'; + my ( $ip, $ip32, $lo ) = $family == F_IPV4 ? ('ip', 'ip', 2 ) : ('ipv6', 'ip6', 4 ); my $devref; @@ -1420,6 +1419,18 @@ sub process_tc_filter() { ( $device , $devref ) = dev_by_number( $device ); } + my ( $prio, $filterpri ) = ( undef, $devref->{filterpri} ); + + if ( $priority eq '-' ) { + $prio = $filterpri++; + fatal_error "Filter priority overflow" if $prio > 65535; + } else { + $prio = validate_filter_priority( $priority, 'filter' ); + $filterpri = $prio + 1 if $prio >= $filterpri; + } + + $devref->{filterpri} = $filterpri; + my $devnum = in_hexp $devref->{number}; my $tcref = $tcclasses{$device};