get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 808611,
    "url": "http://patchwork.ozlabs.org/api/patches/808611/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/1504260847-5408-1-git-send-email-pablo@netfilter.org/",
    "project": {
        "id": 26,
        "url": "http://patchwork.ozlabs.org/api/projects/26/?format=api",
        "name": "Netfilter Development",
        "link_name": "netfilter-devel",
        "list_id": "netfilter-devel.vger.kernel.org",
        "list_email": "netfilter-devel@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1504260847-5408-1-git-send-email-pablo@netfilter.org>",
    "list_archive_url": null,
    "date": "2017-09-01T10:14:05",
    "name": "[nft,1/3] src: move nf_sock into nft_ctx structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ae0a2e469635cc35ff5663cc17b400ffe12fcce1",
    "submitter": {
        "id": 1315,
        "url": "http://patchwork.ozlabs.org/api/people/1315/?format=api",
        "name": "Pablo Neira Ayuso",
        "email": "pablo@netfilter.org"
    },
    "delegate": {
        "id": 6139,
        "url": "http://patchwork.ozlabs.org/api/users/6139/?format=api",
        "username": "pablo",
        "first_name": "Pablo",
        "last_name": "Neira",
        "email": "pablo@netfilter.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/1504260847-5408-1-git-send-email-pablo@netfilter.org/mbox/",
    "series": [
        {
            "id": 988,
            "url": "http://patchwork.ozlabs.org/api/series/988/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=988",
            "date": "2017-09-01T10:14:05",
            "name": "[nft,1/3] src: move nf_sock into nft_ctx structure",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/988/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808611/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808611/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netfilter-devel-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netfilter-devel-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkFTR5B7xz9t2x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 20:14:19 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751864AbdIAKOS (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 1 Sep 2017 06:14:18 -0400",
            "from mail.us.es ([193.147.175.20]:34312 \"EHLO mail.us.es\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751730AbdIAKOR (ORCPT <rfc822; netfilter-devel@vger.kernel.org>);\n\tFri, 1 Sep 2017 06:14:17 -0400",
            "from antivirus1-rhel7.int (unknown [192.168.2.11])\n\tby mail.us.es (Postfix) with ESMTP id CC797190F7F\n\tfor <netfilter-devel@vger.kernel.org>;\n\tFri,  1 Sep 2017 12:13:52 +0200 (CEST)",
            "from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id BB95F2DC69\n\tfor <netfilter-devel@vger.kernel.org>;\n\tFri,  1 Sep 2017 12:13:52 +0200 (CEST)",
            "by antivirus1-rhel7.int (Postfix, from userid 99)\n\tid B0DF62DC6E; Fri,  1 Sep 2017 12:13:52 +0200 (CEST)",
            "from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 6F9F52DC69;\n\tFri,  1 Sep 2017 12:13:50 +0200 (CEST)",
            "from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int\n\t(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); \n\tFri, 01 Sep 2017 12:13:50 +0200 (CEST)",
            "from salvia.here (129.166.216.87.static.jazztel.es\n\t[87.216.166.129]) (Authenticated sender: pneira@us.es)\n\tby entrada.int (Postfix) with ESMTPA id 152924265A24;\n\tFri,  1 Sep 2017 12:13:50 +0200 (CEST)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.1 (2015-04-28) on\n\tantivirus1-rhel7.int",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50,\n\tSMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1",
        "X-Virus-Status": "clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int)",
        "X-SMTPAUTHUS": "auth mail.us.es",
        "From": "Pablo Neira Ayuso <pablo@netfilter.org>",
        "To": "netfilter-devel@vger.kernel.org",
        "Cc": "phil@nwl.cc, eric@regit.org",
        "Subject": "[PATCH nft 1/3] src: move nf_sock into nft_ctx structure",
        "Date": "Fri,  1 Sep 2017 12:14:05 +0200",
        "Message-Id": "<1504260847-5408-1-git-send-email-pablo@netfilter.org>",
        "X-Mailer": "git-send-email 2.1.4",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Sender": "netfilter-devel-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netfilter-devel.vger.kernel.org>",
        "X-Mailing-List": "netfilter-devel@vger.kernel.org"
    },
    "content": "The idea is to provide a simplistic API for non-netlink wise people.\nAdd a field in struct nft_ctx to store the socket.\n\nThe advanced API that we're planning will just simply leave this unset,\nsince netlink IO will be exposed.\n\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n@Eric: Still pending the specific interface to print. As I said, I would prefer\n       functions with stricting typing. I think after this you have the simple\n       API that you need.\n\n include/nftables.h |  3 +++\n src/main.c         | 26 +++++++++++---------------\n 2 files changed, 14 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/include/nftables.h b/include/nftables.h\nindex 256b06ee33fc..5035567a75fd 100644\n--- a/include/nftables.h\n+++ b/include/nftables.h\n@@ -38,7 +38,10 @@ struct nft_cache {\n \tuint32_t\t\tseqnum;\n };\n \n+struct mnl_socket;\n+\n struct nft_ctx {\n+\tstruct mnl_socket\t*nf_sock;\n \tconst char\t\t*include_paths[INCLUDE_PATHS_MAX];\n \tunsigned int\t\tnum_include_paths;\n \tunsigned int\t\tparser_max_errors;\ndiff --git a/src/main.c b/src/main.c\nindex eecd430a2e3f..a891832ec5d6 100644\n--- a/src/main.c\n+++ b/src/main.c\n@@ -305,7 +305,6 @@ static void nft_ctx_free(const struct nft_ctx *ctx)\n }\n \n static int nft_run_cmd_from_buffer(struct nft_ctx *nft,\n-\t\t\t\t   struct mnl_socket *nf_sock,\n \t\t\t\t   char *buf, size_t buflen)\n {\n \tint rc = NFT_EXIT_SUCCESS;\n@@ -313,11 +312,11 @@ static int nft_run_cmd_from_buffer(struct nft_ctx *nft,\n \tLIST_HEAD(msgs);\n \tvoid *scanner;\n \n-\tparser_init(nf_sock, &nft->cache, &state, &msgs, nft->debug_mask);\n+\tparser_init(nft->nf_sock, &nft->cache, &state, &msgs, nft->debug_mask);\n \tscanner = scanner_init(&state);\n \tscanner_push_buffer(scanner, &indesc_cmdline, buf);\n \n-\tif (nft_run(nft, nf_sock, scanner, &state, &msgs) != 0)\n+\tif (nft_run(nft, nft->nf_sock, scanner, &state, &msgs) != 0)\n \t\trc = NFT_EXIT_FAILURE;\n \n \terec_print_list(stderr, &msgs, nft->debug_mask);\n@@ -326,26 +325,24 @@ static int nft_run_cmd_from_buffer(struct nft_ctx *nft,\n \treturn rc;\n }\n \n-static int nft_run_cmd_from_filename(struct nft_ctx *nft,\n-\t\t\t\t     struct mnl_socket *nf_sock,\n-\t\t\t\t     const char *filename)\n+static int nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename)\n {\n \tstruct parser_state state;\n \tLIST_HEAD(msgs);\n \tvoid *scanner;\n \tint rc;\n \n-\trc = cache_update(nf_sock, &nft->cache, CMD_INVALID, &msgs,\n+\trc = cache_update(nft->nf_sock, &nft->cache, CMD_INVALID, &msgs,\n \t\t\t  nft->debug_mask);\n \tif (rc < 0)\n \t\treturn NFT_EXIT_FAILURE;\n \n-\tparser_init(nf_sock, &nft->cache, &state, &msgs, nft->debug_mask);\n+\tparser_init(nft->nf_sock, &nft->cache, &state, &msgs, nft->debug_mask);\n \tscanner = scanner_init(&state);\n \tif (scanner_read_file(scanner, filename, &internal_location) < 0)\n \t\tgoto err;\n \n-\tif (nft_run(nft, nf_sock, scanner, &state, &msgs) != 0)\n+\tif (nft_run(nft, nft->nf_sock, scanner, &state, &msgs) != 0)\n \t\trc = NFT_EXIT_FAILURE;\n err:\n \terec_print_list(stderr, &msgs, nft->debug_mask);\n@@ -359,13 +356,12 @@ int main(int argc, char * const *argv)\n \tchar *buf = NULL, *filename = NULL;\n \tunsigned int len;\n \tbool interactive = false;\n-\tstruct mnl_socket *nf_sock;\n \tstruct parser_state state;\n \tint i, val, rc;\n \n \tnft = nft_ctx_new();\n \n-\tnf_sock = netlink_open_sock();\n+\tnft->nf_sock = netlink_open_sock();\n \twhile (1) {\n \t\tval = getopt_long(argc, argv, OPTSTRING, options, NULL);\n \t\tif (val == -1)\n@@ -460,11 +456,11 @@ int main(int argc, char * const *argv)\n \t\t\t\tstrcat(buf, \" \");\n \t\t}\n \t\tstrcat(buf, \"\\n\");\n-\t\trc = nft_run_cmd_from_buffer(nft, nf_sock, buf, len + 2);\n+\t\trc = nft_run_cmd_from_buffer(nft, buf, len + 2);\n \t} else if (filename != NULL) {\n-\t\trc = nft_run_cmd_from_filename(nft, nf_sock, filename);\n+\t\trc = nft_run_cmd_from_filename(nft, filename);\n \t} else if (interactive) {\n-\t\tif (cli_init(nft, nf_sock, &state) < 0) {\n+\t\tif (cli_init(nft, nft->nf_sock, &state) < 0) {\n \t\t\tfprintf(stderr, \"%s: interactive CLI not supported in this build\\n\",\n \t\t\t\targv[0]);\n \t\t\texit(NFT_EXIT_FAILURE);\n@@ -476,7 +472,7 @@ int main(int argc, char * const *argv)\n \t}\n \n \txfree(buf);\n-\tnetlink_close_sock(nf_sock);\n+\tnetlink_close_sock(nft->nf_sock);\n \tnft_ctx_free(nft);\n \n \treturn rc;\n",
    "prefixes": [
        "nft",
        "1/3"
    ]
}