Skip to contentSkip to conversation

macsec: Fix Macsec packet number attribute print

PATCH Applied [email protected] 3 participants 3 messages Jan 19, 2023 – Jan 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macsec: Fix Macsec packet number attribute print

From: Emeel Hakim <[email protected]>

Currently Macsec print routines uses a 32 bit print routine to print out the value of the packet number (PN) attribute, a miss use of the 32 bit print routine is causing a miss print of only the 32 least significant bit (LSB) of an extended packet number (XPN) which is a 64 bit attribute.

Fixes 6ce23b7c2d79 ("macsec: add Extended Packet Number support")
---
 ip/ipmacsec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
ip/ipmacsec.c +4 -4
index 8da7c3d3..8b0d5666 100644
@@ -938,8 +938,8 @@ static void print_tx_sc(const char *prefix, __u64 sci, __u8 encoding_sa,
 		print_uint(PRINT_ANY, "an", "%d:",
 			   rta_getattr_u8(sa_attr[MACSEC_SA_ATTR_AN]));
 		if (is_xpn) {
-			print_uint(PRINT_ANY, "pn", " PN %u,",
-				   rta_getattr_u64(sa_attr[MACSEC_SA_ATTR_PN]));
+			print_lluint(PRINT_ANY, "pn", " PN %llu,",
+				     rta_getattr_u64(sa_attr[MACSEC_SA_ATTR_PN]));
 			print_0xhex(PRINT_ANY, "ssci",
 				    "SSCI %08x",
 				    ntohl(rta_getattr_u32(sa_attr[MACSEC_SA_ATTR_SSCI])));
@@ -1015,8 +1015,8 @@ static void print_rx_sc(const char *prefix, __be64 sci, __u8 active,
 		print_uint(PRINT_ANY, "an", "%u:",
 			   rta_getattr_u8(sa_attr[MACSEC_SA_ATTR_AN]));
 		if (is_xpn) {
-			print_uint(PRINT_ANY, "pn", " PN %u,",
-				   rta_getattr_u64(sa_attr[MACSEC_SA_ATTR_PN]));
+			print_lluint(PRINT_ANY, "pn", " PN %llu,",
+				     rta_getattr_u64(sa_attr[MACSEC_SA_ATTR_PN]));
 			print_0xhex(PRINT_ANY, "ssci",
 				    "SSCI %08x",
 				    ntohl(rta_getattr_u32(sa_attr[MACSEC_SA_ATTR_SSCI])));
Signature · 1 line
2.21.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Thu, Jan 19, 2023 at 01:53:02PM +0200, [email protected] wrote:

From: Emeel Hakim <[email protected]>

Currently Macsec print routines uses a 32 bit print routine to print out the value of the packet number (PN) attribute, a miss use of the 32 bit print routine is causing a miss print of only the 32 least significant bit (LSB) of an extended packet number (XPN) which is a 64 bit attribute.

Fixes 6ce23b7c2d79 ("macsec: add Extended Packet Number support")
#2 lore raw
In reply to [email protected]
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 9 lines · On Thu, 19 Jan 2023 13:53:02 +0200 you wrote:

From: Emeel Hakim <[email protected]>

Currently Macsec print routines uses a 32 bit print routine to print out the value of the packet number (PN) attribute, a miss use of the 32 bit print routine is causing a miss print of only the 32 least significant bit (LSB) of an extended packet number (XPN) which is a 64 bit attribute.

[...]

Here is the summary with links:
- [iproute2,1/1] macsec: Fix Macsec packet number attribute print

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=55738f8ee1eb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html