get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1554073/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1554073,
    "url": "http://patchwork.ozlabs.org/api/patches/1554073/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20211111191306.6369-4-odivlad@gmail.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/",
        "name": "Open Virtual Network development",
        "link_name": "ovn",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20211111191306.6369-4-odivlad@gmail.com>",
    "list_archive_url": null,
    "date": "2021-11-11T19:13:04",
    "name": "[ovs-dev,v7,3/5] northd, utils: support for RouteTables in LRs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7e6d67044aa1b3af856de380b6164c8ace45d0a9",
    "submitter": {
        "id": 80943,
        "url": "http://patchwork.ozlabs.org/api/people/80943/",
        "name": "Vladislav Odintsov",
        "email": "odivlad@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20211111191306.6369-4-odivlad@gmail.com/mbox/",
    "series": [
        {
            "id": 271600,
            "url": "http://patchwork.ozlabs.org/api/series/271600/",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=271600",
            "date": "2021-11-11T19:13:01",
            "name": "Add multiple routing tables support to Logical Routers",
            "version": 7,
            "mbox": "http://patchwork.ozlabs.org/series/271600/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1554073/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/1554073/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "bilbo.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20210112 header.b=ZuEzU0Eh;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.136; helo=smtp3.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)"
        ],
        "Received": [
            "from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hqrwm11Smz9s1l\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 12 Nov 2021 06:13:44 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 2F4A860B9F;\n\tThu, 11 Nov 2021 19:13:42 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n\tby localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id g2zE_xMay559; Thu, 11 Nov 2021 19:13:36 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp3.osuosl.org (Postfix) with ESMTPS id 8625D60BE0;\n\tThu, 11 Nov 2021 19:13:35 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 6AF90C0019;\n\tThu, 11 Nov 2021 19:13:35 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 3F421C000E\n for <dev@openvswitch.org>; Thu, 11 Nov 2021 19:13:34 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 9F23860B87\n for <dev@openvswitch.org>; Thu, 11 Nov 2021 19:13:25 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id cPnDH-TL4cRO for <dev@openvswitch.org>;\n Thu, 11 Nov 2021 19:13:17 +0000 (UTC)",
            "from mail-lf1-x129.google.com (mail-lf1-x129.google.com\n [IPv6:2a00:1450:4864:20::129])\n by smtp3.osuosl.org (Postfix) with ESMTPS id F1CF360B72\n for <dev@openvswitch.org>; Thu, 11 Nov 2021 19:13:16 +0000 (UTC)",
            "by mail-lf1-x129.google.com with SMTP id y26so16409484lfa.11\n for <dev@openvswitch.org>; Thu, 11 Nov 2021 11:13:16 -0800 (PST)",
            "from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru.\n [109.252.131.59])\n by smtp.gmail.com with ESMTPSA id p26sm106915ljj.70.2021.11.11.11.13.12\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Thu, 11 Nov 2021 11:13:12 -0800 (PST)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=6ADcIT4qifYbxZBDhs9pWoTCwi4yzQVVz1m6JEBRIUU=;\n b=ZuEzU0Eh+33IOdjzINBvDHlJ8JE5UPdmUohrHylUUrPULq1lLWEzRDteMtaYOiXXno\n RzEzTwqaGS5OgnWvgf3aX20iAY9qqu+ZGvrzI5cVbmR5IFfwyb4+xidcFKTRL9AYS1sv\n Zzv4fSlhtnj5Bz3xXsunzi5Z+Pf6TH8/zVqGEv5/7U9MvJQ5BpURX2Vw9vS6+ZB72eKF\n 4ILyZom4FnDe1shG/Z5wWN38+tMQZknKYAo8c9NBH88OXlAouNK8YLXgd+qf3w/bieaI\n U5FmS46buivlmAhkiH4KMQtXk6kaRGKdUQg99xS0dMvrWMqbxDLGCwVp5zLnBdNwqmUV\n X37Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=6ADcIT4qifYbxZBDhs9pWoTCwi4yzQVVz1m6JEBRIUU=;\n b=14TU2JZLosMBoflnw7DiUTDbLW2M8xyrb8QSyW8yLCqVGtesX4PyAxc3J+Zzq5ueZ6\n RFmIaNsvMJpv4jRS5IiBFeuIvtt1qIQg3wCdLNs2DZ/BTM9sDO2mgpd7F8OZwl7ZTXCv\n Orug2cC05LudyiP3H4f6JBIPEuVTudkmF8djTKGL+f2LNroX+9C16Y0jIGVkLXkw9C8S\n L2OZ+SZI9bg+rlYKJ1EOjUOIVtgyfMsxgQVGyZz2AMWZfDL/HzQcl8rhoG1vVhg3TkhY\n T0VOhMW2KFIb3HvZLh8ULDNMuzlZ9nLUiw1sC8WtBhd5ZAledEMUhE2YWaJ68fSMd4NK\n W/GQ==",
        "X-Gm-Message-State": "AOAM532H6JSbSqw+yqN/P3+D/TckKGrUte5itLiZg0r7cS3IA9WPJ2aj\n n3iq9Vap5H78C92pIgN7l50BJEArMHPNdA==",
        "X-Google-Smtp-Source": "\n ABdhPJwALfzJvCEfsTPtO/kFHs3TEuV7zHVsH+vn9Rg0ZCjaLcbzu9mzunRi4//gEcfhVTc+rxyDzg==",
        "X-Received": "by 2002:a05:6512:249:: with SMTP id\n b9mr8816882lfo.496.1636657993228;\n Thu, 11 Nov 2021 11:13:13 -0800 (PST)",
        "From": "Vladislav Odintsov <odivlad@gmail.com>",
        "To": "dev@openvswitch.org",
        "Date": "Thu, 11 Nov 2021 22:13:04 +0300",
        "Message-Id": "<20211111191306.6369-4-odivlad@gmail.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20211111191306.6369-1-odivlad@gmail.com>",
        "References": "<20211111191306.6369-1-odivlad@gmail.com>",
        "MIME-Version": "1.0",
        "Cc": "Vladislav Odintsov <odivlad@gmail.com>",
        "Subject": "[ovs-dev] [PATCH ovn v7 3/5] northd,\n\tutils: support for RouteTables in LRs",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "This patch extends Logical Router's routing functionality.\nNow user may create multiple routing tables within a Logical Router\nand assign them to Logical Router Ports.\n\nTraffic coming from Logical Router Port with assigned route_table\nis checked against global routes if any (Logical_Router_Static_Routes\nwhith empty route_table field), next against directly connected routes\nand then Logical_Router_Static_Routes with same route_table value as\nin Logical_Router_Port options:route_table field.\n\nA new Logical Router ingress table #10 is added - IN_IP_ROUTING_PRE.\nIn this table packets which come from LRPs with configured\noptions:route_table field are checked against inport and in OVS\nregister 7 unique non-zero value identifying route table is written.\n\nThen in 11th table IN_IP_ROUTING routes which have non-empty\n`route_table` field are added with additional match on reg7 value\nassociated with appropriate route_table.\n\nSigned-off-by: Vladislav Odintsov <odivlad@gmail.com>\nAcked-by: Numan Siddique <numans@ovn.org>\n---\n northd/northd.c         | 155 +++++++++---\n northd/ovn-northd.8.xml |  63 +++--\n ovn-nb.ovsschema        |   5 +-\n ovn-nb.xml              |  30 +++\n tests/ovn-ic.at         |   4 +\n tests/ovn-nbctl.at      | 196 ++++++++++++++-\n tests/ovn-northd.at     |  74 +++++-\n tests/ovn.at            | 546 +++++++++++++++++++++++++++++++++++++++-\n utilities/ovn-nbctl.c   | 134 +++++++++-\n 9 files changed, 1140 insertions(+), 67 deletions(-)",
    "diff": "diff --git a/northd/northd.c b/northd/northd.c\nindex 960c5f6e0..659cc48b2 100644\n--- a/northd/northd.c\n+++ b/northd/northd.c\n@@ -148,15 +148,16 @@ enum ovn_stage {\n     PIPELINE_STAGE(ROUTER, IN,  ECMP_STATEFUL,   7, \"lr_in_ecmp_stateful\") \\\n     PIPELINE_STAGE(ROUTER, IN,  ND_RA_OPTIONS,   8, \"lr_in_nd_ra_options\") \\\n     PIPELINE_STAGE(ROUTER, IN,  ND_RA_RESPONSE,  9, \"lr_in_nd_ra_response\") \\\n-    PIPELINE_STAGE(ROUTER, IN,  IP_ROUTING,      10, \"lr_in_ip_routing\")   \\\n-    PIPELINE_STAGE(ROUTER, IN,  IP_ROUTING_ECMP, 11, \"lr_in_ip_routing_ecmp\") \\\n-    PIPELINE_STAGE(ROUTER, IN,  POLICY,          12, \"lr_in_policy\")       \\\n-    PIPELINE_STAGE(ROUTER, IN,  POLICY_ECMP,     13, \"lr_in_policy_ecmp\")  \\\n-    PIPELINE_STAGE(ROUTER, IN,  ARP_RESOLVE,     14, \"lr_in_arp_resolve\")  \\\n-    PIPELINE_STAGE(ROUTER, IN,  CHK_PKT_LEN   ,  15, \"lr_in_chk_pkt_len\")  \\\n-    PIPELINE_STAGE(ROUTER, IN,  LARGER_PKTS,     16, \"lr_in_larger_pkts\")  \\\n-    PIPELINE_STAGE(ROUTER, IN,  GW_REDIRECT,     17, \"lr_in_gw_redirect\")  \\\n-    PIPELINE_STAGE(ROUTER, IN,  ARP_REQUEST,     18, \"lr_in_arp_request\")  \\\n+    PIPELINE_STAGE(ROUTER, IN,  IP_ROUTING_PRE,  10, \"lr_in_ip_routing_pre\")  \\\n+    PIPELINE_STAGE(ROUTER, IN,  IP_ROUTING,      11, \"lr_in_ip_routing\")      \\\n+    PIPELINE_STAGE(ROUTER, IN,  IP_ROUTING_ECMP, 12, \"lr_in_ip_routing_ecmp\") \\\n+    PIPELINE_STAGE(ROUTER, IN,  POLICY,          13, \"lr_in_policy\")          \\\n+    PIPELINE_STAGE(ROUTER, IN,  POLICY_ECMP,     14, \"lr_in_policy_ecmp\")     \\\n+    PIPELINE_STAGE(ROUTER, IN,  ARP_RESOLVE,     15, \"lr_in_arp_resolve\")     \\\n+    PIPELINE_STAGE(ROUTER, IN,  CHK_PKT_LEN,     16, \"lr_in_chk_pkt_len\")     \\\n+    PIPELINE_STAGE(ROUTER, IN,  LARGER_PKTS,     17, \"lr_in_larger_pkts\")     \\\n+    PIPELINE_STAGE(ROUTER, IN,  GW_REDIRECT,     18, \"lr_in_gw_redirect\")     \\\n+    PIPELINE_STAGE(ROUTER, IN,  ARP_REQUEST,     19, \"lr_in_arp_request\")     \\\n                                                                       \\\n     /* Logical router egress stages. */                               \\\n     PIPELINE_STAGE(ROUTER, OUT, UNDNAT,      0, \"lr_out_undnat\")        \\\n@@ -225,6 +226,7 @@ enum ovn_stage {\n #define REG_NEXT_HOP_IPV6 \"xxreg0\"\n #define REG_SRC_IPV4 \"reg1\"\n #define REG_SRC_IPV6 \"xxreg1\"\n+#define REG_ROUTE_TABLE_ID \"reg7\"\n \n #define REG_ORIG_TP_DPORT_ROUTER   \"reg9[16..31]\"\n \n@@ -287,8 +289,9 @@ enum ovn_stage {\n  * | R6  |        UNUSED            | X |                 | G | IN_IP_ROUTING)|\n  * |     |                          | R |                 | 1 |               |\n  * +-----+--------------------------+ E |     UNUSED      |   |               |\n- * | R7  |        UNUSED            | G |                 |   |               |\n- * |     |                          | 3 |                 |   |               |\n+ * | R7  |      ROUTE_TABLE_ID      | G |                 |   |               |\n+ * |     | (>= IN_IP_ROUTING_PRE && | 3 |                 |   |               |\n+ * |     |  <= IN_IP_ROUTING)       |   |                 |   |               |\n  * +-----+--------------------------+---+-----------------+---+---------------+\n  * | R8  |     ECMP_GROUP_ID        |   |                 |\n  * |     |     ECMP_MEMBER_ID       | X |                 |\n@@ -8647,11 +8650,72 @@ cleanup:\n     ds_destroy(&actions);\n }\n \n+static uint32_t\n+route_table_add(struct simap *route_tables, const char *route_table_name)\n+{\n+    /* route table ids start from 1 */\n+    uint32_t rtb_id = simap_count(route_tables) + 1;\n+\n+    if (rtb_id == UINT16_MAX) {\n+        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);\n+        VLOG_WARN_RL(&rl, \"too many route tables for Logical Router.\");\n+        return 0;\n+    }\n+\n+    if (!simap_put(route_tables, route_table_name, rtb_id)) {\n+        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);\n+        VLOG_WARN_RL(&rl, \"Route table id unexpectedly appeared\");\n+    }\n+\n+    return rtb_id;\n+}\n+\n+static uint32_t\n+get_route_table_id(struct simap *route_tables, const char *route_table_name)\n+{\n+    if (!route_table_name || !strlen(route_table_name)) {\n+        return 0;\n+    }\n+\n+    uint32_t rtb_id = simap_get(route_tables, route_table_name);\n+    if (!rtb_id) {\n+        rtb_id = route_table_add(route_tables, route_table_name);\n+    }\n+\n+    return rtb_id;\n+}\n+\n+static void\n+build_route_table_lflow(struct ovn_datapath *od, struct hmap *lflows,\n+                        struct nbrec_logical_router_port *lrp,\n+                        struct simap *route_tables)\n+{\n+    struct ds match = DS_EMPTY_INITIALIZER;\n+    struct ds actions = DS_EMPTY_INITIALIZER;\n+\n+    const char *route_table_name = smap_get(&lrp->options, \"route_table\");\n+    uint32_t rtb_id = get_route_table_id(route_tables, route_table_name);\n+    if (!rtb_id) {\n+        return;\n+    }\n+\n+    ds_put_format(&match, \"inport == \\\"%s\\\"\", lrp->name);\n+    ds_put_format(&actions, \"%s = %d; next;\",\n+                  REG_ROUTE_TABLE_ID, rtb_id);\n+\n+    ovn_lflow_add(lflows, od, S_ROUTER_IN_IP_ROUTING_PRE, 100,\n+                  ds_cstr(&match), ds_cstr(&actions));\n+\n+    ds_destroy(&match);\n+    ds_destroy(&actions);\n+}\n+\n struct parsed_route {\n     struct ovs_list list_node;\n     struct in6_addr prefix;\n     unsigned int plen;\n     bool is_src_route;\n+    uint32_t route_table_id;\n     uint32_t hash;\n     const struct nbrec_logical_router_static_route *route;\n     bool ecmp_symmetric_reply;\n@@ -8676,7 +8740,7 @@ find_static_route_outport(struct ovn_datapath *od, struct hmap *ports,\n  * Otherwise return NULL. */\n static struct parsed_route *\n parsed_routes_add(struct ovn_datapath *od, struct hmap *ports,\n-                  struct ovs_list *routes,\n+                  struct ovs_list *routes, struct simap *route_tables,\n                   const struct nbrec_logical_router_static_route *route,\n                   struct hmap *bfd_connections)\n {\n@@ -8758,6 +8822,7 @@ parsed_routes_add(struct ovn_datapath *od, struct hmap *ports,\n     struct parsed_route *pr = xzalloc(sizeof *pr);\n     pr->prefix = prefix;\n     pr->plen = plen;\n+    pr->route_table_id = get_route_table_id(route_tables, route->route_table);\n     pr->is_src_route = (route->policy && !strcmp(route->policy,\n                                                  \"src-ip\"));\n     pr->hash = route_hash(pr);\n@@ -8791,6 +8856,7 @@ struct ecmp_groups_node {\n     struct in6_addr prefix;\n     unsigned int plen;\n     bool is_src_route;\n+    uint32_t route_table_id;\n     uint16_t route_count;\n     struct ovs_list route_list; /* Contains ecmp_route_list_node */\n };\n@@ -8799,7 +8865,7 @@ static void\n ecmp_groups_add_route(struct ecmp_groups_node *group,\n                       const struct parsed_route *route)\n {\n-   if (group->route_count == UINT16_MAX) {\n+    if (group->route_count == UINT16_MAX) {\n         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);\n         VLOG_WARN_RL(&rl, \"too many routes in a single ecmp group.\");\n         return;\n@@ -8828,6 +8894,7 @@ ecmp_groups_add(struct hmap *ecmp_groups,\n     eg->prefix = route->prefix;\n     eg->plen = route->plen;\n     eg->is_src_route = route->is_src_route;\n+    eg->route_table_id = route->route_table_id;\n     ovs_list_init(&eg->route_list);\n     ecmp_groups_add_route(eg, route);\n \n@@ -8841,7 +8908,8 @@ ecmp_groups_find(struct hmap *ecmp_groups, struct parsed_route *route)\n     HMAP_FOR_EACH_WITH_HASH (eg, hmap_node, route->hash, ecmp_groups) {\n         if (ipv6_addr_equals(&eg->prefix, &route->prefix) &&\n             eg->plen == route->plen &&\n-            eg->is_src_route == route->is_src_route) {\n+            eg->is_src_route == route->is_src_route &&\n+            eg->route_table_id == route->route_table_id) {\n             return eg;\n         }\n     }\n@@ -8888,7 +8956,8 @@ unique_routes_remove(struct hmap *unique_routes,\n     HMAP_FOR_EACH_WITH_HASH (ur, hmap_node, route->hash, unique_routes) {\n         if (ipv6_addr_equals(&route->prefix, &ur->route->prefix) &&\n             route->plen == ur->route->plen &&\n-            route->is_src_route == ur->route->is_src_route) {\n+            route->is_src_route == ur->route->is_src_route &&\n+            route->route_table_id == ur->route->route_table_id) {\n             hmap_remove(unique_routes, &ur->hmap_node);\n             const struct parsed_route *existed_route = ur->route;\n             free(ur);\n@@ -8926,9 +8995,9 @@ build_route_prefix_s(const struct in6_addr *prefix, unsigned int plen)\n }\n \n static void\n-build_route_match(const struct ovn_port *op_inport, const char *network_s,\n-                  int plen, bool is_src_route, bool is_ipv4, struct ds *match,\n-                  uint16_t *priority, int ofs)\n+build_route_match(const struct ovn_port *op_inport, uint32_t rtb_id,\n+                  const char *network_s, int plen, bool is_src_route,\n+                  bool is_ipv4, struct ds *match, uint16_t *priority, int ofs)\n {\n     const char *dir;\n     /* The priority here is calculated to implement longest-prefix-match\n@@ -8945,6 +9014,9 @@ build_route_match(const struct ovn_port *op_inport, const char *network_s,\n     if (op_inport) {\n         ds_put_format(match, \"inport == %s && \", op_inport->json_key);\n     }\n+    if (rtb_id || ofs == ROUTE_PRIO_OFFSET_STATIC) {\n+        ds_put_format(match, \"%s == %d && \", REG_ROUTE_TABLE_ID, rtb_id);\n+    }\n     ds_put_format(match, \"ip%s.%s == %s/%d\", is_ipv4 ? \"4\" : \"6\", dir,\n                   network_s, plen);\n }\n@@ -9113,8 +9185,9 @@ build_ecmp_route_flow(struct hmap *lflows, struct ovn_datapath *od,\n     struct ds route_match = DS_EMPTY_INITIALIZER;\n \n     char *prefix_s = build_route_prefix_s(&eg->prefix, eg->plen);\n-    build_route_match(NULL, prefix_s, eg->plen, eg->is_src_route, is_ipv4,\n-                      &route_match, &priority, ROUTE_PRIO_OFFSET_STATIC);\n+    build_route_match(NULL, eg->route_table_id, prefix_s, eg->plen,\n+                      eg->is_src_route, is_ipv4, &route_match, &priority,\n+                      ROUTE_PRIO_OFFSET_STATIC);\n     free(prefix_s);\n \n     struct ds actions = DS_EMPTY_INITIALIZER;\n@@ -9189,8 +9262,9 @@ static void\n add_route(struct hmap *lflows, struct ovn_datapath *od,\n           const struct ovn_port *op, const char *lrp_addr_s,\n           const char *network_s, int plen, const char *gateway,\n-          bool is_src_route, const struct ovsdb_idl_row *stage_hint,\n-          bool is_discard_route, int ofs)\n+          bool is_src_route, const uint32_t rtb_id,\n+          const struct ovsdb_idl_row *stage_hint, bool is_discard_route,\n+          int ofs)\n {\n     bool is_ipv4 = strchr(network_s, '.') ? true : false;\n     struct ds match = DS_EMPTY_INITIALIZER;\n@@ -9205,8 +9279,8 @@ add_route(struct hmap *lflows, struct ovn_datapath *od,\n             op_inport = op;\n         }\n     }\n-    build_route_match(op_inport, network_s, plen, is_src_route, is_ipv4,\n-                      &match, &priority, ofs);\n+    build_route_match(op_inport, rtb_id, network_s, plen, is_src_route,\n+                      is_ipv4, &match, &priority, ofs);\n \n     struct ds common_actions = DS_EMPTY_INITIALIZER;\n     struct ds actions = DS_EMPTY_INITIALIZER;\n@@ -9269,8 +9343,8 @@ build_static_route_flow(struct hmap *lflows, struct ovn_datapath *od,\n     char *prefix_s = build_route_prefix_s(&route_->prefix, route_->plen);\n     add_route(lflows, route_->is_discard_route ? od : out_port->od, out_port,\n               lrp_addr_s, prefix_s, route_->plen, route->nexthop,\n-              route_->is_src_route, &route->header_, route_->is_discard_route,\n-              ROUTE_PRIO_OFFSET_STATIC);\n+              route_->is_src_route, route_->route_table_id, &route->header_,\n+              route_->is_discard_route, ROUTE_PRIO_OFFSET_STATIC);\n \n     free(prefix_s);\n }\n@@ -10657,6 +10731,18 @@ build_ND_RA_flows_for_lrouter(struct ovn_datapath *od, struct hmap *lflows)\n     }\n }\n \n+/* Logical router ingress table IP_ROUTING_PRE:\n+ * by default goto next. (priority 0). */\n+static void\n+build_ip_routing_pre_flows_for_lrouter(struct ovn_datapath *od,\n+                                       struct hmap *lflows)\n+{\n+    if (od->nbr) {\n+        ovn_lflow_add(lflows, od, S_ROUTER_IN_IP_ROUTING_PRE, 0, \"1\",\n+                      REG_ROUTE_TABLE_ID\" = 0; next;\");\n+    }\n+}\n+\n /* Logical router ingress table IP_ROUTING : IP Routing.\n  *\n  * A packet that arrives at this table is an IP packet that should be\n@@ -10682,14 +10768,14 @@ build_ip_routing_flows_for_lrouter_port(\n         for (int i = 0; i < op->lrp_networks.n_ipv4_addrs; i++) {\n             add_route(lflows, op->od, op, op->lrp_networks.ipv4_addrs[i].addr_s,\n                       op->lrp_networks.ipv4_addrs[i].network_s,\n-                      op->lrp_networks.ipv4_addrs[i].plen, NULL, false,\n+                      op->lrp_networks.ipv4_addrs[i].plen, NULL, false, 0,\n                       &op->nbrp->header_, false, ROUTE_PRIO_OFFSET_CONNECTED);\n         }\n \n         for (int i = 0; i < op->lrp_networks.n_ipv6_addrs; i++) {\n             add_route(lflows, op->od, op, op->lrp_networks.ipv6_addrs[i].addr_s,\n                       op->lrp_networks.ipv6_addrs[i].network_s,\n-                      op->lrp_networks.ipv6_addrs[i].plen, NULL, false,\n+                      op->lrp_networks.ipv6_addrs[i].plen, NULL, false, 0,\n                       &op->nbrp->header_, false, ROUTE_PRIO_OFFSET_CONNECTED);\n         }\n     } else if (lsp_is_router(op->nbsp)) {\n@@ -10712,7 +10798,7 @@ build_ip_routing_flows_for_lrouter_port(\n                     add_route(lflows, peer->od, peer,\n                               peer->lrp_networks.ipv4_addrs[0].addr_s,\n                               laddrs->ipv4_addrs[k].network_s,\n-                              laddrs->ipv4_addrs[k].plen, NULL, false,\n+                              laddrs->ipv4_addrs[k].plen, NULL, false, 0,\n                               &peer->nbrp->header_, false,\n                               ROUTE_PRIO_OFFSET_CONNECTED);\n                 }\n@@ -10733,10 +10819,17 @@ build_static_route_flows_for_lrouter(\n         struct hmap ecmp_groups = HMAP_INITIALIZER(&ecmp_groups);\n         struct hmap unique_routes = HMAP_INITIALIZER(&unique_routes);\n         struct ovs_list parsed_routes = OVS_LIST_INITIALIZER(&parsed_routes);\n+        struct simap route_tables = SIMAP_INITIALIZER(&route_tables);\n         struct ecmp_groups_node *group;\n+\n+        for (int i = 0; i < od->nbr->n_ports; i++) {\n+            build_route_table_lflow(od, lflows, od->nbr->ports[i],\n+                                    &route_tables);\n+        }\n+\n         for (int i = 0; i < od->nbr->n_static_routes; i++) {\n             struct parsed_route *route =\n-                parsed_routes_add(od, ports, &parsed_routes,\n+                parsed_routes_add(od, ports, &parsed_routes, &route_tables,\n                                   od->nbr->static_routes[i], bfd_connections);\n             if (!route) {\n                 continue;\n@@ -10769,6 +10862,7 @@ build_static_route_flows_for_lrouter(\n         ecmp_groups_destroy(&ecmp_groups);\n         unique_routes_destroy(&unique_routes);\n         parsed_routes_destroy(&parsed_routes);\n+        simap_destroy(&route_tables);\n     }\n }\n \n@@ -12952,6 +13046,7 @@ build_lswitch_and_lrouter_iterate_by_od(struct ovn_datapath *od,\n     build_neigh_learning_flows_for_lrouter(od, lsi->lflows, &lsi->match,\n                                            &lsi->actions, lsi->meter_groups);\n     build_ND_RA_flows_for_lrouter(od, lsi->lflows);\n+    build_ip_routing_pre_flows_for_lrouter(od, lsi->lflows);\n     build_static_route_flows_for_lrouter(od, lsi->lflows, lsi->ports,\n                                          lsi->bfd_connections);\n     build_mcast_lookup_flows_for_lrouter(od, lsi->lflows, &lsi->match,\ndiff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml\nindex fb67395e3..755f4e27f 100644\n--- a/northd/ovn-northd.8.xml\n+++ b/northd/ovn-northd.8.xml\n@@ -2945,7 +2945,7 @@ icmp6 {\n \n     <p>\n       If ECMP routes with symmetric reply are configured in the\n-      <code>OVN_Northbound</code> database for a gateway router, a priority-300\n+      <code>OVN_Northbound</code> database for a gateway router, a priority-400\n       flow is added for each router port on which symmetric replies are\n       configured. The matching logic for these ports essentially reverses the\n       configured logic of the ECMP route. So for instance, a route with a\n@@ -3291,7 +3291,35 @@ output;\n       </li>\n     </ul>\n \n-    <h3>Ingress Table 10: IP Routing</h3>\n+    <h3>Ingress Table 10: IP Routing Pre</h3>\n+\n+    <p>\n+      If a packet arrived at this table from Logical Router Port <var>P</var>\n+      which has <code>options:route_table</code> value set, a logical flow with\n+      match <code>inport == \"<var>P</var>\"</code> with priority 100 and action,\n+      setting unique-generated per-datapath 32-bit value (non-zero) in OVS\n+      register 7.  This register is checked in next table.\n+    </p>\n+\n+    <p>\n+      This table contains the following logical flows:\n+    </p>\n+\n+    <ul>\n+      <li>\n+        <p>\n+          Priority-100 flow with match <code>inport == \"LRP_NAME\"</code> value\n+          and action, which set route table identifier in reg7.\n+        </p>\n+\n+        <p>\n+          A priority-0 logical flow with match <code>1</code> has actions\n+          <code>next;</code>.\n+        </p>\n+      </li>\n+    </ul>\n+\n+    <h3>Ingress Table 11: IP Routing</h3>\n \n     <p>\n       A packet that arrives at this table is an IP packet that should be\n@@ -3362,10 +3390,10 @@ output;\n         <p>\n           IPv4 routing table.  For each route to IPv4 network <var>N</var> with\n           netmask <var>M</var>, on router port <var>P</var> with IP address\n-          <var>A</var> and Ethernet\n-          address <var>E</var>, a logical flow with match <code>ip4.dst ==\n-          <var>N</var>/<var>M</var></code>, whose priority is the number of\n-          1-bits in <var>M</var>, has the following actions:\n+          <var>A</var> and Ethernet address <var>E</var>, a logical flow with\n+          match <code>ip4.dst == <var>N</var>/<var>M</var></code>, whose\n+          priority is 100 + the number of 1-bits in <var>M</var>, has the\n+          following actions:\n         </p>\n \n         <pre>\n@@ -3428,6 +3456,13 @@ next;\n           If the address <var>A</var> is in the link-local scope, the\n           route will be limited to sending on the ingress port.\n         </p>\n+\n+        <p>\n+          For routes with <code>route_table</code> value set\n+          <code>reg7 == id</code> is prefixed in logical flow match portion.\n+          Priority for routes with <code>route_table</code> value set is\n+          the number of 1-bits in <var>M</var>.\n+        </p>\n       </li>\n \n       <li>\n@@ -3454,7 +3489,7 @@ select(reg8[16..31], <var>MID1</var>, <var>MID2</var>, ...);\n       </li>\n     </ul>\n \n-    <h3>Ingress Table 11: IP_ROUTING_ECMP</h3>\n+    <h3>Ingress Table 12: IP_ROUTING_ECMP</h3>\n \n     <p>\n       This table implements the second part of IP routing for ECMP routes\n@@ -3506,7 +3541,7 @@ outport = <var>P</var>;\n       </li>\n     </ul>\n \n-    <h3>Ingress Table 12: Router policies</h3>\n+    <h3>Ingress Table 13: Router policies</h3>\n     <p>\n       This table adds flows for the logical router policies configured\n       on the logical router. Please see the\n@@ -3578,7 +3613,7 @@ next;\n       </li>\n     </ul>\n \n-    <h3>Ingress Table 13: ECMP handling for router policies</h3>\n+    <h3>Ingress Table 14: ECMP handling for router policies</h3>\n     <p>\n       This table handles the ECMP for the router policies configured\n       with multiple nexthops.\n@@ -3622,7 +3657,7 @@ outport = <var>P</var>\n       </li>\n     </ul>\n \n-    <h3>Ingress Table 14: ARP/ND Resolution</h3>\n+    <h3>Ingress Table 15: ARP/ND Resolution</h3>\n \n     <p>\n       Any packet that reaches this table is an IP packet whose next-hop\n@@ -3813,7 +3848,7 @@ outport = <var>P</var>\n \n     </ul>\n \n-    <h3>Ingress Table 15: Check packet length</h3>\n+    <h3>Ingress Table 16: Check packet length</h3>\n \n     <p>\n       For distributed logical routers or gateway routers with gateway\n@@ -3843,7 +3878,7 @@ REGBIT_PKT_LARGER = check_pkt_larger(<var>L</var>); next;\n       and advances to the next table.\n     </p>\n \n-    <h3>Ingress Table 16: Handle larger packets</h3>\n+    <h3>Ingress Table 17: Handle larger packets</h3>\n \n     <p>\n       For distributed logical routers or gateway routers with gateway port\n@@ -3906,7 +3941,7 @@ icmp6 {\n       and advances to the next table.\n     </p>\n \n-    <h3>Ingress Table 17: Gateway Redirect</h3>\n+    <h3>Ingress Table 18: Gateway Redirect</h3>\n \n     <p>\n       For distributed logical routers where one or more of the logical router\n@@ -3953,7 +3988,7 @@ icmp6 {\n       </li>\n     </ul>\n \n-    <h3>Ingress Table 18: ARP Request</h3>\n+    <h3>Ingress Table 19: ARP Request</h3>\n \n     <p>\n       In the common case where the Ethernet destination has been resolved, this\ndiff --git a/ovn-nb.ovsschema b/ovn-nb.ovsschema\nindex 5dee04fe9..55977339a 100644\n--- a/ovn-nb.ovsschema\n+++ b/ovn-nb.ovsschema\n@@ -1,7 +1,7 @@\n {\n     \"name\": \"OVN_Northbound\",\n-    \"version\": \"5.33.1\",\n-    \"cksum\": \"1931852754 30731\",\n+    \"version\": \"5.34.1\",\n+    \"cksum\": \"2177334725 30782\",\n     \"tables\": {\n         \"NB_Global\": {\n             \"columns\": {\n@@ -407,6 +407,7 @@\n             \"isRoot\": false},\n         \"Logical_Router_Static_Route\": {\n             \"columns\": {\n+                \"route_table\": {\"type\": \"string\"},\n                 \"ip_prefix\": {\"type\": \"string\"},\n                 \"policy\": {\"type\": {\"key\": {\"type\": \"string\",\n                                             \"enum\": [\"set\", [\"src-ip\",\ndiff --git a/ovn-nb.xml b/ovn-nb.xml\nindex 036ffa64f..4a1d4abdf 100644\n--- a/ovn-nb.xml\n+++ b/ovn-nb.xml\n@@ -2820,6 +2820,14 @@\n           prefix according to RFC3663\n         </p>\n       </column>\n+\n+      <column name=\"options\" key=\"route_table\">\n+        Designates lookup Logical_Router_Static_Routes with specified\n+        <code>route_table</code> value. Routes to directly connected networks\n+        from same Logical Router and routes without <code>route_table</code>\n+        option set have higher priority than routes with\n+        <code>route_table</code> option set.\n+      </column>\n     </group>\n \n     <group title=\"Attachment\">\n@@ -2939,6 +2947,28 @@\n       </p>\n     </column>\n \n+    <column name=\"route_table\">\n+      <p>\n+        Any string to place route to separate routing table. If Logical Router\n+        Port has configured value in <ref table=\"Logical_Router_Port\"\n+        column=\"options\" key=\"route_table\"/> other than empty string, OVN\n+        performs route lookup for all packets entering Logical Router ingress\n+        pipeline from this port in the following manner:\n+      </p>\n+\n+      <ul>\n+        <li>\n+          1. First lookup among \"global\" routes: routes without\n+          <code>route_table</code> value set and routes to directly connected\n+          networks.\n+        </li>\n+        <li>\n+          2. Next lookup among routes with same <code>route_table</code> value\n+          as specified in LRP's options:route_table field.\n+        </li>\n+      </ul>\n+    </column>\n+\n     <column name=\"external_ids\" key=\"ic-learned-route\">\n       <code>ovn-ic</code> populates this key if the route is learned from the\n       global <ref db=\"OVN_IC_Southbound\"/> database.  In this case the value\ndiff --git a/tests/ovn-ic.at b/tests/ovn-ic.at\nindex 7e8498b2f..d1764d05b 100644\n--- a/tests/ovn-ic.at\n+++ b/tests/ovn-ic.at\n@@ -282,6 +282,7 @@ done\n \n AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl\n IPv4 Routes\n+Route Table global:\n              10.11.1.0/24               169.254.0.1 dst-ip\n              10.11.2.0/24             169.254.100.2 dst-ip (learned)\n              10.22.1.0/24               169.254.0.2 src-ip\n@@ -300,6 +301,7 @@ ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=false\n OVS_WAIT_WHILE([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned])\n AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl\n IPv4 Routes\n+Route Table global:\n              10.11.1.0/24               169.254.0.1 dst-ip\n              10.22.1.0/24               169.254.0.2 src-ip\n ])\n@@ -315,6 +317,7 @@ ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=false\n OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned])\n AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl\n IPv4 Routes\n+Route Table global:\n              10.11.2.0/24               169.254.0.1 dst-ip\n              10.22.2.0/24               169.254.0.2 src-ip\n ])\n@@ -333,6 +336,7 @@ done\n # Default route should NOT get advertised or learned, by default.\n AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl\n IPv4 Routes\n+Route Table global:\n              10.11.1.0/24             169.254.100.1 dst-ip (learned)\n              10.11.2.0/24               169.254.0.1 dst-ip\n              10.22.2.0/24               169.254.0.2 src-ip\ndiff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at\nindex a8946fef8..911310aeb 100644\n--- a/tests/ovn-nbctl.at\n+++ b/tests/ovn-nbctl.at\n@@ -1522,6 +1522,7 @@ AT_CHECK([ovn-nbctl --ecmp --policy=src-ip lr-route-add lr0 20.0.0.0/24 11.0.0.1\n \n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.1 dst-ip\n               10.0.1.0/24                  11.0.1.1 dst-ip lp0\n              10.0.10.0/24                           dst-ip lp0\n@@ -1536,6 +1537,7 @@ AT_CHECK([ovn-nbctl lrp-add lr0 lp1 f0:00:00:00:00:02 11.0.0.254/24])\n AT_CHECK([ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.1 dst-ip lp1\n               10.0.1.0/24                  11.0.1.1 dst-ip lp0\n              10.0.10.0/24                           dst-ip lp0\n@@ -1566,6 +1568,7 @@ AT_CHECK([ovn-nbctl --policy=src-ip lr-route-del lr0 9.16.1.0/24])\n \n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.1 dst-ip lp1\n              10.0.10.0/24                           dst-ip lp0\n               10.0.0.0/24                  11.0.0.2 src-ip\n@@ -1577,6 +1580,7 @@ AT_CHECK([ovn-nbctl --policy=dst-ip lr-route-del lr0 10.0.0.0/24])\n AT_CHECK([ovn-nbctl --policy=src-ip lr-route-del lr0 10.0.0.0/24])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n              10.0.10.0/24                           dst-ip lp0\n                 0.0.0.0/0               192.168.0.1 dst-ip\n ])\n@@ -1587,6 +1591,7 @@ AT_CHECK([ovn-nbctl --policy=src-ip lr-route-add lr0 10.0.0.0/24 11.0.0.2])\n AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n              10.0.10.0/24                           dst-ip lp0\n                 0.0.0.0/0               192.168.0.1 dst-ip\n ])\n@@ -1603,6 +1608,7 @@ AT_CHECK([ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.3])\n AT_CHECK([ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.4 lp0])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.1 dst-ip ecmp\n               10.0.0.0/24                  11.0.0.2 dst-ip ecmp\n               10.0.0.0/24                  11.0.0.3 dst-ip ecmp\n@@ -1617,6 +1623,7 @@ dnl Delete ecmp routes\n AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.1])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.2 dst-ip ecmp\n               10.0.0.0/24                  11.0.0.3 dst-ip ecmp\n               10.0.0.0/24                  11.0.0.4 dst-ip lp0 ecmp\n@@ -1624,12 +1631,14 @@ IPv4 Routes\n AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.2])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.3 dst-ip ecmp\n               10.0.0.0/24                  11.0.0.4 dst-ip lp0 ecmp\n ])\n AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.4 lp0])\n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.3 dst-ip\n ])\n AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.3])\n@@ -1643,6 +1652,7 @@ AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1])\n \n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv6 Routes\n+Route Table <main>:\n             2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n           2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n                      ::/0        2001:db8:0:f101::1 dst-ip\n@@ -1652,6 +1662,7 @@ AT_CHECK([ovn-nbctl lr-route-del lr0 2001:0db8:0::/64])\n \n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv6 Routes\n+Route Table <main>:\n           2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n                      ::/0        2001:db8:0:f101::1 dst-ip\n ])\n@@ -1679,11 +1690,13 @@ AT_CHECK([ovn-nbctl --may-exist --ecmp-symmetric-reply lr-route-add lr0 2003:0db\n \n AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n IPv4 Routes\n+Route Table <main>:\n               10.0.0.0/24                  11.0.0.1 dst-ip\n               10.0.1.0/24                  11.0.1.1 dst-ip lp0\n                 0.0.0.0/0               192.168.0.1 dst-ip\n \n IPv6 Routes\n+Route Table <main>:\n             2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n           2001:db8:1::/64        2001:db8:0:f103::1 dst-ip ecmp\n           2001:db8:1::/64        2001:db8:0:f103::2 dst-ip ecmp\n@@ -1698,7 +1711,188 @@ AT_CHECK([ovn-nbctl lrp-add lr0 lr0-p0 00:00:01:01:02:03 192.168.10.1/24])\n bfd_uuid=$(ovn-nbctl create bfd logical_port=lr0-p0 dst_ip=100.0.0.50 status=down min_tx=250 min_rx=250 detect_mult=10)\n AT_CHECK([ovn-nbctl lr-route-add lr0 100.0.0.0/24 192.168.0.1])\n route_uuid=$(fetch_column nb:logical_router_static_route _uuid ip_prefix=\"100.0.0.0/24\")\n-AT_CHECK([ovn-nbctl set logical_router_static_route $route_uuid bfd=$bfd_uuid])])\n+AT_CHECK([ovn-nbctl set logical_router_static_route $route_uuid bfd=$bfd_uuid])\n+\n+check ovn-nbctl lr-route-del lr0\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+])\n+\n+dnl Check IPv4 routes in route table\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 0.0.0.0/0 192.168.0.1\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 10.0.0.1/24 11.0.0.1\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+IPv4 Routes\n+Route Table rtb-1:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+])\n+\n+check ovn-nbctl lr-route-del lr0\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+])\n+\n+dnl Check IPv6 routes in route table\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1\n+\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+IPv6 Routes\n+Route Table rtb-1:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+])\n+\n+dnl Check IPv4 and IPv6 routes in route table\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 0.0.0.0/0 192.168.0.1\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 10.0.0.1/24 11.0.0.1\n+\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+IPv4 Routes\n+Route Table rtb-1:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+IPv6 Routes\n+Route Table rtb-1:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+])\n+\n+# Add routes in another route table\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 0.0.0.0/0 192.168.0.1\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 10.0.0.1/24 11.0.0.1\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1\n+\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+IPv4 Routes\n+Route Table rtb-1:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+Route Table rtb-2:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+IPv6 Routes\n+Route Table rtb-1:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+\n+Route Table rtb-2:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+])\n+\n+# Add routes to <main> route table\n+check ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1\n+check ovn-nbctl lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0\n+check ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.1\n+check ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1\n+check ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0\n+check check ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1\n+\n+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl\n+IPv4 Routes\n+Route Table <main>:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+Route Table rtb-1:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+Route Table rtb-2:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+IPv6 Routes\n+Route Table <main>:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+\n+Route Table rtb-1:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+\n+Route Table rtb-2:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+])\n+\n+# delete IPv4 route from rtb-1\n+check ovn-nbctl --route-table=rtb-1 lr-route-del lr0 10.0.0.0/24\n+AT_CHECK([ovn-nbctl --route-table=rtb-1 lr-route-list lr0], [0], [dnl\n+IPv4 Routes\n+Route Table rtb-1:\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+IPv6 Routes\n+Route Table rtb-1:\n+            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+])\n+\n+# delete IPv6 route from rtb-2\n+check ovn-nbctl --route-table=rtb-2 lr-route-del lr0 2001:db8::/64\n+AT_CHECK([ovn-nbctl --route-table=rtb-2 lr-route-list lr0], [0], [dnl\n+IPv4 Routes\n+Route Table rtb-2:\n+              10.0.0.0/24                  11.0.0.1 dst-ip\n+              10.0.1.0/24                  11.0.1.1 dst-ip lp0\n+                0.0.0.0/0               192.168.0.1 dst-ip\n+\n+IPv6 Routes\n+Route Table rtb-2:\n+          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip\n+                     ::/0        2001:db8:0:f101::1 dst-ip\n+])\n+\n+check ovn-nbctl lr-route-del lr0\n+\n+# ECMP route in route table\n+check ovn-nbctl --route-table=rtb1 lr-route-add lr0 0.0.0.0/0 192.168.0.1\n+check ovn-nbctl --ecmp --route-table=rtb1 lr-route-add lr0 0.0.0.0/0 192.168.0.2\n+\n+# Negative route table case: same prefix\n+AT_CHECK([ovn-nbctl --route-table=rtb1 lr-route-add lr0 0.0.0.0/0 192.168.0.1], [1], [], [dnl\n+ovn-nbctl: duplicate prefix: 0.0.0.0/0 (policy: dst-ip). Use option --ecmp to allow this for ECMP routing.\n+])\n+\n+# Negative route table case: same prefix & nexthop with ecmp\n+AT_CHECK([ovn-nbctl --ecmp --route-table=rtb1 lr-route-add lr0 0.0.0.0/0 192.168.0.2], [1], [], [dnl\n+ovn-nbctl: duplicate nexthop for the same ECMP route\n+])\n+\n+# Add routes to <main> route table\n+check ovn-nbctl lrp-add lr0 lrp0 00:00:00:00:00:01 1.1.1.1/24\n+check ovn-nbctl lrp-set-options lrp0 route_table=rtb1\n+AT_CHECK([ovn-nbctl get logical-router-port lrp0 options:route_table], [0], [dnl\n+rtb1\n+])\n+check `ovn-nbctl show lr0 | grep lrp0 -A3 | grep route_table=rtb1`\n+])\n \n dnl ---------------------------------------------------------------------\n \ndiff --git a/tests/ovn-northd.at b/tests/ovn-northd.at\nindex 3c1a97f73..333793af0 100644\n--- a/tests/ovn-northd.at\n+++ b/tests/ovn-northd.at\n@@ -5430,7 +5430,7 @@ check ovn-nbctl --wait=sb --ecmp-symmetric-reply lr-route-add lr0 1.0.0.1 192.16\n \n ovn-sbctl dump-flows lr0 > lr0flows\n AT_CHECK([grep -e \"lr_in_ip_routing.*select\" lr0flows | sed 's/table=../table=??/' | sort], [0], [dnl\n-  table=??(lr_in_ip_routing   ), priority=97   , match=(ip4.dst == 1.0.0.1/32), action=(ip.ttl--; flags.loopback = 1; reg8[[0..15]] = 1; reg8[[16..31]] = select(1, 2);)\n+  table=??(lr_in_ip_routing   ), priority=97   , match=(reg7 == 0 && ip4.dst == 1.0.0.1/32), action=(ip.ttl--; flags.loopback = 1; reg8[[0..15]] = 1; reg8[[16..31]] = select(1, 2);)\n ])\n AT_CHECK([grep -e \"lr_in_ip_routing_ecmp\" lr0flows | sed 's/192\\.168\\.0\\..0/192.168.0.??/' | sed 's/table=../table=??/' | sort], [0], [dnl\n   table=??(lr_in_ip_routing_ecmp), priority=100  , match=(reg8[[0..15]] == 1 && reg8[[16..31]] == 1), action=(reg0 = 192.168.0.??; reg1 = 192.168.0.1; eth.src = 00:00:20:20:12:13; outport = \"lr0-public\"; next;)\n@@ -5443,7 +5443,7 @@ check ovn-nbctl --wait=sb --ecmp-symmetric-reply lr-route-add lr0 1.0.0.1 192.16\n \n ovn-sbctl dump-flows lr0 > lr0flows\n AT_CHECK([grep -e \"lr_in_ip_routing.*select\" lr0flows | sed 's/table=../table=??/' | sort], [0], [dnl\n-  table=??(lr_in_ip_routing   ), priority=97   , match=(ip4.dst == 1.0.0.1/32), action=(ip.ttl--; flags.loopback = 1; reg8[[0..15]] = 1; reg8[[16..31]] = select(1, 2);)\n+  table=??(lr_in_ip_routing   ), priority=97   , match=(reg7 == 0 && ip4.dst == 1.0.0.1/32), action=(ip.ttl--; flags.loopback = 1; reg8[[0..15]] = 1; reg8[[16..31]] = select(1, 2);)\n ])\n AT_CHECK([grep -e \"lr_in_ip_routing_ecmp\" lr0flows | sed 's/192\\.168\\.0\\..0/192.168.0.??/' | sed 's/table=../table=??/' | sort], [0], [dnl\n   table=??(lr_in_ip_routing_ecmp), priority=100  , match=(reg8[[0..15]] == 1 && reg8[[16..31]] == 1), action=(reg0 = 192.168.0.??; reg1 = 192.168.0.1; eth.src = 00:00:20:20:12:13; outport = \"lr0-public\"; next;)\n@@ -5458,14 +5458,14 @@ check ovn-nbctl --wait=sb lr-route-add lr0 1.0.0.0/24 192.168.0.10\n ovn-sbctl dump-flows lr0 > lr0flows\n \n AT_CHECK([grep -e \"lr_in_ip_routing.*192.168.0.10\" lr0flows | sed 's/table=../table=??/' | sort], [0], [dnl\n-  table=??(lr_in_ip_routing   ), priority=73   , match=(ip4.dst == 1.0.0.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = 192.168.0.10; reg1 = 192.168.0.1; eth.src = 00:00:20:20:12:13; outport = \"lr0-public\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=73   , match=(reg7 == 0 && ip4.dst == 1.0.0.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = 192.168.0.10; reg1 = 192.168.0.1; eth.src = 00:00:20:20:12:13; outport = \"lr0-public\"; flags.loopback = 1; next;)\n ])\n \n check ovn-nbctl --wait=sb lr-route-add lr0 2.0.0.0/24 lr0-public\n \n ovn-sbctl dump-flows lr0 > lr0flows\n AT_CHECK([grep -e \"lr_in_ip_routing.*2.0.0.0\" lr0flows | sed 's/table=../table=??/' | sort], [0], [dnl\n-  table=??(lr_in_ip_routing   ), priority=73   , match=(ip4.dst == 2.0.0.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = ip4.dst; reg1 = 192.168.0.1; eth.src = 00:00:20:20:12:13; outport = \"lr0-public\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=73   , match=(reg7 == 0 && ip4.dst == 2.0.0.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = ip4.dst; reg1 = 192.168.0.1; eth.src = 00:00:20:20:12:13; outport = \"lr0-public\"; flags.loopback = 1; next;)\n ])\n \n AT_CLEANUP\n@@ -5655,3 +5655,69 @@ ct_dnat /* assuming no un-dnat entry, so no change */ /* default (use --ct to cu\n \n AT_CLEANUP\n ])\n+\n+AT_SETUP([route tables -- flows])\n+AT_KEYWORDS([route-tables-flows])\n+ovn_start\n+\n+check ovn-nbctl lr-add lr0\n+check ovn-nbctl lrp-add lr0 lrp0 00:00:00:00:00:01 192.168.0.1/24\n+check ovn-nbctl lrp-add lr0 lrp1 00:00:00:00:01:01 192.168.1.1/24\n+check ovn-nbctl lrp-add lr0 lrp2 00:00:00:00:02:01 192.168.2.1/24\n+check ovn-nbctl lrp-set-options lrp1 route_table=rtb-1\n+check ovn-nbctl lrp-set-options lrp2 route_table=rtb-2\n+\n+check ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.10\n+check ovn-nbctl --route-table=rtb-1 lr-route-add lr0 192.168.0.0/24 192.168.1.10\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 0.0.0.0/0 192.168.0.10\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 1.1.1.1/32 192.168.0.20\n+check ovn-nbctl --route-table=rtb-2 lr-route-add lr0 2.2.2.2/32 192.168.0.30\n+check ovn-nbctl --route-table=rtb-2 --ecmp lr-route-add lr0 2.2.2.2/32 192.168.0.31\n+check ovn-nbctl --wait=sb sync\n+\n+ovn-sbctl dump-flows lr0 > lr0flows\n+AT_CAPTURE_FILE([lr0flows])\n+\n+AT_CHECK([grep -e \"lr_in_ip_routing_pre.*match=(1)\" lr0flows | sed 's/table=../table=??/'], [0], [dnl\n+  table=??(lr_in_ip_routing_pre), priority=0    , match=(1), action=(reg7 = 0; next;)\n+])\n+\n+p1_reg=$(grep -oP \"lr_in_ip_routing_pre.*lrp1.*action=\\(reg7 = \\K.\" lr0flows)\n+p2_reg=$(grep -oP \"lr_in_ip_routing_pre.*lrp2.*action=\\(reg7 = \\K.\" lr0flows)\n+echo $p1_reg\n+echo $p2_reg\n+\n+# exact register values are not predictable\n+if [[ $p1_reg -eq 2 ] && [ $p2_reg -eq 1 ]]; then\n+  echo \"swap reg values in dump\"\n+  sed -i -r s'/^(.*lrp2.*action=\\(reg7 = )(1)(.*)/\\12\\3/g' lr0flows  # \"reg7 = 1\" -> \"reg7 = 2\"\n+  sed -i -r s'/^(.*lrp1.*action=\\(reg7 = )(2)(.*)/\\11\\3/g' lr0flows  # \"reg7 = 2\" -> \"reg7 = 1\"\n+  sed -i -r s'/^(.*match=\\(reg7 == )(2)( &&.*lrp1.*)/\\11\\3/g' lr0flows  # \"reg7 == 2\" -> \"reg7 == 1\"\n+  sed -i -r s'/^(.*match=\\(reg7 == )(1)( &&.*lrp0.*)/\\12\\3/g' lr0flows  # \"reg7 == 1\" -> \"reg7 == 2\"\n+fi\n+\n+check test \"$p1_reg\" != \"$p2_reg\" -a $((p1_reg * p2_reg)) -eq 2\n+\n+AT_CHECK([grep \"lr_in_ip_routing_pre\" lr0flows | sed 's/table=../table=??/' | sort], [0], [dnl\n+  table=??(lr_in_ip_routing_pre), priority=0    , match=(1), action=(reg7 = 0; next;)\n+  table=??(lr_in_ip_routing_pre), priority=100  , match=(inport == \"lrp1\"), action=(reg7 = 1; next;)\n+  table=??(lr_in_ip_routing_pre), priority=100  , match=(inport == \"lrp2\"), action=(reg7 = 2; next;)\n+])\n+\n+grep -e \"(lr_in_ip_routing   ).*outport\" lr0flows\n+\n+AT_CHECK([grep -e \"(lr_in_ip_routing   ).*outport\" lr0flows | sed 's/table=../table=??/' | sort], [0], [dnl\n+  table=??(lr_in_ip_routing   ), priority=1    , match=(reg7 == 0 && ip4.dst == 0.0.0.0/0), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = 192.168.0.10; reg1 = 192.168.0.1; eth.src = 00:00:00:00:00:01; outport = \"lrp0\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=1    , match=(reg7 == 2 && ip4.dst == 0.0.0.0/0), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = 192.168.0.10; reg1 = 192.168.0.1; eth.src = 00:00:00:00:00:01; outport = \"lrp0\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=194  , match=(inport == \"lrp0\" && ip6.dst == fe80::/64), action=(ip.ttl--; reg8[[0..15]] = 0; xxreg0 = ip6.dst; xxreg1 = fe80::200:ff:fe00:1; eth.src = 00:00:00:00:00:01; outport = \"lrp0\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=194  , match=(inport == \"lrp1\" && ip6.dst == fe80::/64), action=(ip.ttl--; reg8[[0..15]] = 0; xxreg0 = ip6.dst; xxreg1 = fe80::200:ff:fe00:101; eth.src = 00:00:00:00:01:01; outport = \"lrp1\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=194  , match=(inport == \"lrp2\" && ip6.dst == fe80::/64), action=(ip.ttl--; reg8[[0..15]] = 0; xxreg0 = ip6.dst; xxreg1 = fe80::200:ff:fe00:201; eth.src = 00:00:00:00:02:01; outport = \"lrp2\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=73   , match=(reg7 == 1 && ip4.dst == 192.168.0.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = 192.168.1.10; reg1 = 192.168.1.1; eth.src = 00:00:00:00:01:01; outport = \"lrp1\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=74   , match=(ip4.dst == 192.168.0.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = ip4.dst; reg1 = 192.168.0.1; eth.src = 00:00:00:00:00:01; outport = \"lrp0\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=74   , match=(ip4.dst == 192.168.1.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = ip4.dst; reg1 = 192.168.1.1; eth.src = 00:00:00:00:01:01; outport = \"lrp1\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=74   , match=(ip4.dst == 192.168.2.0/24), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = ip4.dst; reg1 = 192.168.2.1; eth.src = 00:00:00:00:02:01; outport = \"lrp2\"; flags.loopback = 1; next;)\n+  table=??(lr_in_ip_routing   ), priority=97   , match=(reg7 == 2 && ip4.dst == 1.1.1.1/32), action=(ip.ttl--; reg8[[0..15]] = 0; reg0 = 192.168.0.20; reg1 = 192.168.0.1; eth.src = 00:00:00:00:00:01; outport = \"lrp0\"; flags.loopback = 1; next;)\n+])\n+\n+AT_CLEANUP\n+])\ndiff --git a/tests/ovn.at b/tests/ovn.at\nindex 51e0dae0b..28e5d679b 100644\n--- a/tests/ovn.at\n+++ b/tests/ovn.at\n@@ -18257,7 +18257,7 @@ eth_dst=00000000ff01\n ip_src=$(ip_to_hex 10 0 0 10)\n ip_dst=$(ip_to_hex 172 168 0 101)\n send_icmp_packet 1 1 $eth_src $eth_dst $ip_src $ip_dst c4c9 0000000000000000000000\n-AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | awk '/table=25, n_packets=1, n_bytes=45/{print $7\" \"$8}'],[0],[dnl\n+AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | awk '/table=26, n_packets=1, n_bytes=45/{print $7\" \"$8}'],[0],[dnl\n priority=80,ip,reg15=0x3,metadata=0x3,nw_src=10.0.0.10 actions=drop\n ])\n \n@@ -22698,6 +22698,538 @@ OVN_CLEANUP([hv1])\n AT_CLEANUP\n ])\n \n+\n+OVN_FOR_EACH_NORTHD([\n+AT_SETUP([route tables -- <main> route table routes])\n+ovn_start\n+\n+# Logical network:\n+# ls1 (192.168.1.0/24) - lrp-lr1-ls1 - lr1 - lrp-lr1-ls2 - ls2 (192.168.2.0/24)\n+#\n+# ls1 has lsp11 (192.168.1.11) and\n+# ls2 has lsp21 (192.168.2.21) and lsp22 (192.168.2.22)\n+#\n+# lrp-lr1-ls1 set options:route_table=rtb-1\n+#\n+# Static routes on lr1:\n+# 0.0.0.0/0 nexthop 192.168.2.21\n+# 1.1.1.1/32 nexthop 192.168.2.22 route_table=rtb-1\n+#\n+# Test 1:\n+# lsp11 send packet to 2.2.2.2\n+#\n+# Expected result:\n+# each port should receive no traffic\n+#\n+# Test 2:\n+# lsp11 send packet to 1.1.1.1\n+#\n+# Expected result:\n+# lsp22 should receive traffic, lsp21 should not\n+#\n+# Test 3:\n+# lsp21 send packet to 1.1.1.1\n+#\n+# Expected result:\n+# lsp11 should receive traffic, lsp21 should not receive any traffic\n+\n+ovn-nbctl lr-add lr1\n+\n+for i in 1 2; do\n+    ovn-nbctl ls-add ls${i}\n+    ovn-nbctl lrp-add lr1 lrp-lr1-ls${i} 00:00:00:01:0${i}:01 192.168.${i}.1/24\n+    ovn-nbctl lsp-add ls${i} lsp-ls${i}-lr1 -- lsp-set-type lsp-ls${i}-lr1 router \\\n+        -- lsp-set-options lsp-ls${i}-lr1 router-port=lrp-lr1-ls${i} \\\n+        -- lsp-set-addresses lsp-ls${i}-lr1 router\n+done\n+\n+# install static routes\n+ovn-nbctl lr-route-add lr1 0.0.0.0/0 192.168.2.21\n+ovn-nbctl --route-table=rtb-1 lr-route-add lr1 1.1.1.1/32 192.168.2.22\n+\n+# set lrp-lr1-ls1 route table\n+ovn-nbctl lrp-set-options lrp-lr1-ls1 route_table=rtb-1\n+\n+# Create logical ports\n+ovn-nbctl lsp-add ls1 lsp11 -- \\\n+    lsp-set-addresses lsp11 \"f0:00:00:00:01:11 192.168.1.11\"\n+ovn-nbctl lsp-add ls2 lsp21 -- \\\n+    lsp-set-addresses lsp21 \"f0:00:00:00:02:21 192.168.2.21\"\n+ovn-nbctl lsp-add ls2 lsp22 -- \\\n+    lsp-set-addresses lsp22 \"f0:00:00:00:02:22 192.168.2.22\"\n+\n+net_add n1\n+sim_add hv1\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.1\n+ovs-vsctl -- add-port br-int hv1-vif1 -- \\\n+    set interface hv1-vif1 external-ids:iface-id=lsp11 \\\n+    options:tx_pcap=hv1/vif1-tx.pcap \\\n+    options:rxq_pcap=hv1/vif1-rx.pcap \\\n+    ofport-request=1\n+\n+ovs-vsctl -- add-port br-int hv1-vif2 -- \\\n+    set interface hv1-vif2 external-ids:iface-id=lsp21 \\\n+    options:tx_pcap=hv1/vif2-tx.pcap \\\n+    options:rxq_pcap=hv1/vif2-rx.pcap \\\n+    ofport-request=2\n+\n+ovs-vsctl -- add-port br-int hv1-vif3 -- \\\n+    set interface hv1-vif3 external-ids:iface-id=lsp22 \\\n+    options:tx_pcap=hv1/vif3-tx.pcap \\\n+    options:rxq_pcap=hv1/vif3-rx.pcap \\\n+    ofport-request=3\n+\n+# wait for earlier changes to take effect\n+check ovn-nbctl --wait=hv sync\n+wait_for_ports_up\n+\n+# Test 1\n+packet=\"inport==\\\"lsp11\\\" && eth.src==f0:00:00:00:01:11 && eth.dst==00:00:00:01:01:01 &&\n+        ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==2.2.2.2 && icmp\"\n+AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+# Assume no packets go neither to lsp21 nor to lsp22.\n+> expected_lsp21\n+> expected_lsp22\n+\n+ovn-sbctl dump-flows lr1\n+\n+\n+OVS_WAIT_UNTIL([\n+    rcv_n1=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l`\n+    rcv_n2=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif3-tx.pcap > lsp22.packets && cat lsp22.packets | wc -l`\n+    echo $rcv_n1 $rcv_n2\n+    test $rcv_n1 -eq 0 -a $rcv_n2 -eq 0])\n+\n+for i in 1 2; do\n+    sort expected_lsp2$i > expout\n+    AT_CHECK([cat lsp2${i}.packets | sort], [0], [expout])\n+done\n+\n+# cleanup pcap\n+for i in 2 3; do\n+    ovs-vsctl remove interface hv1-vif$i options tx_pcap\n+    > hv1/vif$i-tx.pcap\n+    ovs-vsctl set interface hv1-vif$i options:tx_pcap=hv1/vif$i-tx.pcap\n+done\n+\n+# Test 2\n+packet=\"inport==\\\"lsp11\\\" && eth.src==f0:00:00:00:01:11 && eth.dst==00:00:00:01:01:01 &&\n+        ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==1.1.1.1 && icmp\"\n+AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+# Assume all packets go to lsp22.\n+exp_packet=\"eth.src==00:00:00:01:02:01 && eth.dst==f0:00:00:00:02:22 &&\n+        ip4 && ip.ttl==63 && ip4.src==192.168.1.11 && ip4.dst==1.1.1.1 && icmp\"\n+echo $exp_packet | ovstest test-ovn expr-to-packets > expected_lsp22\n+> expected_lsp21\n+\n+# lsp21 should recieve 1 packet and lsp22 should recieve no packets\n+OVS_WAIT_UNTIL([\n+    rcv_n1=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l`\n+    rcv_n2=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif3-tx.pcap > lsp22.packets && cat lsp22.packets | wc -l`\n+    echo $rcv_n1 $rcv_n2\n+    test $rcv_n1 -eq 0 -a $rcv_n2 -eq 1])\n+\n+for i in 1 2; do\n+    sort expected_lsp2$i > expout\n+    AT_CHECK([cat lsp2${i}.packets | sort], [0], [expout])\n+done\n+\n+# cleanup pcap\n+for i in 2 3; do\n+    ovs-vsctl remove interface hv1-vif$i options tx_pcap\n+    > hv1/vif$i-tx.pcap\n+    ovs-vsctl set interface hv1-vif$i options:tx_pcap=hv1/vif$i-tx.pcap\n+done\n+\n+# Test 3\n+packet=\"inport==\\\"lsp21\\\" && eth.src==f0:00:00:00:02:21 && eth.dst==00:00:00:01:02:01 &&\n+        ip4 && ip.ttl==64 && ip4.src==192.168.2.21 && ip4.dst==2.2.2.2 && icmp\"\n+AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+# Assume all packets go to lsp21.\n+exp_packet=\"eth.src==00:00:00:01:02:01 && eth.dst==f0:00:00:00:02:21 &&\n+        ip4 && ip.ttl==63 && ip4.src==192.168.2.21 && ip4.dst==2.2.2.2 && icmp\"\n+echo $exp_packet | ovstest test-ovn expr-to-packets > expected_lsp21\n+> expected_lsp22\n+\n+# lsp21 should recieve 1 packet and lsp22 should recieve no packets\n+OVS_WAIT_UNTIL([\n+    rcv_n1=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l`\n+    rcv_n2=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif3-tx.pcap > lsp22.packets && cat lsp22.packets | wc -l`\n+    echo $rcv_n1 $rcv_n2\n+    test $rcv_n1 -eq 1 -a $rcv_n2 -eq 0])\n+\n+for i in 1 2; do\n+    sort expected_lsp2$i > expout\n+    AT_CHECK([cat lsp2${i}.packets | sort], [0], [expout])\n+done\n+\n+OVN_CLEANUP([hv1])\n+AT_CLEANUP\n+])\n+\n+\n+OVN_FOR_EACH_NORTHD([\n+AT_SETUP([route tables -- directly connected routes])\n+ovn_start\n+\n+# Logical network:\n+# ls1 (192.168.1.0/24) - lrp-lr1-ls1 - lr1 - lrp-lr1-ls2 - ls2 (192.168.2.0/24)\n+#\n+# ls1 has lsp11 (192.168.1.11) and ls2 has lsp21 (192.168.2.21)\n+#\n+# lrp-lr1-ls1 set options:route_table=rtb-1\n+#\n+# Static routes on lr1:\n+# 192.168.2.128/25 nexthop 192.168.1.11 route_table=rtb-1\n+#\n+# Test 1:\n+# lsp11 send packet to 192.168.2.21\n+#\n+# Expected result:\n+# lsp21 should receive traffic, lsp11 should not receive any traffic\n+#\n+# Test 2:\n+# lsp11 send packet to 192.168.2.200\n+#\n+# Expected result:\n+# lsp11 should receive traffic, lsp21 should not receive any traffic\n+\n+ovn-nbctl lr-add lr1\n+\n+for i in 1 2; do\n+    ovn-nbctl ls-add ls${i}\n+    ovn-nbctl lrp-add lr1 lrp-lr1-ls${i} 00:00:00:01:0${i}:01 192.168.${i}.1/24\n+    ovn-nbctl lsp-add ls${i} lsp-ls${i}-lr1 -- lsp-set-type lsp-ls${i}-lr1 router \\\n+        -- lsp-set-options lsp-ls${i}-lr1 router-port=lrp-lr1-ls${i} \\\n+        -- lsp-set-addresses lsp-ls${i}-lr1 router\n+done\n+\n+# install static route, which is more specific than directly-connected route\n+ovn-nbctl --route-table=rtb-1 lr-route-add lr1 192.168.2.128/25 192.168.1.11\n+\n+# set lrp-lr1-ls1 route table\n+ovn-nbctl lrp-set-options lrp-lr1-ls1 route_table=rtb-1\n+\n+# Create logical ports\n+ovn-nbctl lsp-add ls1 lsp11 -- \\\n+    lsp-set-addresses lsp11 \"f0:00:00:00:01:11 192.168.1.11\"\n+ovn-nbctl lsp-add ls2 lsp21 -- \\\n+    lsp-set-addresses lsp21 \"f0:00:00:00:02:21 192.168.2.21\"\n+\n+net_add n1\n+sim_add hv1\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.1\n+ovs-vsctl -- add-port br-int hv1-vif1 -- \\\n+    set interface hv1-vif1 external-ids:iface-id=lsp11 \\\n+    options:tx_pcap=hv1/vif1-tx.pcap \\\n+    options:rxq_pcap=hv1/vif1-rx.pcap \\\n+    ofport-request=1\n+\n+ovs-vsctl -- add-port br-int hv1-vif2 -- \\\n+    set interface hv1-vif2 external-ids:iface-id=lsp21 \\\n+    options:tx_pcap=hv1/vif2-tx.pcap \\\n+    options:rxq_pcap=hv1/vif2-rx.pcap \\\n+    ofport-request=2\n+\n+# wait for earlier changes to take effect\n+check ovn-nbctl --wait=hv sync\n+wait_for_ports_up\n+\n+# test 1\n+packet=\"inport==\\\"lsp11\\\" && eth.src==f0:00:00:00:01:11 && eth.dst==00:00:00:01:01:01 &&\n+        ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==192.168.2.21 && icmp\"\n+AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+# Assume all packets go to lsp21.\n+exp_packet=\"eth.src==00:00:00:01:02:01 && eth.dst==f0:00:00:00:02:21 && ip4 &&\n+            ip.ttl==63 && ip4.src==192.168.1.11 && ip4.dst==192.168.2.21 && icmp\"\n+echo $exp_packet | ovstest test-ovn expr-to-packets > expected_lsp21\n+> expected_lsp11\n+\n+# lsp21 should recieve 1 icmp packet and lsp11 should recieve no packets\n+OVS_WAIT_UNTIL([\n+    rcv_n11=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif1-tx.pcap > lsp11.packets && cat lsp11.packets | wc -l`\n+    rcv_n21=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l`\n+    echo $rcv_n11 $rcv_n21\n+    test $rcv_n11 -eq 0 -a $rcv_n21 -eq 1])\n+\n+for i in 11 21; do\n+    sort expected_lsp$i > expout\n+    AT_CHECK([cat lsp${i}.packets | sort], [0], [expout])\n+done\n+\n+for i in 11 21; do\n+    > lsp${i}.packets\n+done\n+\n+# flush tx pcaps:\n+ovs-vsctl remove interface hv1-vif1 options tx_pcap\n+ovs-vsctl remove interface hv1-vif2 options tx_pcap\n+rm -f hv1/vif1-tx.pcap hv1/vif2-tx.pcap\n+ovs-vsctl set interface hv1-vif1 options:tx_pcap=hv1/vif1-tx.pcap\n+ovs-vsctl set interface hv1-vif2 options:tx_pcap=hv1/vif2-tx.pcap\n+\n+# test 2\n+packet=\"inport==\\\"lsp11\\\" && eth.src==f0:00:00:00:01:11 && eth.dst==00:00:00:01:01:01 &&\n+        ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==192.168.2.200 && icmp\"\n+AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+# Assume all packets go to lsp11.\n+exp_packet=\"eth.src==00:00:00:01:01:01 && eth.dst==f0:00:00:00:01:11 && ip4 &&\n+            ip.ttl==63 && ip4.src==192.168.1.11 && ip4.dst==192.168.2.200 && icmp\"\n+echo $exp_packet | ovstest test-ovn expr-to-packets > expected_lsp11\n+> expected_lsp21\n+\n+# lsp11 should recieve 1 icmp packet and lsp21 should recieve no packets\n+OVS_WAIT_UNTIL([\n+    rcv_n11=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif1-tx.pcap > lsp11.packets && cat lsp11.packets | wc -l`\n+    rcv_n21=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l`\n+    echo $rcv_n11 $rcv_n21\n+    test $rcv_n11 -eq 1 -a $rcv_n21 -eq 0])\n+\n+for i in 11 21; do\n+    echo I=$i\n+    sort expected_lsp$i > expout\n+    AT_CHECK([cat lsp${i}.packets | sort], [0], [expout])\n+done\n+\n+OVN_CLEANUP([hv1])\n+AT_CLEANUP\n+])\n+\n+\n+OVN_FOR_EACH_NORTHD([\n+AT_SETUP([route tables -- overlapping subnets])\n+ovn_start\n+\n+# Logical network:\n+#\n+# ls1 (192.168.1.0/24) - lrp-lr1-ls1 -\\   /- lrp-lr1-ls2 - ls2 (192.168.2.0/24)\n+#                                      lr1\n+# ls3 (192.168.3.0/24) - lrp-lr1-ls3 -/   \\- lrp-lr1-ls4 - ls4 (192.168.4.0/24)\n+#\n+# ls1 has lsp11 (192.168.1.11)\n+# ls2 has lsp21 (192.168.2.21)\n+# ls3 has lsp31 (192.168.3.31)\n+# ls4 has lsp41 (192.168.4.41)\n+#\n+# lrp-lr1-ls1 set options:route_table=rtb-1\n+#\n+# Static routes on lr1:\n+# 10.0.0.0/24 nexthop 192.168.3.31 route_table=rtb-1\n+# 10.0.0.0/24 nexthop 192.168.4.41 (<main> route table)\n+#\n+# Test 1:\n+# lsp11 send packet to 10.0.0.1\n+#\n+# Expected result:\n+# lsp31 should receive traffic, lsp41 should not receive any traffic\n+#\n+# Test 2:\n+# lsp21 send packet to 10.0.0.1\n+#\n+# Expected result:\n+# lsp41 should receive traffic, lsp31 should not receive any traffic\n+\n+ovn-nbctl lr-add lr1\n+\n+# Create logical topology\n+for i in $(seq 1 4); do\n+    ovn-nbctl ls-add ls${i}\n+    ovn-nbctl lrp-add lr1 lrp-lr1-ls${i} 00:00:00:01:0${i}:01 192.168.${i}.1/24\n+    ovn-nbctl lsp-add ls${i} lsp-ls${i}-lr1 -- lsp-set-type lsp-ls${i}-lr1 router \\\n+        -- lsp-set-options lsp-ls${i}-lr1 router-port=lrp-lr1-ls${i} \\\n+        -- lsp-set-addresses lsp-ls${i}-lr1 router\n+    ovn-nbctl lsp-add ls$i lsp${i}1 -- \\\n+        lsp-set-addresses lsp${i}1 \"f0:00:00:00:0${i}:1${i} 192.168.${i}.${i}1\"\n+done\n+\n+# install static routes\n+ovn-nbctl --route-table=rtb-1 lr-route-add lr1 10.0.0.0/24 192.168.3.31\n+ovn-nbctl lr-route-add lr1 10.0.0.0/24 192.168.4.41\n+\n+# set lrp-lr1-ls1 route table\n+ovn-nbctl lrp-set-options lrp-lr1-ls1 route_table=rtb-1\n+\n+net_add n1\n+sim_add hv1\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.1\n+\n+for i in $(seq 1 4); do\n+    ovs-vsctl -- add-port br-int hv1-vif${i} -- \\\n+        set interface hv1-vif${i} external-ids:iface-id=lsp${i}1 \\\n+        options:tx_pcap=hv1/vif${i}-tx.pcap \\\n+        options:rxq_pcap=hv1/vif${i}-rx.pcap \\\n+        ofport-request=${i}\n+done\n+\n+# wait for earlier changes to take effect\n+check ovn-nbctl --wait=hv sync\n+wait_for_ports_up\n+\n+# lsp31 should recieve packet coming from lsp11\n+# lsp41 should recieve packet coming from lsp21\n+for i in $(seq 1 2); do\n+    di=$(( i + 2))  # dst index\n+    ri=$(( 5 - i))  # reverse index\n+    packet=\"inport==\\\"lsp${i}1\\\" && eth.src==f0:00:00:00:0${i}:1${i} &&\n+            eth.dst==00:00:00:01:0${i}:01 && ip4 && ip.ttl==64 &&\n+            ip4.src==192.168.${i}.${i}1 && ip4.dst==10.0.0.1 && icmp\"\n+    AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+    # Assume all packets go to lsp${di}1.\n+    exp_packet=\"eth.src==00:00:00:01:0${di}:01 && eth.dst==f0:00:00:00:0${di}:1${di} &&\n+            ip4 && ip.ttl==63 && ip4.src==192.168.${i}.${i}1 && ip4.dst==10.0.0.1 && icmp\"\n+    echo $exp_packet | ovstest test-ovn expr-to-packets >> expected_lsp${di}1\n+    > expected_lsp${ri}1\n+\n+    OVS_WAIT_UNTIL([\n+        rcv_n1=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif${di}-tx.pcap > lsp${di}1.packets && cat lsp${di}1.packets | wc -l`\n+        rcv_n2=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif${ri}-tx.pcap > lsp${ri}1.packets && cat lsp${ri}1.packets | wc -l`\n+        echo $rcv_n1 $rcv_n2\n+        test $rcv_n1 -eq 1 -a $rcv_n2 -eq 0])\n+\n+    for j in \"${di}1\" \"${ri}1\"; do\n+        sort expected_lsp${j} > expout\n+        AT_CHECK([cat lsp${j}.packets | sort], [0], [expout])\n+    done\n+\n+    # cleanup tx pcap files\n+    for j in \"${di}1\" \"${ri}1\"; do\n+        ovs-vsctl -- remove interface hv1-vif${di} options tx_pcap\n+        > hv1/vif${di}-tx.pcap\n+        ovs-vsctl -- set interface hv1-vif${di} external-ids:iface-id=lsp${di}1 \\\n+            options:tx_pcap=hv1/vif${di}-tx.pcap\n+    done\n+done\n+\n+OVN_CLEANUP([hv1])\n+AT_CLEANUP\n+])\n+\n+\n+OVN_FOR_EACH_NORTHD([\n+AT_SETUP([route tables IPv6 -- overlapping subnets])\n+ovn_start\n+\n+# Logical network:\n+#\n+# ls1 (2001:db8:1::/64) - lrp-lr1-ls1 -\\   /- lrp-lr1-ls2 - ls2 (2001:db8:2::/64)\n+#                                       lr1\n+# ls3 (2001:db8:3::/64) - lrp-lr1-ls3 -/   \\- lrp-lr1-ls4 - ls4 (2001:db8:4::/64)\n+#\n+# ls1 has lsp11 (2001:db8:1::11)\n+# ls2 has lsp21 (2001:db8:2::21)\n+# ls3 has lsp31 (2001:db8:3::31)\n+# ls4 has lsp41 (2001:db8:4::41)\n+#\n+# lrp-lr1-ls1 set options:route_table=rtb-1\n+# lrp-lr1-ls2 set options:route_table=rtb-2\n+#\n+# Static routes on lr1:\n+# 2001:db8:2000::/64 nexthop 2001:db8:3::31 route_table=rtb-1\n+# 2001:db8:2000::/64 nexthop 2001:db8:3::41 route_table=rtb-2\n+#\n+# Test 1:\n+# lsp11 send packet to 2001:db8:2000::1\n+#\n+# Expected result:\n+# lsp31 should receive traffic, lsp41 should not receive any traffic\n+#\n+# Test 2:\n+# lsp21 send packet to 2001:db8:2000::1\n+#\n+# Expected result:\n+# lsp41 should receive traffic, lsp31 should not receive any traffic\n+\n+ovn-nbctl lr-add lr1\n+\n+# Create logical topology\n+for i in $(seq 1 4); do\n+    ovn-nbctl ls-add ls${i}\n+    ovn-nbctl lrp-add lr1 lrp-lr1-ls${i} 00:00:00:01:0${i}:01 2001:db8:${i}::1/64\n+    ovn-nbctl lsp-add ls${i} lsp-ls${i}-lr1 -- lsp-set-type lsp-ls${i}-lr1 router \\\n+        -- lsp-set-options lsp-ls${i}-lr1 router-port=lrp-lr1-ls${i} \\\n+        -- lsp-set-addresses lsp-ls${i}-lr1 router\n+    ovn-nbctl lsp-add ls$i lsp${i}1 -- \\\n+        lsp-set-addresses lsp${i}1 \"f0:00:00:00:0${i}:1${i} 2001:db8:${i}::${i}1\"\n+done\n+\n+# install static routes\n+ovn-nbctl --route-table=rtb-1 lr-route-add lr1 2001:db8:2000::/64 2001:db8:3::31\n+ovn-nbctl --route-table=rtb-2 lr-route-add lr1 2001:db8:2000::/64 2001:db8:4::41\n+\n+# set lrp-lr1-ls{1,2} route tables\n+ovn-nbctl lrp-set-options lrp-lr1-ls1 route_table=rtb-1\n+ovn-nbctl lrp-set-options lrp-lr1-ls2 route_table=rtb-2\n+\n+net_add n1\n+sim_add hv1\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.1\n+\n+for i in $(seq 1 4); do\n+    ovs-vsctl -- add-port br-int hv1-vif${i} -- \\\n+        set interface hv1-vif${i} external-ids:iface-id=lsp${i}1 \\\n+        options:tx_pcap=hv1/vif${i}-tx.pcap \\\n+        options:rxq_pcap=hv1/vif${i}-rx.pcap \\\n+        ofport-request=${i}\n+done\n+\n+# wait for earlier changes to take effect\n+AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync], [0], [ignore])\n+\n+# lsp31 should recieve packet coming from lsp11\n+# lsp41 should recieve packet coming from lsp21\n+for i in $(seq 1 2); do\n+    di=$(( i + 2))  # dst index\n+    ri=$(( 5 - i))  # reverse index\n+    packet=\"inport==\\\"lsp${i}1\\\" && eth.src==f0:00:00:00:0${i}:1${i} &&\n+            eth.dst==00:00:00:01:0${i}:01 && ip6 && ip.ttl==64 &&\n+            ip6.src==2001:db8:${i}::${i}1 && ip6.dst==2001:db8:2000::1 && icmp6\"\n+    AT_CHECK([as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"])\n+\n+    # Assume all packets go to lsp${di}1.\n+    exp_packet=\"eth.src==00:00:00:01:0${di}:01 && eth.dst==f0:00:00:00:0${di}:1${di} && ip6 &&\n+                ip.ttl==63 && ip6.src==2001:db8:${i}::${i}1 && ip6.dst==2001:db8:2000::1 && icmp6\"\n+    echo $exp_packet | ovstest test-ovn expr-to-packets >> expected_lsp${di}1\n+    > expected_lsp${ri}1\n+\n+    OVS_WAIT_UNTIL([\n+        rcv_n1=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif${di}-tx.pcap > lsp${di}1.packets && cat lsp${di}1.packets | wc -l`\n+        rcv_n2=`$PYTHON \"$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif${ri}-tx.pcap > lsp${ri}1.packets && cat lsp${ri}1.packets | wc -l`\n+        echo $rcv_n1 $rcv_n2\n+        test $rcv_n1 -eq 1 -a $rcv_n2 -eq 0])\n+\n+    for j in \"${di}1\" \"${ri}1\"; do\n+        sort expected_lsp${j} > expout\n+        AT_CHECK([cat lsp${j}.packets | sort], [0], [expout])\n+    done\n+\n+    # cleanup tx pcap files\n+    for j in \"${di}1\" \"${ri}1\"; do\n+        ovs-vsctl -- remove interface hv1-vif${di} options tx_pcap\n+        > hv1/vif${di}-tx.pcap\n+        ovs-vsctl -- set interface hv1-vif${di} external-ids:iface-id=lsp${di}1 \\\n+            options:tx_pcap=hv1/vif${di}-tx.pcap\n+    done\n+done\n+\n+OVN_CLEANUP([hv1])\n+AT_CLEANUP\n+])\n+\n+\n OVN_FOR_EACH_NORTHD([\n AT_SETUP([forwarding group: 3 HVs, 1 LR, 2 LS])\n AT_KEYWORDS([forwarding-group])\n@@ -23453,7 +23985,7 @@ ovn-sbctl dump-flows > sbflows\n AT_CAPTURE_FILE([sbflows])\n AT_CAPTURE_FILE([offlows])\n OVS_WAIT_UNTIL([\n-    as hv1 ovs-ofctl dump-flows br-int table=20 > offlows\n+    as hv1 ovs-ofctl dump-flows br-int table=21 > offlows\n     test $(grep -c \"load:0x64->NXM_NX_PKT_MARK\" offlows) = 1 && \\\n     test $(grep -c \"load:0x3->NXM_NX_PKT_MARK\" offlows) = 1 && \\\n     test $(grep -c \"load:0x4->NXM_NX_PKT_MARK\" offlows) = 1 && \\\n@@ -23546,12 +24078,12 @@ send_ipv4_pkt hv1 hv1-vif1 505400000003 00000000ff01 \\\n     $(ip_to_hex 10 0 0 3) $(ip_to_hex 172 168 0 120)\n \n OVS_WAIT_UNTIL([\n-    test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \\\n+    test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=21 | \\\n     grep \"load:0x2->NXM_NX_PKT_MARK\" -c)\n ])\n \n AT_CHECK([\n-    test 0 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \\\n+    test 0 -eq $(as hv1 ovs-ofctl dump-flows br-int table=21 | \\\n     grep \"load:0x64->NXM_NX_PKT_MARK\" -c)\n ])\n \n@@ -24278,7 +24810,7 @@ AT_CHECK([\n         grep \"priority=100\" | \\\n         grep -c \"ct(commit,zone=NXM_NX_REG11\\\\[[0..15\\\\]],.*exec(move:NXM_OF_ETH_SRC\\\\[[\\\\]]->NXM_NX_CT_LABEL\\\\[[32..79\\\\]],load:0x[[0-9]]->NXM_NX_CT_LABEL\\\\[[80..95\\\\]]))\"\n \n-        grep table=22 hv${hv}flows | \\\n+        grep table=23 hv${hv}flows | \\\n         grep \"priority=200\" | \\\n         grep -c \"actions=move:NXM_NX_CT_LABEL\\\\[[32..79\\\\]]->NXM_OF_ETH_DST\\\\[[\\\\]]\"\n     done; :], [0], [dnl\n@@ -24403,7 +24935,7 @@ AT_CHECK([\n         grep \"priority=100\" | \\\n         grep -c \"ct(commit,zone=NXM_NX_REG11\\\\[[0..15\\\\]],.*exec(move:NXM_OF_ETH_SRC\\\\[[\\\\]]->NXM_NX_CT_LABEL\\\\[[32..79\\\\]],load:0x[[0-9]]->NXM_NX_CT_LABEL\\\\[[80..95\\\\]]))\"\n \n-        grep table=22 hv${hv}flows | \\\n+        grep table=23 hv${hv}flows | \\\n         grep \"priority=200\" | \\\n         grep -c \"actions=move:NXM_NX_CT_LABEL\\\\[[32..79\\\\]]->NXM_OF_ETH_DST\\\\[[\\\\]]\"\n     done; :], [0], [dnl\n@@ -25025,7 +25557,7 @@ AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep \"actions=controller\" | grep\n ])\n \n # The packet should've been dropped in the lr_in_arp_resolve stage.\n-AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep -E \"table=22, n_packets=1,.* priority=1,ip,metadata=0x${sw_key},nw_dst=10.0.1.1 actions=drop\" -c], [0], [dnl\n+AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep -E \"table=23, n_packets=1,.* priority=1,ip,metadata=0x${sw_key},nw_dst=10.0.1.1 actions=drop\" -c], [0], [dnl\n 1\n ])\n \ndiff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c\nindex 2a68ccd16..8bdcb19a3 100644\n--- a/utilities/ovn-nbctl.c\n+++ b/utilities/ovn-nbctl.c\n@@ -329,6 +329,8 @@ Logical router port commands:\\n\\\n                             add logical port PORT on ROUTER\\n\\\n   lrp-set-gateway-chassis PORT CHASSIS [PRIORITY]\\n\\\n                             set gateway chassis for port PORT\\n\\\n+  lrp-set-options PORT KEY=VALUE [KEY=VALUE]...\\n\\\n+                            set router port options\\n\\\n   lrp-del-gateway-chassis PORT CHASSIS\\n\\\n                             delete gateway chassis from port PORT\\n\\\n   lrp-get-gateway-chassis PORT\\n\\\n@@ -351,11 +353,17 @@ Logical router port commands:\\n\\\n                             ('overlay' or 'bridged')\\n\\\n \\n\\\n Route commands:\\n\\\n-  [--policy=POLICY] [--ecmp] [--ecmp-symmetric-reply] lr-route-add ROUTER \\n\\\n-                            PREFIX NEXTHOP [PORT]\\n\\\n+  [--policy=POLICY]\\n\\\n+  [--ecmp]\\n\\\n+  [--ecmp-symmetric-reply]\\n\\\n+  [--route-table=ROUTE_TABLE]\\n\\\n+  lr-route-add ROUTER PREFIX NEXTHOP [PORT]\\n\\\n                             add a route to ROUTER\\n\\\n-  [--policy=POLICY] lr-route-del ROUTER [PREFIX [NEXTHOP [PORT]]]\\n\\\n+  [--policy=POLICY]\\n\\\n+  [--route-table=ROUTE_TABLE]\\n\\\n+  lr-route-del ROUTER [PREFIX [NEXTHOP [PORT]]]\\n\\\n                             remove routes from ROUTER\\n\\\n+  [--route-table=ROUTE_TABLE]\\n\\\n   lr-route-list ROUTER      print routes for ROUTER\\n\\\n \\n\\\n Policy commands:\\n\\\n@@ -743,6 +751,11 @@ print_lr(const struct nbrec_logical_router *lr, struct ds *s)\n             ds_put_cstr(s, \"]\\n\");\n         }\n \n+        const char *route_table = smap_get(&lrp->options, \"route_table\");\n+        if (route_table) {\n+            ds_put_format(s, \"        route-table: %s\\n\", route_table);\n+        }\n+\n         if (lrp->n_gateway_chassis) {\n             const struct nbrec_gateway_chassis **gcs;\n \n@@ -862,6 +875,7 @@ nbctl_pre_show(struct ctl_context *ctx)\n     ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_name);\n     ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_mac);\n     ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_networks);\n+    ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_options);\n     ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_gateway_chassis);\n \n     ovsdb_idl_add_column(ctx->idl, &nbrec_gateway_chassis_col_chassis_name);\n@@ -4020,11 +4034,19 @@ nbctl_lr_policy_list(struct ctl_context *ctx)\n \n static struct nbrec_logical_router_static_route *\n nbctl_lr_get_route(const struct nbrec_logical_router *lr, char *prefix,\n-                   char *next_hop, bool is_src_route, bool ecmp)\n+                   char *next_hop, bool is_src_route, bool ecmp,\n+                   char *route_table)\n {\n     for (int i = 0; i < lr->n_static_routes; i++) {\n         struct nbrec_logical_router_static_route *route = lr->static_routes[i];\n \n+        /* Strict compare for route_table.\n+         * If route_table was not specified,\n+         * lookup for routes with empty route_table value. */\n+        if (strcmp(route->route_table, route_table ? route_table : \"\")) {\n+            continue;\n+        }\n+\n         /* Compare route policy. */\n         char *nb_policy = route->policy;\n         bool nb_is_src_route = false;\n@@ -4080,6 +4102,8 @@ nbctl_pre_lr_route_add(struct ctl_context *ctx)\n                          &nbrec_logical_router_static_route_col_bfd);\n     ovsdb_idl_add_column(ctx->idl,\n                          &nbrec_logical_router_static_route_col_options);\n+    ovsdb_idl_add_column(ctx->idl,\n+                         &nbrec_logical_router_static_route_col_route_table);\n }\n \n static char * OVS_WARN_UNUSED_RESULT\n@@ -4110,6 +4134,7 @@ nbctl_lr_route_add(struct ctl_context *ctx)\n         }\n     }\n \n+    char *route_table = shash_find_data(&ctx->options, \"--route-table\");\n     bool v6_prefix = false;\n     prefix = normalize_ipv4_prefix_str(ctx->argv[2]);\n     if (!prefix) {\n@@ -4186,7 +4211,8 @@ nbctl_lr_route_add(struct ctl_context *ctx)\n     bool ecmp = shash_find(&ctx->options, \"--ecmp\") != NULL ||\n                 ecmp_symmetric_reply;\n     struct nbrec_logical_router_static_route *route =\n-        nbctl_lr_get_route(lr, prefix, next_hop, is_src_route, ecmp);\n+        nbctl_lr_get_route(lr, prefix, next_hop, is_src_route, ecmp,\n+                           route_table);\n \n     /* Validations for nexthop = \"discard\" */\n     if (is_discard_route) {\n@@ -4250,7 +4276,8 @@ nbctl_lr_route_add(struct ctl_context *ctx)\n     }\n \n     struct nbrec_logical_router_static_route *discard_route =\n-        nbctl_lr_get_route(lr, prefix, \"discard\", is_src_route, true);\n+        nbctl_lr_get_route(lr, prefix, \"discard\", is_src_route, true,\n+                           route_table);\n     if (discard_route) {\n         ctl_error(ctx, \"discard nexthop for the same ECMP route exists.\");\n         goto cleanup;\n@@ -4266,6 +4293,9 @@ nbctl_lr_route_add(struct ctl_context *ctx)\n     if (policy) {\n         nbrec_logical_router_static_route_set_policy(route, policy);\n     }\n+    if (route_table) {\n+        nbrec_logical_router_static_route_set_route_table(route, route_table);\n+    }\n \n     if (ecmp_symmetric_reply) {\n         const struct smap options = SMAP_CONST1(&options,\n@@ -4309,6 +4339,8 @@ nbctl_pre_lr_route_del(struct ctl_context *ctx)\n                          &nbrec_logical_router_static_route_col_nexthop);\n     ovsdb_idl_add_column(ctx->idl,\n                          &nbrec_logical_router_static_route_col_output_port);\n+    ovsdb_idl_add_column(ctx->idl,\n+                         &nbrec_logical_router_static_route_col_route_table);\n \n }\n \n@@ -4322,6 +4354,7 @@ nbctl_lr_route_del(struct ctl_context *ctx)\n         return;\n     }\n \n+    const char *route_table = shash_find_data(&ctx->options, \"--route-table\");\n     const char *policy = shash_find_data(&ctx->options, \"--policy\");\n     bool is_src_route = false;\n     if (policy) {\n@@ -4412,6 +4445,14 @@ nbctl_lr_route_del(struct ctl_context *ctx)\n             }\n         }\n \n+        /* Strict compare for route_table.\n+         * If route_table was not specified,\n+         * lookup for routes with empty route_table value. */\n+        if (strcmp(lr->static_routes[i]->route_table,\n+                   route_table ? route_table : \"\")) {\n+            continue;\n+        }\n+\n         /* Compare output_port, if specified. */\n         if (output_port) {\n             char *rt_output_port = lr->static_routes[i]->output_port;\n@@ -5135,6 +5176,41 @@ nbctl_pre_lrp_del_gateway_chassis(struct ctl_context *ctx)\n     ovsdb_idl_add_column(ctx->idl, &nbrec_gateway_chassis_col_chassis_name);\n }\n \n+static void\n+nbctl_pre_lrp_options(struct ctl_context *ctx)\n+{\n+    ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_name);\n+    ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_port_col_options);\n+}\n+\n+static void\n+nbctl_lrp_set_options(struct ctl_context *ctx)\n+{\n+    const char *id = ctx->argv[1];\n+    const struct nbrec_logical_router_port *lrp = NULL;\n+    size_t i;\n+    struct smap options = SMAP_INITIALIZER(&options);\n+\n+    char *error = lrp_by_name_or_uuid(ctx, id, true, &lrp);\n+    if (error) {\n+        ctx->error = error;\n+        return;\n+    }\n+    for (i = 2; i < ctx->argc; i++) {\n+        char *key, *value;\n+        value = xstrdup(ctx->argv[i]);\n+        key = strsep(&value, \"=\");\n+        if (value) {\n+            smap_add(&options, key, value);\n+        }\n+        free(key);\n+    }\n+\n+    nbrec_logical_router_port_set_options(lrp, &options);\n+\n+    smap_destroy(&options);\n+}\n+\n /* Removes logical router port 'lrp->gateway_chassis[idx]'. */\n static void\n remove_gc(const struct nbrec_logical_router_port *lrp, size_t idx)\n@@ -5911,6 +5987,7 @@ route_cmp_details(const struct nbrec_logical_router_static_route *r1,\n     }\n     return r1->output_port ? 1 : -1;\n }\n+\n struct ipv4_route {\n     int priority;\n     ovs_be32 addr;\n@@ -5920,6 +5997,11 @@ struct ipv4_route {\n static int\n __ipv4_route_cmp(const struct ipv4_route *r1, const struct ipv4_route *r2)\n {\n+    int rtb_cmp = strcmp(r1->route->route_table,\n+                         r2->route->route_table);\n+    if (rtb_cmp) {\n+        return rtb_cmp;\n+    }\n     if (r1->priority != r2->priority) {\n         return r1->priority > r2->priority ? -1 : 1;\n     }\n@@ -5951,6 +6033,11 @@ struct ipv6_route {\n static int\n __ipv6_route_cmp(const struct ipv6_route *r1, const struct ipv6_route *r2)\n {\n+    int rtb_cmp = strcmp(r1->route->route_table,\n+                         r2->route->route_table);\n+    if (rtb_cmp) {\n+        return rtb_cmp;\n+    }\n     if (r1->priority != r2->priority) {\n         return r1->priority > r2->priority ? -1 : 1;\n     }\n@@ -6038,6 +6125,8 @@ nbctl_pre_lr_route_list(struct ctl_context *ctx)\n                          &nbrec_logical_router_static_route_col_options);\n     ovsdb_idl_add_column(ctx->idl,\n                          &nbrec_logical_router_static_route_col_bfd);\n+    ovsdb_idl_add_column(ctx->idl,\n+                         &nbrec_logical_router_static_route_col_route_table);\n }\n \n static void\n@@ -6055,12 +6144,17 @@ nbctl_lr_route_list(struct ctl_context *ctx)\n         return;\n     }\n \n+    char *route_table = shash_find_data(&ctx->options, \"--route-table\");\n+\n     ipv4_routes = xmalloc(sizeof *ipv4_routes * lr->n_static_routes);\n     ipv6_routes = xmalloc(sizeof *ipv6_routes * lr->n_static_routes);\n \n     for (int i = 0; i < lr->n_static_routes; i++) {\n         const struct nbrec_logical_router_static_route *route\n             = lr->static_routes[i];\n+        if (route_table && strcmp(route->route_table, route_table)) {\n+            continue;\n+        }\n         unsigned int plen;\n         ovs_be32 ipv4;\n         const char *policy = route->policy ? route->policy : \"dst-ip\";\n@@ -6101,6 +6195,7 @@ nbctl_lr_route_list(struct ctl_context *ctx)\n     if (n_ipv4_routes) {\n         ds_put_cstr(&ctx->output, \"IPv4 Routes\\n\");\n     }\n+    const struct nbrec_logical_router_static_route *route;\n     for (int i = 0; i < n_ipv4_routes; i++) {\n         bool ecmp = false;\n         if (i < n_ipv4_routes - 1 &&\n@@ -6111,6 +6206,15 @@ nbctl_lr_route_list(struct ctl_context *ctx)\n                                      &ipv4_routes[i - 1])) {\n             ecmp = true;\n         }\n+\n+        route = ipv4_routes[i].route;\n+        if (!i || (i > 0 && strcmp(route->route_table,\n+                                   ipv4_routes[i - 1].route->route_table))) {\n+            ds_put_format(&ctx->output, \"%sRoute Table %s:\\n\", i ? \"\\n\" : \"\",\n+                          strlen(route->route_table) ? route->route_table\n+                                                     : \"<main>\");\n+        }\n+\n         print_route(ipv4_routes[i].route, &ctx->output, ecmp);\n     }\n \n@@ -6128,6 +6232,15 @@ nbctl_lr_route_list(struct ctl_context *ctx)\n                                      &ipv6_routes[i - 1])) {\n             ecmp = true;\n         }\n+\n+        route = ipv6_routes[i].route;\n+        if (!i || (i > 0 && strcmp(route->route_table,\n+                                   ipv6_routes[i - 1].route->route_table))) {\n+            ds_put_format(&ctx->output, \"%sRoute Table %s:\\n\", i ? \"\\n\" : \"\",\n+                          strlen(route->route_table) ? route->route_table\n+                                                     : \"<main>\");\n+        }\n+\n         print_route(ipv6_routes[i].route, &ctx->output, ecmp);\n     }\n \n@@ -6949,6 +7062,8 @@ static const struct ctl_command_syntax nbctl_commands[] = {\n       \"PORT CHASSIS [PRIORITY]\",\n       nbctl_pre_lrp_set_gateway_chassis, nbctl_lrp_set_gateway_chassis,\n       NULL, \"--may-exist\", RW },\n+    { \"lrp-set-options\", 1, INT_MAX, \"PORT KEY=VALUE [KEY=VALUE]...\",\n+      nbctl_pre_lrp_options, nbctl_lrp_set_options, NULL, \"\", RW },\n     { \"lrp-del-gateway-chassis\", 2, 2, \"PORT CHASSIS\",\n       nbctl_pre_lrp_del_gateway_chassis, nbctl_lrp_del_gateway_chassis,\n       NULL, \"\", RW },\n@@ -6972,12 +7087,13 @@ static const struct ctl_command_syntax nbctl_commands[] = {\n     /* logical router route commands. */\n     { \"lr-route-add\", 3, 4, \"ROUTER PREFIX NEXTHOP [PORT]\",\n       nbctl_pre_lr_route_add, nbctl_lr_route_add, NULL,\n-      \"--may-exist,--ecmp,--ecmp-symmetric-reply,--policy=,--bfd?\", RW },\n+      \"--may-exist,--ecmp,--ecmp-symmetric-reply,--policy=,--route-table=,--bfd?\",\n+      RW },\n     { \"lr-route-del\", 1, 4, \"ROUTER [PREFIX [NEXTHOP [PORT]]]\",\n       nbctl_pre_lr_route_del, nbctl_lr_route_del, NULL,\n-      \"--if-exists,--policy=\", RW },\n+      \"--if-exists,--policy=,--route-table=\", RW },\n     { \"lr-route-list\", 1, 1, \"ROUTER\", nbctl_pre_lr_route_list,\n-      nbctl_lr_route_list, NULL, \"\", RO },\n+      nbctl_lr_route_list, NULL, \"--route-table=\", RO },\n \n     /* Policy commands */\n     { \"lr-policy-add\", 4, INT_MAX,\n",
    "prefixes": [
        "ovs-dev",
        "v7",
        "3/5"
    ]
}