netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <ehakim@nvidia.com>
To: <sd@queasysnail.net>
Cc: <dsahern@kernel.org>, <netdev@vger.kernel.org>,
	Emeel Hakim <ehakim@nvidia.com>
Subject: [PATCH iproute2 1/1] macsec: Fix Macsec packet number attribute print
Date: Thu, 19 Jan 2023 13:53:02 +0200	[thread overview]
Message-ID: <20230119115302.28067-1-ehakim@nvidia.com> (raw)

From: Emeel Hakim <ehakim@nvidia.com>

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")
Signed-off-by: Emeel Hakim <ehakim@nvidia.com>
---
 ip/ipmacsec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c
index 8da7c3d3..8b0d5666 100644
--- a/ip/ipmacsec.c
+++ b/ip/ipmacsec.c
@@ -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])));
-- 
2.21.3


             reply	other threads:[~2023-01-19 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 11:53 ehakim [this message]
2023-01-20 10:48 ` [PATCH iproute2 1/1] macsec: Fix Macsec packet number attribute print Simon Horman
2023-01-25 18:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230119115302.28067-1-ehakim@nvidia.com \
    --to=ehakim@nvidia.com \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sd@queasysnail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).