Skip to content

Commit

Permalink
Use MAX associated constant instead of from std::<integer type>
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jul 18, 2024
1 parent 80aeff7 commit ddfeed2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nftnl/examples/filter-ethernet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn main() -> io::Result<()> {
// Load a pseudo-random 32 bit unsigned integer into the netfilter register.
random_rule.add_expr(&nft_expr!(meta random));
// Check if the random integer is larger than `u32::MAX/2`, thus having 50% chance of success.
random_rule.add_expr(&nft_expr!(cmp > (::std::u32::MAX / 2).to_be()));
random_rule.add_expr(&nft_expr!(cmp > (u32::MAX / 2).to_be()));

// Add a second counter. This will only be incremented for the packets passing the random check.
random_rule.add_expr(&nft_expr!(counter));
Expand Down

0 comments on commit ddfeed2

Please sign in to comment.