]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip-xfrm: accept "allow" as action in ip xfrm policy setdefault
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 31 Mar 2023 13:18:25 +0000 (15:18 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 5 Apr 2023 01:31:58 +0000 (18:31 -0700)
The help text claims that setdefault takes ACTION values, ie block |
allow. In reality, xfrm_str_to_policy takes block | accept.

We could also fix that by changing the help text/manpage, but then
it'd be frustrating to have multiple ACTION with similar values used
in different subcommands.

I'm not changing the output in xfrm_policy_to_str because some
userspace somewhere probably depends on the "accept" value.

Fixes: 76b30805f9f6 ("xfrm: enable to manage default policies")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/xfrm_policy.c

index be2235ca949d02924434010cff21f4303f6c5047..8687ced35a25f8b02b57b991b69b489fede3abba 100644 (file)
@@ -1141,7 +1141,8 @@ static int xfrm_str_to_policy(char *name, uint8_t *policy)
        if (strcmp(name, "block") == 0) {
                *policy = XFRM_USERPOLICY_BLOCK;
                return 0;
-       } else if (strcmp(name, "accept") == 0) {
+       } else if (strcmp(name, "accept") == 0 ||
+                  strcmp(name, "allow") == 0) {
                *policy = XFRM_USERPOLICY_ACCEPT;
                return 0;
        }