get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/833419/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 833419,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/833419/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20171102161359.7344-3-mmichels@redhat.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20171102161359.7344-3-mmichels@redhat.com>",
    "list_archive_url": null,
    "date": "2017-11-02T16:13:57",
    "name": "[ovs-dev,v3,2/4] ovn: Allow ct_lb actions to take IPv6 address arguments.",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "580ee8399fe95c94164fc27e04fa887d87aa8876",
    "submitter": {
        "id": 71978,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/71978/?format=api",
        "name": "Mark Michelson",
        "email": "mmichels@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20171102161359.7344-3-mmichels@redhat.com/mbox/",
    "series": [
        {
            "id": 11537,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/11537/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=11537",
            "date": "2017-11-02T16:13:56",
            "name": "Add support for IPv6 load balancers",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/11537/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/833419/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/833419/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@mail.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mmichels@redhat.com"
        ],
        "Received": [
            "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ySVYs0mGHz9t2r\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  3 Nov 2017 03:15:45 +1100 (AEDT)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 6E20EB1D;\n\tThu,  2 Nov 2017 16:14:05 +0000 (UTC)",
            "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 6371594B\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 16:14:02 +0000 (UTC)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id E83AB522\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 16:14:01 +0000 (UTC)",
            "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 694BCC04AC4E\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 16:14:01 +0000 (UTC)",
            "from monae.redhat.com (ovpn-123-202.rdu2.redhat.com\n\t[10.10.123.202])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1C3FF60CA0\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 16:14:01 +0000 (UTC)"
        ],
        "X-Greylist": [
            "domain auto-whitelisted by SQLgrey-1.7.6",
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tThu, 02 Nov 2017 16:14:01 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 694BCC04AC4E",
        "From": "Mark Michelson <mmichels@redhat.com>",
        "To": "dev@openvswitch.org",
        "Date": "Thu,  2 Nov 2017 11:13:57 -0500",
        "Message-Id": "<20171102161359.7344-3-mmichels@redhat.com>",
        "In-Reply-To": "<20171102161359.7344-1-mmichels@redhat.com>",
        "References": "<20171102161359.7344-1-mmichels@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "X-Spam-Status": "No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,\n\tRP_MATCHES_RCVD autolearn=disabled version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Subject": "[ovs-dev] [PATCH v3 2/4] ovn: Allow ct_lb actions to take IPv6\n\taddress arguments.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.12",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<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\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "ovs-dev-bounces@openvswitch.org",
        "Errors-To": "ovs-dev-bounces@openvswitch.org"
    },
    "content": "The ct_lb action previously assumed that any address arguments were\nIPv4. This patch expands the parsing, formatting, and encoding of ct_lb\nto be amenable to IPv6 addresses as well.\n\nSigned-off-by: Mark Michelson <mmichels@redhat.com>\n---\n include/ovn/actions.h |  6 +++-\n ovn/lib/actions.c     | 98 ++++++++++++++++++++++++++++++++++++++++-----------\n tests/ovn.at          |  8 ++++-\n 3 files changed, 90 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/include/ovn/actions.h b/include/ovn/actions.h\nindex 0a04af7aa..63885da3c 100644\n--- a/include/ovn/actions.h\n+++ b/include/ovn/actions.h\n@@ -200,7 +200,11 @@ struct ovnact_ct_nat {\n };\n \n struct ovnact_ct_lb_dst {\n-    ovs_be32 ip;\n+    int family;\n+    union {\n+        struct in6_addr ipv6;\n+        ovs_be32 ipv4;\n+    };\n     uint16_t port;\n };\n \ndiff --git a/ovn/lib/actions.c b/ovn/lib/actions.c\nindex c9876436d..2aace1487 100644\n--- a/ovn/lib/actions.c\n+++ b/ovn/lib/actions.c\n@@ -883,23 +883,62 @@ parse_ct_lb_action(struct action_context *ctx)\n \n     if (lexer_match(ctx->lexer, LEX_T_LPAREN)) {\n         while (!lexer_match(ctx->lexer, LEX_T_RPAREN)) {\n-            if (ctx->lexer->token.type != LEX_T_INTEGER\n-                || mf_subvalue_width(&ctx->lexer->token.value) > 32) {\n-                free(dsts);\n-                lexer_syntax_error(ctx->lexer, \"expecting IPv4 address\");\n-                return;\n-            }\n+            struct ovnact_ct_lb_dst dst;\n+            if (lexer_match(ctx->lexer, LEX_T_LSQUARE)) {\n+                /* IPv6 address and port */\n+                if (ctx->lexer->token.type != LEX_T_INTEGER\n+                    || ctx->lexer->token.format != LEX_F_IPV6) {\n+                    free(dsts);\n+                    lexer_syntax_error(ctx->lexer, \"expecting IPv6 address\");\n+                    return;\n+                }\n+                dst.family = AF_INET6;\n+                dst.ipv6 = ctx->lexer->token.value.ipv6;\n \n-            /* Parse IP. */\n-            ovs_be32 ip = ctx->lexer->token.value.ipv4;\n-            lexer_get(ctx->lexer);\n+                lexer_get(ctx->lexer);\n+                if (!lexer_match(ctx->lexer, LEX_T_RSQUARE)) {\n+                    free(dsts);\n+                    lexer_syntax_error(ctx->lexer, \"no closing square \"\n+                                                   \"bracket\");\n+                    return;\n+                }\n+                dst.port = 0;\n+                if (lexer_match(ctx->lexer, LEX_T_COLON)\n+                    && !action_parse_port(ctx, &dst.port)) {\n+                    free(dsts);\n+                    return;\n+                }\n+            } else {\n+                if (ctx->lexer->token.type != LEX_T_INTEGER\n+                    || (ctx->lexer->token.format != LEX_F_IPV4\n+                    && ctx->lexer->token.format != LEX_F_IPV6)) {\n+                    free(dsts);\n+                    lexer_syntax_error(ctx->lexer, \"expecting IP address\");\n+                    return;\n+                }\n \n-            /* Parse optional port. */\n-            uint16_t port = 0;\n-            if (lexer_match(ctx->lexer, LEX_T_COLON)\n-                && !action_parse_port(ctx, &port)) {\n-                free(dsts);\n-                return;\n+                /* Parse IP. */\n+                if (ctx->lexer->token.format == LEX_F_IPV4) {\n+                    dst.family = AF_INET;\n+                    dst.ipv4 = ctx->lexer->token.value.ipv4;\n+                } else {\n+                    dst.family = AF_INET6;\n+                    dst.ipv6 = ctx->lexer->token.value.ipv6;\n+                }\n+\n+                lexer_get(ctx->lexer);\n+                dst.port = 0;\n+                if (lexer_match(ctx->lexer, LEX_T_COLON)) {\n+                    if (dst.family == AF_INET6) {\n+                        free(dsts);\n+                        lexer_syntax_error(ctx->lexer, \"IPv6 address needs \"\n+                                \"square brackets if port is included\");\n+                        return;\n+                    } else if (!action_parse_port(ctx, &dst.port)) {\n+                        free(dsts);\n+                        return;\n+                    }\n+                }\n             }\n             lexer_match(ctx->lexer, LEX_T_COMMA);\n \n@@ -907,7 +946,7 @@ parse_ct_lb_action(struct action_context *ctx)\n             if (n_dsts >= allocated_dsts) {\n                 dsts = x2nrealloc(dsts, &allocated_dsts, sizeof *dsts);\n             }\n-            dsts[n_dsts++] = (struct ovnact_ct_lb_dst) { ip, port };\n+            dsts[n_dsts++] = dst;\n         }\n     }\n \n@@ -929,9 +968,19 @@ format_CT_LB(const struct ovnact_ct_lb *cl, struct ds *s)\n             }\n \n             const struct ovnact_ct_lb_dst *dst = &cl->dsts[i];\n-            ds_put_format(s, IP_FMT, IP_ARGS(dst->ip));\n-            if (dst->port) {\n-                ds_put_format(s, \":%\"PRIu16, dst->port);\n+            if (dst->family == AF_INET) {\n+                ds_put_format(s, IP_FMT, IP_ARGS(dst->ipv4));\n+                if (dst->port) {\n+                    ds_put_format(s, \":%\"PRIu16, dst->port);\n+                }\n+            } else {\n+                if (dst->port) {\n+                    ds_put_char(s, '[');\n+                }\n+                ipv6_format_addr(&dst->ipv6, s);\n+                if (dst->port) {\n+                    ds_put_format(s, \"]:%\"PRIu16, dst->port);\n+                }\n             }\n         }\n         ds_put_char(s, ')');\n@@ -991,8 +1040,17 @@ encode_CT_LB(const struct ovnact_ct_lb *cl,\n     BUILD_ASSERT(MFF_LOG_DNAT_ZONE < MFF_REG0 + FLOW_N_REGS);\n     for (size_t bucket_id = 0; bucket_id < cl->n_dsts; bucket_id++) {\n         const struct ovnact_ct_lb_dst *dst = &cl->dsts[bucket_id];\n+        char ip_addr[INET6_ADDRSTRLEN];\n+        if (dst->family == AF_INET) {\n+            inet_ntop(AF_INET, &dst->ipv4, ip_addr, sizeof ip_addr);\n+        } else {\n+            inet_ntop(AF_INET6, &dst->ipv6, ip_addr, sizeof ip_addr);\n+        }\n         ds_put_format(&ds, \",bucket=bucket_id=%\"PRIuSIZE\",weight:100,actions=\"\n-                      \"ct(nat(dst=\"IP_FMT, bucket_id, IP_ARGS(dst->ip));\n+                      \"ct(nat(dst=%s%s%s\", bucket_id,\n+                      dst->family == AF_INET6 && dst->port ? \"[\" : \"\",\n+                      ip_addr,\n+                      dst->family == AF_INET6 && dst->port ? \"]\" : \"\");\n         if (dst->port) {\n             ds_put_format(&ds, \":%\"PRIu16, dst->port);\n         }\ndiff --git a/tests/ovn.at b/tests/ovn.at\nindex 490841c63..67709b55b 100644\n--- a/tests/ovn.at\n+++ b/tests/ovn.at\n@@ -825,13 +825,19 @@ ct_lb(192.168.1.2, 192.168.1.3, );\n     formats as ct_lb(192.168.1.2, 192.168.1.3);\n     encodes as group:2\n     has prereqs ip\n+ct_lb(fd0f::2, fd0f::3, );\n+    formats as ct_lb(fd0f::2, fd0f::3);\n+    encodes as group:3\n+    has prereqs ip\n \n ct_lb(192.168.1.2:);\n     Syntax error at `)' expecting port number.\n ct_lb(192.168.1.2:123456);\n     Syntax error at `123456' expecting port number.\n ct_lb(foo);\n-    Syntax error at `foo' expecting IPv4 address.\n+    Syntax error at `foo' expecting IP address.\n+ct_lb([192.168.1.2]);\n+    Syntax error at `192.168.1.2' expecting IPv6 address.\n \n # ct_next\n ct_next;\n",
    "prefixes": [
        "ovs-dev",
        "v3",
        "2/4"
    ]
}