naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0021-json-make-0xhex-handle-u64.patch

7e752c
From 9822fef7a13eaec70be8e86c23bdb71569835bd0 Mon Sep 17 00:00:00 2001
7e752c
From: Phil Sutter <psutter@redhat.com>
7e752c
Date: Thu, 18 Oct 2018 12:49:51 +0200
7e752c
Subject: [PATCH] json: make 0xhex handle u64
7e752c
7e752c
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1628428
7e752c
Upstream Status: iproute2.git commit 45ec4771d40cb
7e752c
7e752c
commit 45ec4771d40cb367377e4148a2af22f25c20f3bf
7e752c
Author: Sabrina Dubroca <sd@queasysnail.net>
7e752c
Date:   Fri Oct 12 17:34:32 2018 +0200
7e752c
7e752c
    json: make 0xhex handle u64
7e752c
7e752c
    Stephen converted macsec's sci to use 0xhex, but 0xhex handles
7e752c
    unsigned int's, not 64 bits ints. Thus, the output of the "ip macsec
7e752c
    show" command is mangled, with half of the SCI replaced with 0s:
7e752c
7e752c
    # ip macsec show
7e752c
    11: macsec0: [...]
7e752c
        cipher suite: GCM-AES-128, using ICV length 16
7e752c
        TXSC: 0000000001560001 on SA 0
7e752c
7e752c
    # ip -d link show macsec0
7e752c
    11: macsec0@ens3: [...]
7e752c
        link/ether 52:54:00:12:01:56 brd ff:ff:ff:ff:ff:ff promiscuity 0
7e752c
        macsec sci 5254001201560001 [...]
7e752c
7e752c
    where TXSC and sci should match.
7e752c
7e752c
    Fixes: c0b904de6211 ("macsec: support JSON")
7e752c
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7e752c
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7e752c
---
7e752c
 include/json_print.h | 2 +-
7e752c
 lib/json_print.c     | 4 ++--
7e752c
 2 files changed, 3 insertions(+), 3 deletions(-)
7e752c
7e752c
diff --git a/include/json_print.h b/include/json_print.h
7e752c
index 78a6c83..218da31 100644
7e752c
--- a/include/json_print.h
7e752c
+++ b/include/json_print.h
7e752c
@@ -66,7 +66,7 @@ _PRINT_FUNC(uint, unsigned int);
7e752c
 _PRINT_FUNC(u64, uint64_t);
7e752c
 _PRINT_FUNC(hu, unsigned short);
7e752c
 _PRINT_FUNC(hex, unsigned int);
7e752c
-_PRINT_FUNC(0xhex, unsigned int);
7e752c
+_PRINT_FUNC(0xhex, unsigned long long int);
7e752c
 _PRINT_FUNC(luint, unsigned long int);
7e752c
 _PRINT_FUNC(lluint, unsigned long long int);
7e752c
 _PRINT_FUNC(float, double);
7e752c
diff --git a/lib/json_print.c b/lib/json_print.c
7e752c
index 09e51d0..cf13e9b 100644
7e752c
--- a/lib/json_print.c
7e752c
+++ b/lib/json_print.c
7e752c
@@ -171,12 +171,12 @@ void print_color_0xhex(enum output_type type,
7e752c
 		       enum color_attr color,
7e752c
 		       const char *key,
7e752c
 		       const char *fmt,
7e752c
-		       unsigned int hex)
7e752c
+		       unsigned long long hex)
7e752c
 {
7e752c
 	if (_IS_JSON_CONTEXT(type)) {
7e752c
 		SPRINT_BUF(b1);
7e752c
 
7e752c
-		snprintf(b1, sizeof(b1), "%#x", hex);
7e752c
+		snprintf(b1, sizeof(b1), "%#llx", hex);
7e752c
 		print_string(PRINT_JSON, key, NULL, b1);
7e752c
 	} else if (_IS_FP_CONTEXT(type)) {
7e752c
 		color_fprintf(stdout, color, fmt, hex);
7e752c
-- 
7e752c
1.8.3.1
7e752c