Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806298/?format=api
{ "id": 806298, "url": "http://patchwork.ozlabs.org/api/patches/806298/?format=api", "web_url": "http://patchwork.ozlabs.org/project/lede/patch/20170827194828.14794-1-dedeckeh@gmail.com/", "project": { "id": 54, "url": "http://patchwork.ozlabs.org/api/projects/54/?format=api", "name": "LEDE development", "link_name": "lede", "list_id": "lede-dev.lists.infradead.org", "list_email": "lede-dev@lists.infradead.org", "web_url": "http://lede-project.org/", "scm_url": "", "webscm_url": "http://git.lede-project.org/", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170827194828.14794-1-dedeckeh@gmail.com>", "list_archive_url": null, "date": "2017-08-27T19:48:28", "name": "[LEDE-DEV,netifd] system-linux: parse map-e fmrs parameters as nested data json object", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "25baa618977a11748a443af0471d144aef875307", "submitter": { "id": 65331, "url": "http://patchwork.ozlabs.org/api/people/65331/?format=api", "name": "Hans Dedecker", "email": "dedeckeh@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/lede/patch/20170827194828.14794-1-dedeckeh@gmail.com/mbox/", "series": [ { "id": 40, "url": "http://patchwork.ozlabs.org/api/series/40/?format=api", "web_url": "http://patchwork.ozlabs.org/project/lede/list/?series=40", "date": "2017-08-27T19:48:28", "name": "[LEDE-DEV,netifd] system-linux: parse map-e fmrs parameters as nested data json object", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/40/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806298/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806298/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"N+nXoy3m\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"R0gBCyGZ\"; dkim-atps=neutral" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\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 3xgQTS5c5cz9s8V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 05:49:32 +1000 (AEST)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dm3Ye-0006dg-0J; Sun, 27 Aug 2017 19:49:20 +0000", "from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dm3YF-0006bc-4o\n\tfor lede-dev@lists.infradead.org; Sun, 27 Aug 2017 19:48:57 +0000", "by mail-wm0-x244.google.com with SMTP id j72so5037351wmi.3\n\tfor <lede-dev@lists.infradead.org>;\n\tSun, 27 Aug 2017 12:48:34 -0700 (PDT)", "from localhost.localdomain\n\t(ptr-fvl7vteb6vjd542m2s0.18120a2.ip6.access.telenet.be.\n\t[2a02:1812:1128:fb00:ffc7:aef4:4f01:1990])\n\tby smtp.gmail.com with ESMTPSA id\n\tf16sm2514868edj.48.2017.08.27.12.48.31\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSun, 27 Aug 2017 12:48:32 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:\n\tDate:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:\n\tResent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:\n\tList-Owner; bh=vw3ewRccNMAuvgfdxbPGIqg/vNGhLfkjYjq0QV+QfPo=;\n\tb=N+nXoy3m81qjY1\n\tNuDgsO/mfoUPYod/Q2n+h5c6mi9dvjA8uhB9V+kxOseibI8tAuVlNhhH5dyUDhfFjE/JIizN35nCD\n\tgmdQufPw9qHh/6hkzd6GiOACh8caNx9sgjT6UQeATgxxsf/nszyot6XTjoKjQR85xMEwdqC9OFPsk\n\taZRDvLNlnmohHnXTrggiMPa4ZGiz/a6rtR5B3jo7SvuBRH5cN4GI0CI/Os0Ol1wrVtGpvseiJGO0J\n\tD2Mf5AyvV3FuOJ4ufUbwllLdoLfCKWrq4CXIOC4cvP+wlI2hv44WKGmLwBbwgNUzbR/77/tRnqh8L\n\tghdwqjagX4rMuKhSKT6w==;", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=hYUdwf+JdRhBe4OESevZa4ZL6IAkuGV+IU7QCri2JDE=;\n\tb=R0gBCyGZXBY+4DjicDtLor+bi/IiieTmy8b+udxGixdyKvGTrObfMb/XLs+Uhh6we+\n\to4GSJSTxQk0Z7kIj0bwdecaaqh6IljeIJX9TKv0cupe5qD7iJYby9ajHDlKwEdBnMkFA\n\t65Xy2nWRyHBkRgCRqwL7hsaus9592Kr3A5c5IG8Cn6H9poullc8ka7IC8yuyPRToAWUY\n\tfNdqUqVIaU9ZyomOPx5h3g+pjE8bbPI/OuZSCv0Em5O+kH1c7DDIEhDXr6QgxxRbhpzz\n\tnruehT9DZDyJhqq1wDSQkp+Hi4mchWaDLrP8/wfT9W9ntXDW5x5gbeZycDHuuYaOc2G+\n\tM17g==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=hYUdwf+JdRhBe4OESevZa4ZL6IAkuGV+IU7QCri2JDE=;\n\tb=BIk+GmKadhKv0Ic3/UJXD1kBzc4E+qk4thX21NnKf63p2QFFIscf9u/0e67cf/HYLP\n\t9ZJ6LD3WMju7ZMZIu6d2phkn3jWuWl0Byw9jdrca2+bIlrq+TxpvHxChF2YJgHsq7oA5\n\tiWr1BAjamfbSQFbZC7BLURd9y9zwNiQmFOMTkp97heuTWKTTFbZNS2xhC5A2nT5+f2Fx\n\tqxOLpz3sI5as7Ihmwu129+tcgTMaEAykU2+DFjkNVSObL3sW5ZccsMiOb+kakGaO7G2R\n\t/6C46057MHYhN69BAYWuTNLxKEHgduIDTgdLYNLV8wqyjWXbu2XhtW5B2TNfygOsntnb\n\tze5w==", "X-Gm-Message-State": "AHYfb5huFfG5SicQtWgH3RbXM76mwkTWbr40zWSaI94zHL+W3SKITYR5\n\tTNc+TU57CXOD0sLC", "X-Received": "by 10.80.166.69 with SMTP id d63mr5002993edc.32.1503863312995;\n\tSun, 27 Aug 2017 12:48:32 -0700 (PDT)", "From": "Hans Dedecker <dedeckeh@gmail.com>", "To": "nbd@nbd.name,\n\tlede-dev@lists.infradead.org", "Date": "Sun, 27 Aug 2017 21:48:28 +0200", "Message-Id": "<20170827194828.14794-1-dedeckeh@gmail.com>", "X-Mailer": "git-send-email 2.14.0", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20170827_124855_427707_27BAA640 ", "X-CRM114-Status": "GOOD ( 12.49 )", "X-Spam-Score": "-2.0 (--)", "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details: (-2.0 points)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2a00:1450:400c:c09:0:0:0:244 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (dedeckeh[at]gmail.com)\n\t-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain", "Subject": "[LEDE-DEV] [PATCH netifd] system-linux: parse map-e fmrs parameters\n\tas nested data json object", "X-BeenThere": "lede-dev@lists.infradead.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<lede-dev.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/lede-dev/>", "List-Post": "<mailto:lede-dev@lists.infradead.org>", "List-Help": "<mailto:lede-dev-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=subscribe>", "Cc": "Hans Dedecker <dedeckeh@gmail.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"Lede-dev\" <lede-dev-bounces@lists.infradead.org>", "Errors-To": "lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "Parse map-e fmrs parameters IPv6 prefix, IPv4 prefix, ealen and offset\nas array elements nested in a data json object.\nAt the same time remove the now obsolete TUNNEL_ATTR_FMRS tunnel attribute. \n\nSigned-off-by: Hans Dedecker <dedeckeh@gmail.com>\n---\n system-linux.c | 81 +++++++++++++++++++++++++++++++++++++---------------------\n system.c | 13 +++++++++-\n system.h | 10 +++++++-\n 3 files changed, 73 insertions(+), 31 deletions(-)", "diff": "diff --git a/system-linux.c b/system-linux.c\nindex 0bf071e..6d97a02 100644\n--- a/system-linux.c\n+++ b/system-linux.c\n@@ -2328,45 +2328,68 @@ static int system_add_ip6_tunnel(const char *name, const unsigned int link,\n \t}\n \n #ifdef IFLA_IPTUN_FMR_MAX\n-\tif ((cur = tb[TUNNEL_ATTR_FMRS])) {\n+\tif ((cur = tb[TUNNEL_ATTR_DATA])) {\n \t\tstruct nlattr *fmrs = nla_nest_start(nlm, IFLA_IPTUN_FMRS);\n+\t\tstruct blob_attr *dcur;\n+\t\tunsigned drem, fmrcnt = 0;\n \n-\t\tstruct blob_attr *fmr;\n-\t\tunsigned rem, fmrcnt = 0;\n-\t\tblobmsg_for_each_attr(fmr, cur, rem) {\n-\t\t\tif (blobmsg_type(fmr) != BLOBMSG_TYPE_STRING)\n+\t\tblobmsg_for_each_attr(dcur, cur, drem) {\n+\t\t\tif (blobmsg_type(dcur) != BLOBMSG_TYPE_ARRAY ||\n+\t\t\t\t\tstrcmp(blobmsg_name(dcur), \"fmrs\") ||\n+\t\t\t\t\tblobmsg_check_array(dcur, BLOBMSG_TYPE_UNSPEC) <= 0)\n \t\t\t\tcontinue;\n \n-\t\t\tunsigned ip4len, ip6len, ealen, offset = 6;\n-\t\t\tchar ip6buf[48];\n-\t\t\tchar ip4buf[16];\n+\t\t\tstruct blob_attr *rcur;\n+\t\t\tunsigned rrem;\n+\t\t\tblobmsg_for_each_attr(rcur, dcur, rrem) {\n+\t\t\t\tstruct blob_attr *tb_fmr[__FMR_DATA_ATTR_MAX], *tb_cur;\n+\t\t\t\tstruct in6_addr ip6prefix;\n+\t\t\t\tstruct in_addr ip4prefix;\n+\t\t\t\tunsigned ip4len, ip6len, ealen, offset;\n+\n+\t\t\t\tblobmsg_parse(fmr_data_attr_list.params, __FMR_DATA_ATTR_MAX, tb_fmr,\n+\t\t\t\t\t\tblobmsg_data(rcur), blobmsg_len(rcur));\n+\n+\t\t\t\tif (!(tb_cur = tb_fmr[FMR_DATA_PREFIX6]) ||\n+\t\t\t\t\t\t!parse_ip_and_netmask(AF_INET6,\n+\t\t\t\t\t\t\tblobmsg_data(tb_cur), &ip6prefix,\n+\t\t\t\t\t\t\t&ip6len)) {\n+\t\t\t\t\tret = -EINVAL;\n+\t\t\t\t\tgoto failure;\n+\t\t\t\t}\n \n-\t\t\tif (sscanf(blobmsg_get_string(fmr), \"%47[^/]/%u,%15[^/]/%u,%u,%u\",\n-\t\t\t\t\tip6buf, &ip6len, ip4buf, &ip4len, &ealen, &offset) < 5) {\n-\t\t\t\tret = -EINVAL;\n-\t\t\t\tgoto failure;\n-\t\t\t}\n+\t\t\t\tif (!(tb_cur = tb_fmr[FMR_DATA_PREFIX4]) ||\n+\t\t\t\t\t\t!parse_ip_and_netmask(AF_INET,\n+\t\t\t\t\t\t\tblobmsg_data(tb_cur), &ip4prefix,\n+\t\t\t\t\t\t\t&ip4len)) {\n+\t\t\t\t\tret = -EINVAL;\n+\t\t\t\t\tgoto failure;\n+\t\t\t\t}\n \n-\t\t\tstruct in6_addr ip6prefix;\n-\t\t\tstruct in_addr ip4prefix;\n-\t\t\tif (inet_pton(AF_INET6, ip6buf, &ip6prefix) != 1 ||\n-\t\t\t\t\tinet_pton(AF_INET, ip4buf, &ip4prefix) != 1) {\n-\t\t\t\tret = -EINVAL;\n-\t\t\t\tgoto failure;\n-\t\t\t}\n+\t\t\t\tif (!(tb_cur = tb_fmr[FMR_DATA_EALEN])) {\n+\t\t\t\t\tret = -EINVAL;\n+\t\t\t\t\tgoto failure;\n+\t\t\t\t}\n+\t\t\t\tealen = blobmsg_get_u32(tb_cur);\n \n-\t\t\tstruct nlattr *rule = nla_nest_start(nlm, ++fmrcnt);\n+\t\t\t\tif (!(tb_cur = tb_fmr[FMR_DATA_OFFSET])) {\n+\t\t\t\t\tret = -EINVAL;\n+\t\t\t\t\tgoto failure;\n+\t\t\t\t}\n+\t\t\t\toffset = blobmsg_get_u32(tb_cur);\n \n-\t\t\tnla_put(nlm, IFLA_IPTUN_FMR_IP6_PREFIX, sizeof(ip6prefix), &ip6prefix);\n-\t\t\tnla_put(nlm, IFLA_IPTUN_FMR_IP4_PREFIX, sizeof(ip4prefix), &ip4prefix);\n-\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_IP6_PREFIX_LEN, ip6len);\n-\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_IP4_PREFIX_LEN, ip4len);\n-\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_EA_LEN, ealen);\n-\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_OFFSET, offset);\n+\t\t\t\tstruct nlattr *rule = nla_nest_start(nlm, ++fmrcnt);\n \n-\t\t\tnla_nest_end(nlm, rule);\n-\t\t}\n+\t\t\t\tnla_put(nlm, IFLA_IPTUN_FMR_IP6_PREFIX, sizeof(ip6prefix), &ip6prefix);\n+\t\t\t\tnla_put(nlm, IFLA_IPTUN_FMR_IP4_PREFIX, sizeof(ip4prefix), &ip4prefix);\n+\t\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_IP6_PREFIX_LEN, ip6len);\n+\t\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_IP4_PREFIX_LEN, ip4len);\n+\t\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_EA_LEN, ealen);\n+\t\t\t\tnla_put_u8(nlm, IFLA_IPTUN_FMR_OFFSET, offset);\n \n+\t\t\t\tnla_nest_end(nlm, rule);\n+\t\t\t}\n+\t\t}\n \t\tnla_nest_end(nlm, fmrs);\n \t}\n #endif\ndiff --git a/system.c b/system.c\nindex bf3fd77..5555272 100644\n--- a/system.c\n+++ b/system.c\n@@ -24,7 +24,6 @@ static const struct blobmsg_policy tunnel_attrs[__TUNNEL_ATTR_MAX] = {\n \t[TUNNEL_ATTR_TTL] = { .name = \"ttl\", .type = BLOBMSG_TYPE_INT32 },\n \t[TUNNEL_ATTR_TOS] = { .name = \"tos\", .type = BLOBMSG_TYPE_STRING },\n \t[TUNNEL_ATTR_LINK] = { .name = \"link\", .type = BLOBMSG_TYPE_STRING },\n-\t[TUNNEL_ATTR_FMRS] = { .name = \"fmrs\", .type = BLOBMSG_TYPE_ARRAY },\n \t[TUNNEL_ATTR_DATA] = { .name = \"data\", .type = BLOBMSG_TYPE_TABLE },\n };\n \n@@ -78,6 +77,18 @@ const struct uci_blob_param_list sixrd_data_attr_list = {\n \t.params = sixrd_data_attrs,\n };\n \n+static const struct blobmsg_policy fmr_data_attrs[__FMR_DATA_ATTR_MAX] = {\n+\t[FMR_DATA_PREFIX6] = { .name = \"prefix6\", .type = BLOBMSG_TYPE_STRING },\n+\t[FMR_DATA_PREFIX4] = { .name = \"prefix4\", .type = BLOBMSG_TYPE_STRING },\n+\t[FMR_DATA_EALEN] = { .name = \"ealen\", .type = BLOBMSG_TYPE_INT32 },\n+\t[FMR_DATA_OFFSET] = { .name = \"offset\", .type = BLOBMSG_TYPE_INT32 },\n+};\n+\n+const struct uci_blob_param_list fmr_data_attr_list = {\n+\t.n_params = __FMR_DATA_ATTR_MAX,\n+\t.params = fmr_data_attrs,\n+};\n+\n void system_fd_set_cloexec(int fd)\n {\n #ifdef FD_CLOEXEC\ndiff --git a/system.h b/system.h\nindex a5817ca..61c72c2 100644\n--- a/system.h\n+++ b/system.h\n@@ -31,7 +31,6 @@ enum tunnel_param {\n \tTUNNEL_ATTR_TTL,\n \tTUNNEL_ATTR_TOS,\n \tTUNNEL_ATTR_LINK,\n-\tTUNNEL_ATTR_FMRS,\n \tTUNNEL_ATTR_DATA,\n \t__TUNNEL_ATTR_MAX\n };\n@@ -67,10 +66,19 @@ enum sixrd_data {\n \t__SIXRD_DATA_ATTR_MAX\n };\n \n+enum fmr_data {\n+\tFMR_DATA_PREFIX6,\n+\tFMR_DATA_PREFIX4,\n+\tFMR_DATA_EALEN,\n+\tFMR_DATA_OFFSET,\n+\t__FMR_DATA_ATTR_MAX\n+};\n+\n extern const struct uci_blob_param_list vxlan_data_attr_list;\n extern const struct uci_blob_param_list gre_data_attr_list;\n extern const struct uci_blob_param_list vti_data_attr_list;\n extern const struct uci_blob_param_list sixrd_data_attr_list;\n+extern const struct uci_blob_param_list fmr_data_attr_list;\n \n enum bridge_opt {\n \t/* stp and forward delay always set */\n", "prefixes": [ "LEDE-DEV", "netifd" ] }