From: Gokul Sivakumar <gokulkumar792@gmail.com>
To: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>
Cc: Gokul Sivakumar <gokulkumar792@gmail.com>
Subject: [PATCH iproute2-next 2/3] bridge: fdb: don't colorize the "dev" & "dst" keywords in "bridge -c fdb"
Date: Sat, 14 Aug 2021 15:24:38 +0530 [thread overview]
Message-ID: <20210814095439.1736737-3-gokulkumar792@gmail.com> (raw)
In-Reply-To: <20210814095439.1736737-1-gokulkumar792@gmail.com>
To be consistent with the colorized output of "ip" command and to increase
readability, stop highlighting the "dev" & "dst" keywords in the colorized
output of "bridge -c fdb" cmd.
Example: in the following "bridge -c fdb" entry, only "00:00:00:00:00:00",
"vxlan100" and "2001:db8:2::1" fields should be highlighted in color.
00:00:00:00:00:00 dev vxlan100 dst 2001:db8:2::1 self permanent
Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
---
bridge/fdb.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/bridge/fdb.c b/bridge/fdb.c
index 37465e46..21433dac 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -192,10 +192,14 @@ int print_fdb(struct nlmsghdr *n, void *arg)
"mac", "%s ", lladdr);
}
- if (!filter_index && r->ndm_ifindex)
+ if (!filter_index && r->ndm_ifindex) {
+ if (!is_json_context())
+ fprintf(fp, "dev ");
+
print_color_string(PRINT_ANY, COLOR_IFNAME,
- "ifname", "dev %s ",
+ "ifname", "%s ",
ll_index_to_name(r->ndm_ifindex));
+ }
if (tb[NDA_DST]) {
int family = AF_INET;
@@ -208,9 +212,12 @@ int print_fdb(struct nlmsghdr *n, void *arg)
RTA_PAYLOAD(tb[NDA_DST]),
RTA_DATA(tb[NDA_DST]));
+ if (!is_json_context())
+ fprintf(fp, "dst ");
+
print_color_string(PRINT_ANY,
ifa_family_color(family),
- "dst", "dst %s ", dst);
+ "dst", "%s ", dst);
}
if (vid)
--
2.25.1
next prev parent reply other threads:[~2021-08-14 9:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-14 9:54 [PATCH iproute2-next 0/3] bridge: fixes regarding the colorized output Gokul Sivakumar
2021-08-14 9:54 ` [PATCH iproute2-next 1/3] bridge: reorder cmd line arg parsing to let "-c" detected as "color" option Gokul Sivakumar
2021-08-14 9:54 ` Gokul Sivakumar [this message]
2021-08-14 16:22 ` [PATCH iproute2-next 2/3] bridge: fdb: don't colorize the "dev" & "dst" keywords in "bridge -c fdb" Stephen Hemminger
2021-08-14 18:46 ` Gokul Sivakumar
2021-08-14 9:54 ` [PATCH iproute2-next 3/3] man: bridge: fix the typo to change "-c[lor]" into "-c[olor]" in man page Gokul Sivakumar
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=20210814095439.1736737-3-gokulkumar792@gmail.com \
--to=gokulkumar792@gmail.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
/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).