lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 26 Dec 2019 15:44:15 +0100
From:   Julien Fortin <julien@...ulusnetworks.com>
To:     netdev@...r.kernel.org
Cc:     roopa@...ulusnetworks.com, dsahern@...il.com,
        Julien Fortin <julien@...ulusnetworks.com>
Subject: [PATCH iproute2-next] ip: ipneigh: json: print ndm_flags as boolean attributes

From: Julien Fortin <julien@...ulusnetworks.com>

Today the following attributes are printed as json "null" attributes
NTF_ROUTER
NTF_PROXY
NTF_EXT_LEARNED
NTF_OFFLOADED

$ ip -j neigh show
[
  {
    "dst": "10.0.2.2",
    "dev": "enp0s3",
    "lladdr": "52:54:00:12:35:02",
    "router": null,
    "proxy": null,
    "extern_learn": null,
    "offload": null,
    "state": [
      "REACHABLE"
    ]
  }
]

The goal of this patch is to replace those null attributes with booleans

$ ip -j neigh show
[
  {
    "dst": "10.0.2.2",
    "dev": "enp0s3",
    "lladdr": "52:54:00:12:35:02",
    "router": true,
    "proxy": true,
    "extern_learn": true,
    "offload": true,
    "state": [
      "REACHABLE"
    ]
  }
]

Signed-off-by: Julien Fortin <julien@...ulusnetworks.com>
---
 ip/ipneigh.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index 678b4034..b1f212f4 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -380,16 +380,16 @@ int print_neigh(struct nlmsghdr *n, void *arg)
 	}
 
 	if (r->ndm_flags & NTF_ROUTER)
-		print_null(PRINT_ANY, "router", " %s", "router");
+		print_bool(PRINT_ANY, "router", " router", true);
 
 	if (r->ndm_flags & NTF_PROXY)
-		print_null(PRINT_ANY, "proxy", " %s", "proxy");
+		print_bool(PRINT_ANY, "proxy", " proxy", true);
 
 	if (r->ndm_flags & NTF_EXT_LEARNED)
-		print_null(PRINT_ANY, "extern_learn", " %s ", "extern_learn");
+		print_bool(PRINT_ANY, "extern_learn", " extern_learn ", true);
 
 	if (r->ndm_flags & NTF_OFFLOADED)
-		print_null(PRINT_ANY, "offload", " %s", "offload");
+		print_bool(PRINT_ANY, "offload", " offload", true);
 
 	if (show_stats) {
 		if (tb[NDA_CACHEINFO])
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ