From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0416C43381 for ; Tue, 19 Feb 2019 14:03:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B56F22177E for ; Tue, 19 Feb 2019 14:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbfBSODp (ORCPT ); Tue, 19 Feb 2019 09:03:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725803AbfBSODp (ORCPT ); Tue, 19 Feb 2019 09:03:45 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F9798667D; Tue, 19 Feb 2019 14:03:45 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-48.ams2.redhat.com [10.36.116.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32DC9102490D; Tue, 19 Feb 2019 14:03:44 +0000 (UTC) From: Thomas Haller To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, Thomas Haller Subject: [PATCH iproute2] ip-rule/trivial: add comment about json key "to_tbl" for unspecific rule action Date: Tue, 19 Feb 2019 15:03:31 +0100 Message-Id: <20190219140331.16630-1-thaller@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 19 Feb 2019 14:03:45 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The key should not be called "to_tbl" because it is exactly not a FR_ACT_TO_TBL action. # ip rule add blackhole # ip -j rule | python -m json.tool ... { "priority": 0, "src": "all", "to_tbl": "blackhole" }, Still, as this is already released API from v4.17.0, stick to it. Only add a comment for this oddity. Related: 0dd4ccc56c0e ("iprule: add json support") Signed-off-by: Thomas Haller --- If it is still permissible to change the API, I can also send a patch to rename "to_tbl" key to "action". ip/iprule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ip/iprule.c b/ip/iprule.c index 2f58d8c2..aea175aa 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -459,6 +459,8 @@ int print_rule(struct nlmsghdr *n, void *arg) } else if (frh->action == FR_ACT_NOP) { print_null(PRINT_ANY, "nop", "nop", NULL); } else if (frh->action != FR_ACT_TO_TBL) { + /* The action is not(!) to-tbl, however for historic + * reasons, this JSON key is called "to_tbl". */ print_string(PRINT_ANY, "to_tbl", "%s", rtnl_rtntype_n2a(frh->action, b1, sizeof(b1))); } -- 2.20.1