ipv4: output metric as unsigned int
Subsystems (3)
PATCH 1/1 ipv4: output metric as unsigned int
adding a route metric greater than 0x7fff_ffff leads to an unintended wrap when printing the underlying u32 as an unsigned int (%d) thus incorrectly rendering the metric as negative. Formatting using %u corrects the issue.
--- net/ipv4/fib_trie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/fib_trie.c +2 -2
@@ -2999,7 +2999,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "%s\t%08X\t%08X\t%04X\t%d\t%u\t" - "%d\t%08X\t%d\t%u\t%u", + "%u\t%08X\t%d\t%u\t%u", nhc->nhc_dev ? nhc->nhc_dev->name : "*", prefix, gw, flags, 0, 0, fi->fib_priority,
@@ -3011,7 +3011,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v) }else {seq_printf (seq,"*\t%08X\t%08X\t%04X\t%d\t%u\t" -"%d\t%08X\t%d\t%u\t%u" , +"%u\t%08X\t%d\t%u\t%u" , prefix,0 , flags,0 ,0 ,0 , mask,0 ,0 ,0 ); }
Signature · 1 line
2.47.0
Quoted 6 lines · Maximilian Güntner
adding a route metric greater than 0x7fff_ffff leads to an unintended wrap when printing the underlying u32 as an unsigned int (
%d) thus incorrectly rendering the metric as negative. Formatting using%ucorrects the issue.Signed-off-by Maximilian Güntner <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 12 Dec 2024 17:19:11 +0100 you wrote:
adding a route metric greater than 0x7fff_ffff leads to an unintended wrap when printing the underlying u32 as an unsigned int (
%d) thus incorrectly rendering the metric as negative. Formatting using%ucorrects the issue.Signed-off-by Maximilian Güntner <[email protected]>[...]
Here is the summary with links:
- ipv4: output metric as unsigned int
https://git.kernel.org/netdev/net-next/c/329365dc46b8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html