mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-03 16:35:47 +02: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( $ ) {
|
sub in_hex3( $ ) {
|
||||||
sprintf '0x%03x', $_[0];
|
sprintf '%03x', $_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub in_hex4( $ ) {
|
sub in_hex4( $ ) {
|
||||||
|
@ -983,6 +983,7 @@ sub validate_tc_device( ) {
|
|||||||
mtu => $mtu,
|
mtu => $mtu,
|
||||||
mpu => $mpu,
|
mpu => $mpu,
|
||||||
tsize => $tsize,
|
tsize => $tsize,
|
||||||
|
filterpri => 1,
|
||||||
} ,
|
} ,
|
||||||
|
|
||||||
push @tcdevices, $device;
|
push @tcdevices, $device;
|
||||||
@ -1408,9 +1409,7 @@ sub process_tc_filter() {
|
|||||||
|
|
||||||
fatal_error "Invalid INTERFACE:CLASS ($devclass)" if defined $rest || ! ($device && $class );
|
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 );
|
my ( $ip, $ip32, $lo ) = $family == F_IPV4 ? ('ip', 'ip', 2 ) : ('ipv6', 'ip6', 4 );
|
||||||
|
|
||||||
$prio = validate_filter_priority( $priority, 'filter' ) unless $priority eq '-';
|
|
||||||
|
|
||||||
my $devref;
|
my $devref;
|
||||||
|
|
||||||
@ -1420,6 +1419,18 @@ sub process_tc_filter() {
|
|||||||
( $device , $devref ) = dev_by_number( $device );
|
( $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 $devnum = in_hexp $devref->{number};
|
||||||
|
|
||||||
my $tcref = $tcclasses{$device};
|
my $tcref = $tcclasses{$device};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user