netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 v5 1/2] ip-xfrm: Fix getprotobynumber() result to be print for each call.
@ 2019-12-16  4:01 mizuta.takeshi
  2019-12-17  4:47 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: mizuta.takeshi @ 2019-12-16  4:01 UTC (permalink / raw)
  To: 'netdev@vger.kernel.org', 'davem@davemloft.net'
  Cc: mizuta.takeshi@fujitsu.com

Running "ip xfrm state help" shows wrong protocol.

  $ ip xfrm state help
  <snip>
  UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] |
                  { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] |

In order to get the character string from the protocol number, getprotobynumber(3) is called.
However, since the address obtained by getprotobynumber(3) is static,
it is necessary to print a character string each time getprotobynumber(3) is called.

Signed-off-by: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com>
---
 ip/xfrm_state.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index b03ccc5..e947a58 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -107,20 +107,16 @@ static void usage(void)
                "EXTRA-FLAG := dont-encap-dscp\n"
                "SELECTOR := [ src ADDR[/PLEN] ] [ dst ADDR[/PLEN] ] [ dev DEV ] [ UPSPEC ]\n"
                "UPSPEC := proto { { ");
-       fprintf(stderr,
-               "%s | %s | %s | %s",
-               strxf_proto(IPPROTO_TCP),
-               strxf_proto(IPPROTO_UDP),
-               strxf_proto(IPPROTO_SCTP),
-               strxf_proto(IPPROTO_DCCP));
+       fprintf(stderr, "%s | ", strxf_proto(IPPROTO_TCP));
+       fprintf(stderr, "%s | ", strxf_proto(IPPROTO_UDP));
+       fprintf(stderr, "%s | ", strxf_proto(IPPROTO_SCTP));
+       fprintf(stderr, "%s", strxf_proto(IPPROTO_DCCP));
        fprintf(stderr,
                " } [ sport PORT ] [ dport PORT ] |\n"
                "                  { ");
-       fprintf(stderr,
-               "%s | %s | %s",
-               strxf_proto(IPPROTO_ICMP),
-               strxf_proto(IPPROTO_ICMPV6),
-               strxf_proto(IPPROTO_MH));
+       fprintf(stderr, "%s | ", strxf_proto(IPPROTO_ICMP));
+       fprintf(stderr, "%s | ", strxf_proto(IPPROTO_ICMPV6));
+       fprintf(stderr, "%s", strxf_proto(IPPROTO_MH));
        fprintf(stderr,
                " } [ type NUMBER ] [ code NUMBER ] |\n");
        fprintf(stderr,
--
2.24.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 v5 1/2] ip-xfrm: Fix getprotobynumber() result to be print for each call.
  2019-12-16  4:01 [PATCH iproute2 v5 1/2] ip-xfrm: Fix getprotobynumber() result to be print for each call mizuta.takeshi
@ 2019-12-17  4:47 ` Stephen Hemminger
  2020-01-06  7:45   ` mizuta.takeshi
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2019-12-17  4:47 UTC (permalink / raw)
  To: mizuta.takeshi@fujitsu.com
  Cc: 'netdev@vger.kernel.org', 'davem@davemloft.net'

On Mon, 16 Dec 2019 04:01:03 +0000
"mizuta.takeshi@fujitsu.com" <mizuta.takeshi@fujitsu.com> wrote:

> Running "ip xfrm state help" shows wrong protocol.
> 
>   $ ip xfrm state help
>   <snip>
>   UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] |
>                   { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] |
> 
> In order to get the character string from the protocol number, getprotobynumber(3) is called.
> However, since the address obtained by getprotobynumber(3) is static,
> it is necessary to print a character string each time getprotobynumber(3) is called.
> 
> Signed-off-by: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com>

These two patches do not apply to current git version of iproute2.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH iproute2 v5 1/2] ip-xfrm: Fix getprotobynumber() result to be print for each call.
  2019-12-17  4:47 ` Stephen Hemminger
@ 2020-01-06  7:45   ` mizuta.takeshi
  0 siblings, 0 replies; 3+ messages in thread
From: mizuta.takeshi @ 2020-01-06  7:45 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: 'netdev@vger.kernel.org', 'davem@davemloft.net'

Hi, Hemminger,

Thank you for your comment.

> These two patches do not apply to current git version of iproute2.

Does this mean that these patches are not applied to iproute2 v5?
If these patches are created for iproute2-next, will they be applied?

I'm sorry, but please tell me the meaning of your comment.

> -----Original Message-----
> From: netdev-owner@vger.kernel.org <netdev-owner@vger.kernel.org> On Behalf Of Stephen
> Hemminger
> Sent: Tuesday, December 17, 2019 1:47 PM
> To: Mizuta, Takeshi/水田 健司 <mizuta.takeshi@fujitsu.com>
> Cc: 'netdev@vger.kernel.org' <netdev@vger.kernel.org>; 'davem@davemloft.net'
> <davem@davemloft.net>
> Subject: Re: [PATCH iproute2 v5 1/2] ip-xfrm: Fix getprotobynumber() result to be print for
> each call.
> 
> On Mon, 16 Dec 2019 04:01:03 +0000
> "mizuta.takeshi@fujitsu.com" <mizuta.takeshi@fujitsu.com> wrote:
> 
> > Running "ip xfrm state help" shows wrong protocol.
> >
> >   $ ip xfrm state help
> >   <snip>
> >   UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] |
> >                   { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] |
> >
> > In order to get the character string from the protocol number, getprotobynumber(3) is called.
> > However, since the address obtained by getprotobynumber(3) is static,
> > it is necessary to print a character string each time getprotobynumber(3) is called.
> >
> > Signed-off-by: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com>
> 
> These two patches do not apply to current git version of iproute2.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-06  7:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-16  4:01 [PATCH iproute2 v5 1/2] ip-xfrm: Fix getprotobynumber() result to be print for each call mizuta.takeshi
2019-12-17  4:47 ` Stephen Hemminger
2020-01-06  7:45   ` mizuta.takeshi

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).