From patchwork Fri Mar 31 13:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sabrina Dubroca X-Patchwork-Id: 13196004 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 185BAC6FD18 for ; Fri, 31 Mar 2023 13:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232227AbjCaNSw convert rfc822-to-8bit (ORCPT ); Fri, 31 Mar 2023 09:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbjCaNSs (ORCPT ); Fri, 31 Mar 2023 09:18:48 -0400 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D84C16D for ; Fri, 31 Mar 2023 06:18:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-LTg7wiazNiK55hJVLLO6Uw-1; Fri, 31 Mar 2023 09:18:42 -0400 X-MC-Unique: LTg7wiazNiK55hJVLLO6Uw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 003A73C0F239; Fri, 31 Mar 2023 13:18:42 +0000 (UTC) Received: from hog.localdomain (unknown [10.39.192.141]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1978D2166B33; Fri, 31 Mar 2023 13:18:40 +0000 (UTC) From: Sabrina Dubroca To: netdev@vger.kernel.org Cc: dsahern@gmail.com, stephen@networkplumber.org, Sabrina Dubroca , nicolas.dichtel@6wind.com Subject: [PATCH iproute2] ip-xfrm: accept "allow" as action in ip xfrm policy setdefault Date: Fri, 31 Mar 2023 15:18:25 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: queasysnail.net Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 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 Acked-by: Nicolas Dichtel --- ip/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c index be2235ca949d..8687ced35a25 100644 --- a/ip/xfrm_policy.c +++ b/ip/xfrm_policy.c @@ -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; }