mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-19 12:50:57 +01:00
Assign sequential priorities to filters
- Also remove a redundant 0x prefix from a table number. Signed-off-by: Tom Eastep <teastep@shorewall.net
This commit is contained in:
parent
14073e8943
commit
e0f85edab3
@ -1239,7 +1239,7 @@ sub in_hex2( $ ) {
|
||||
}
|
||||
|
||||
sub in_hex3( $ ) {
|
||||
sprintf '0x%03x', $_[0];
|
||||
sprintf '%03x', $_[0];
|
||||
}
|
||||
|
||||
sub in_hex4( $ ) {
|
||||
|
@ -983,6 +983,7 @@ sub validate_tc_device( ) {
|
||||
mtu => $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};
|
||||
|
Loading…
Reference in New Issue
Block a user