]> git.proxmox.com Git - mirror_iproute2.git/commit
ip-xfrm: Fix help messages
authorAndrea Claudi <aclaudi@redhat.com>
Wed, 29 Jan 2020 14:56:40 +0000 (15:56 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 29 Jan 2020 18:11:14 +0000 (10:11 -0800)
commit38dd041bfe773e481ebf9c8250e49c665af2e215
tree21ed122556078b2fe3326a17e029ea0db1e5fcfa
parentf9ed2db593e45e6e2ef7c7d0abed63dda25ef3d3
ip-xfrm: Fix help messages

After commit 8589eb4efdf2a ("treewide: refactor help messages") help
messages for xfrm state and policy are broken, printing many times the
same protocol in UPSPEC section:

$ ip xfrm state help
[...]
UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] |
                  { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] |
                  gre [ key { DOTTED-QUAD | NUMBER } ] | PROTO }

This happens because strxf_proto function is non-reentrant and gets called
multiple times in the same fprintf instruction.

This commit fix the issue avoiding calls to strxf_proto() with a constant
param, just hardcoding strings for protocol names.

Fixes: 8589eb4efdf2a ("treewide: refactor help messages")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/xfrm_policy.c
ip/xfrm_state.c