* [PATCH v2] iproute2: Fix -o (oneline) being broken in xfrm & correct mark radix
@ 2015-03-19 19:54 Philip Prindeville
2015-03-24 22:02 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Philip Prindeville @ 2015-03-19 19:54 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Alexy Kuznetsov
Don't insert newline in -o (oneline) mode; print mark as hex.
Oneline mode is supposed to force all output to be on oneline and
machine-parsable, but this isn't the case for "ip xfrm" as shown:
% ip -o xfrm monitor
...
src 0.0.0.0/0 dst 0.0.0.0/0 \ dir out priority 2051 ptype main \ mark -1879048191/0xffffffff
tmpl src 203.0.130.10 dst 198.51.130.30\ proto esp reqid 16384 mode tunnel\
...
as that's 2 lines, not one. Also, the "mark" is shown in signed
decimal, but the mask is in hex. This is confusing: let's use
hex for both.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
---
ip/ipxfrm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 659fa6b6457996cfc2a1beca1b6a8db11492c6d2..95f91a537759f90a07832537c92969d46d8a2921 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -689,7 +689,8 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
if (tb[XFRMA_MARK]) {
struct rtattr *rta = tb[XFRMA_MARK];
struct xfrm_mark *m = (struct xfrm_mark *) RTA_DATA(rta);
- fprintf(fp, "\tmark %d/0x%x\n", m->v, m->m);
+ fprintf(fp, "\tmark %#x/%#x", m->v, m->m);
+ fprintf(fp, "%s", _SL_);
}
if (tb[XFRMA_ALG_AUTH] && !tb[XFRMA_ALG_AUTH_TRUNC]) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] iproute2: Fix -o (oneline) being broken in xfrm & correct mark radix
2015-03-19 19:54 [PATCH v2] iproute2: Fix -o (oneline) being broken in xfrm & correct mark radix Philip Prindeville
@ 2015-03-24 22:02 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2015-03-24 22:02 UTC (permalink / raw)
To: Philip Prindeville; +Cc: netdev, Alexy Kuznetsov
On Thu, 19 Mar 2015 13:54:28 -0600
Philip Prindeville <philipp@redfish-solutions.com> wrote:
> Don't insert newline in -o (oneline) mode; print mark as hex.
>
> Oneline mode is supposed to force all output to be on oneline and
> machine-parsable, but this isn't the case for "ip xfrm" as shown:
>
> % ip -o xfrm monitor
> ...
> src 0.0.0.0/0 dst 0.0.0.0/0 \ dir out priority 2051 ptype main \ mark -1879048191/0xffffffff
> tmpl src 203.0.130.10 dst 198.51.130.30\ proto esp reqid 16384 mode tunnel\
> ...
>
> as that's 2 lines, not one. Also, the "mark" is shown in signed
> decimal, but the mask is in hex. This is confusing: let's use
> hex for both.
>
> Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Applied to master. Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-24 22:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19 19:54 [PATCH v2] iproute2: Fix -o (oneline) being broken in xfrm & correct mark radix Philip Prindeville
2015-03-24 22:02 ` Stephen Hemminger
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).