get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 810803,
    "url": "http://patchwork.ozlabs.org/api/patches/810803/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20170906210839.26091-3-mmichels@redhat.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/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": "<20170906210839.26091-3-mmichels@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-06T21:08:37",
    "name": "[ovs-dev,2/4] ovn: Allow ct_lb actions to take IPv6 address arguments.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "33e11c73968a61d19e6a8874b0a1f0347366aa7c",
    "submitter": {
        "id": 71978,
        "url": "http://patchwork.ozlabs.org/api/people/71978/?format=api",
        "name": "Mark Michelson",
        "email": "mmichels@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20170906210839.26091-3-mmichels@redhat.com/mbox/",
    "series": [
        {
            "id": 1883,
            "url": "http://patchwork.ozlabs.org/api/series/1883/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=1883",
            "date": "2017-09-06T21:08:35",
            "name": "ovn: Add support for IPv6 load balancers",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1883/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/810803/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/810803/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-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx02.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 3xnbnp3hzcz9t2v\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 07:10:06 +1000 (AEST)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 5102DB7C;\n\tWed,  6 Sep 2017 21:08:46 +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 EB36BB4A\n\tfor <dev@openvswitch.org>; Wed,  6 Sep 2017 21:08:43 +0000 (UTC)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8053F48E\n\tfor <dev@openvswitch.org>; Wed,  6 Sep 2017 21:08:43 +0000 (UTC)",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\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 E4629883A0\n\tfor <dev@openvswitch.org>; Wed,  6 Sep 2017 21:08:42 +0000 (UTC)",
            "from monae.redhat.com (ovpn-121-224.rdu2.redhat.com\n\t[10.10.121.224])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 61069179D3\n\tfor <dev@openvswitch.org>; Wed,  6 Sep 2017 21:08:42 +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.26]);\n\tWed, 06 Sep 2017 21:08:43 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com E4629883A0",
        "From": "Mark Michelson <mmichels@redhat.com>",
        "To": "dev@openvswitch.org",
        "Date": "Wed,  6 Sep 2017 16:08:37 -0500",
        "Message-Id": "<20170906210839.26091-3-mmichels@redhat.com>",
        "In-Reply-To": "<20170906210839.26091-1-mmichels@redhat.com>",
        "References": "<20170906210839.26091-1-mmichels@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "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 2/4] ovn: Allow ct_lb actions to take IPv6 address\n\targuments.",
        "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 |  4 ++-\n ovn/lib/actions.c     | 99 ++++++++++++++++++++++++++++++++++++++++-----------\n tests/ovn.at          |  8 ++++-\n 3 files changed, 89 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/include/ovn/actions.h b/include/ovn/actions.h\nindex 0a04af7aa..ec0063efc 100644\n--- a/include/ovn/actions.h\n+++ b/include/ovn/actions.h\n@@ -200,7 +200,9 @@ struct ovnact_ct_nat {\n };\n \n struct ovnact_ct_lb_dst {\n-    ovs_be32 ip;\n+    int family;\n+    struct in6_addr ipv6;\n+    ovs_be32 ipv4;\n     uint16_t port;\n };\n \ndiff --git a/ovn/lib/actions.c b/ovn/lib/actions.c\nindex d0d73b69c..8d60529cb 100644\n--- a/ovn/lib/actions.c\n+++ b/ovn/lib/actions.c\n@@ -883,23 +883,63 @@ 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+                struct ovnact_ct_lb_dst dst;\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 +947,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 +969,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 +1041,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 fb9fc7352..9118f2839 100644\n--- a/tests/ovn.at\n+++ b/tests/ovn.at\n@@ -793,13 +793,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",
        "2/4"
    ]
}