Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/811838/?format=api
{ "id": 811838, "url": "http://patchwork.ozlabs.org/api/patches/811838/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504907543-14394-2-git-send-email-mrv@mojatatu.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504907543-14394-2-git-send-email-mrv@mojatatu.com>", "list_archive_url": null, "date": "2017-09-08T21:52:21", "name": "[iproute2,1/3] bridge: isolate vlans parsing code in a separate API", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "23f5f61858122d3ae03d3743569c034c3b9c3549", "submitter": { "id": 70341, "url": "http://patchwork.ozlabs.org/api/people/70341/?format=api", "name": "Roman Mashak", "email": "mrv@mojatatu.com" }, "delegate": { "id": 389, "url": "http://patchwork.ozlabs.org/api/users/389/?format=api", "username": "shemminger", "first_name": "stephen", "last_name": "hemminger", "email": "shemminger@vyatta.com" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504907543-14394-2-git-send-email-mrv@mojatatu.com/mbox/", "series": [ { "id": 2294, "url": "http://patchwork.ozlabs.org/api/series/2294/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=2294", "date": "2017-09-08T21:52:20", "name": "Process IFLA_BRIDGE_VLAN_INFO tlv", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2294/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811838/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811838/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@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=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=mojatatu-com.20150623.gappssmtp.com\n\theader.i=@mojatatu-com.20150623.gappssmtp.com\n\theader.b=\"KbszW1z8\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xprfG40SMz9s82\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 9 Sep 2017 07:52:54 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932632AbdIHVww (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 8 Sep 2017 17:52:52 -0400", "from mail-io0-f195.google.com ([209.85.223.195]:37024 \"EHLO\n\tmail-io0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932323AbdIHVwv (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 8 Sep 2017 17:52:51 -0400", "by mail-io0-f195.google.com with SMTP id p63so1715333ioe.4\n\tfor <netdev@vger.kernel.org>; Fri, 08 Sep 2017 14:52:51 -0700 (PDT)", "from mojatatu.com ([64.26.149.125])\n\tby smtp.gmail.com with ESMTPSA id\n\tg5sm1498079ioj.5.2017.09.08.14.52.49\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 08 Sep 2017 14:52:49 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=mojatatu-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=wvNvNJGFEMYMafglTSMi83ikO6gaNNY8UxDuHq+MDN4=;\n\tb=KbszW1z8orv4Vu6KEgLwR/q1FKy1KUTBhf9OILgZOCBHoHkA4VUvsziAxfjiv/zYKj\n\tACg8Tn2CqPCA0zG4IUFVAfD7S4OjQCC4NIxweNkAXukBgKL8jhWUSwxoBYJi4xFJNWx6\n\thhn9U3U/6xTKAYlv4dkJXCVVoDvsV5KXVTsXotyxgalZ4IeiewIp+54sPh81RQ4L09f9\n\tGT7TsznY7FX55DCI9UGWA0KOUWhmFX3GN8GfMwiuaJYeDttWstTt0isOngn4VqgGD+96\n\t4x5a1ADxJAc2UP6cSfED+EPi3TzccN8nxcFzBcFXzBExa77O30Wq3K4YdazN+1kcOYQ9\n\tLaIQ==", "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:in-reply-to\n\t:references;\n\tbh=wvNvNJGFEMYMafglTSMi83ikO6gaNNY8UxDuHq+MDN4=;\n\tb=P5CqV/xmNat/FeZSBZA9SDsofm/vkaWOCMli91t689g0GRE4xDBqYQ4WQs7wol+ecj\n\tS6Y2vIoIOhTXxxDSeHmH6ZXxlZck7s5fOa91qhQ18p15vannSwLtx0wRHyaLFoR+LmJ7\n\t/iXF9J2NiYWpK4fx/yfYK7wGL3UvkSSqtw3R1Qh1V9RbIE8FSRCSv6XD0TJNM1fyuXSC\n\tc55lqwCmsaJVO3Hb8qebp+9jgk7MIrup+Q1OUN4Yz84UE4BBEzlUCAdOehW+1rxhoxU5\n\tdRJGYrWuJrCGxdES129bJ9ABK0xajGDZL72U1RqCE6Og+5x7oi+OgwEjwulBgJCaJSAD\n\tRVTQ==", "X-Gm-Message-State": "AHPjjUi+v3xF7+/CkFBJfAipaRazJu4JRXkxlCaWP2g9ZO/0+96Moi8V\n\t4xGwH3+tCiU5jT01", "X-Google-Smtp-Source": "AOwi7QD+KGc1y312od3hjCurNSD7LBLJDSX+jegAFeyOUL6a59BRPkaBOiTUJdAjslBaPK/X3+5yzQ==", "X-Received": "by 10.107.178.206 with SMTP id\n\tb197mr4568372iof.121.1504907570792; \n\tFri, 08 Sep 2017 14:52:50 -0700 (PDT)", "From": "Roman Mashak <mrv@mojatatu.com>", "To": "stephen@networkplumber.org", "Cc": "netdev@vger.kernel.org, jhs@mojatatu.com, Roman Mashak <mrv@mojatatu.com>", "Subject": "[PATCH iproute2 1/3] bridge: isolate vlans parsing code in a\n\tseparate API", "Date": "Fri, 8 Sep 2017 17:52:21 -0400", "Message-Id": "<1504907543-14394-2-git-send-email-mrv@mojatatu.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1504907543-14394-1-git-send-email-mrv@mojatatu.com>", "References": "<1504907543-14394-1-git-send-email-mrv@mojatatu.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "IFLA_BRIDGE_VLAN_INFO parsing logic will be used in link and vlan\nprocessing code, so it makes sense to move it in the separate function.\n\nSigned-off-by: Roman Mashak <mrv@mojatatu.com>\n---\n bridge/br_common.h | 1 +\n bridge/vlan.c | 145 +++++++++++++++++++++++++++--------------------------\n 2 files changed, 76 insertions(+), 70 deletions(-)", "diff": "diff --git a/bridge/br_common.h b/bridge/br_common.h\nindex c649e7d..01447dd 100644\n--- a/bridge/br_common.h\n+++ b/bridge/br_common.h\n@@ -4,6 +4,7 @@\n #define MDB_RTR_RTA(r) \\\n \t\t((struct rtattr *)(((char *)(r)) + RTA_ALIGN(sizeof(__u32))))\n \n+extern void print_vlan_info(FILE *fp, struct rtattr *tb, int ifindex);\n extern int print_linkinfo(const struct sockaddr_nl *who,\n \t\t\t struct nlmsghdr *n,\n \t\t\t void *arg);\ndiff --git a/bridge/vlan.c b/bridge/vlan.c\nindex ebcdace..fc361ae 100644\n--- a/bridge/vlan.c\n+++ b/bridge/vlan.c\n@@ -189,7 +189,6 @@ static int print_vlan(const struct sockaddr_nl *who,\n \tstruct ifinfomsg *ifm = NLMSG_DATA(n);\n \tint len = n->nlmsg_len;\n \tstruct rtattr *tb[IFLA_MAX+1];\n-\tbool vlan_flags = false;\n \n \tif (n->nlmsg_type != RTM_NEWLINK) {\n \t\tfprintf(stderr, \"Not RTM_NEWLINK: %08x %08x %08x\\n\",\n@@ -218,75 +217,7 @@ static int print_vlan(const struct sockaddr_nl *who,\n \t\t\t\tll_index_to_name(ifm->ifi_index));\n \t\treturn 0;\n \t} else {\n-\t\tstruct rtattr *i, *list = tb[IFLA_AF_SPEC];\n-\t\tint rem = RTA_PAYLOAD(list);\n-\t\t__u16 last_vid_start = 0;\n-\n-\t\tif (!filter_vlan)\n-\t\t\tprint_vlan_port(fp, ifm->ifi_index);\n-\n-\t\tfor (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {\n-\t\t\tstruct bridge_vlan_info *vinfo;\n-\t\t\tint vcheck_ret;\n-\n-\t\t\tif (i->rta_type != IFLA_BRIDGE_VLAN_INFO)\n-\t\t\t\tcontinue;\n-\n-\t\t\tvinfo = RTA_DATA(i);\n-\n-\t\t\tif (!(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END))\n-\t\t\t\tlast_vid_start = vinfo->vid;\n-\t\t\tvcheck_ret = filter_vlan_check(vinfo);\n-\t\t\tif (vcheck_ret == -1)\n-\t\t\t\tbreak;\n-\t\t\telse if (vcheck_ret == 0)\n-\t\t\t\tcontinue;\n-\n-\t\t\tif (filter_vlan)\n-\t\t\t\tprint_vlan_port(fp, ifm->ifi_index);\n-\t\t\tif (jw_global) {\n-\t\t\t\tjsonw_start_object(jw_global);\n-\t\t\t\tjsonw_uint_field(jw_global, \"vlan\",\n-\t\t\t\t\t\t last_vid_start);\n-\t\t\t\tif (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN)\n-\t\t\t\t\tcontinue;\n-\t\t\t} else {\n-\t\t\t\tfprintf(fp, \"\\t %hu\", last_vid_start);\n-\t\t\t}\n-\t\t\tif (last_vid_start != vinfo->vid) {\n-\t\t\t\tif (jw_global)\n-\t\t\t\t\tjsonw_uint_field(jw_global, \"vlanEnd\",\n-\t\t\t\t\t\t\t vinfo->vid);\n-\t\t\t\telse\n-\t\t\t\t\tfprintf(fp, \"-%hu\", vinfo->vid);\n-\t\t\t}\n-\t\t\tif (vinfo->flags & BRIDGE_VLAN_INFO_PVID) {\n-\t\t\t\tif (jw_global) {\n-\t\t\t\t\tstart_json_vlan_flags_array(&vlan_flags);\n-\t\t\t\t\tjsonw_string(jw_global, \"PVID\");\n-\t\t\t\t} else {\n-\t\t\t\t\tfprintf(fp, \" PVID\");\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tif (vinfo->flags & BRIDGE_VLAN_INFO_UNTAGGED) {\n-\t\t\t\tif (jw_global) {\n-\t\t\t\t\tstart_json_vlan_flags_array(&vlan_flags);\n-\t\t\t\t\tjsonw_string(jw_global,\n-\t\t\t\t\t\t \"Egress Untagged\");\n-\t\t\t\t} else {\n-\t\t\t\t\tfprintf(fp, \" Egress Untagged\");\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tif (jw_global && vlan_flags) {\n-\t\t\t\tjsonw_end_array(jw_global);\n-\t\t\t\tvlan_flags = false;\n-\t\t\t}\n-\n-\t\t\tif (jw_global)\n-\t\t\t\tjsonw_end_object(jw_global);\n-\t\t\telse\n-\t\t\t\tfprintf(fp, \"\\n\");\n-\t\t}\n+\t\tprint_vlan_info(fp, tb[IFLA_AF_SPEC], ifm->ifi_index);\n \t}\n \tif (!filter_vlan) {\n \t\tif (jw_global)\n@@ -470,6 +401,80 @@ static int vlan_show(int argc, char **argv)\n \treturn 0;\n }\n \n+void print_vlan_info(FILE *fp, struct rtattr *tb, int ifindex)\n+{\n+\tstruct rtattr *i, *list = tb;\n+\tint rem = RTA_PAYLOAD(list);\n+\t__u16 last_vid_start = 0;\n+\tbool vlan_flags = false;\n+\n+\tif (!filter_vlan)\n+\t\tprint_vlan_port(fp, ifindex);\n+\n+\tfor (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {\n+\t\tstruct bridge_vlan_info *vinfo;\n+\t\tint vcheck_ret;\n+\n+\t\tif (i->rta_type != IFLA_BRIDGE_VLAN_INFO)\n+\t\t\tcontinue;\n+\n+\t\tvinfo = RTA_DATA(i);\n+\n+\t\tif (!(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END))\n+\t\t\tlast_vid_start = vinfo->vid;\n+\t\tvcheck_ret = filter_vlan_check(vinfo);\n+\t\tif (vcheck_ret == -1)\n+\t\t\tbreak;\n+\t\telse if (vcheck_ret == 0)\n+\t\t\tcontinue;\n+\n+\t\tif (filter_vlan)\n+\t\t\tprint_vlan_port(fp, ifindex);\n+\t\tif (jw_global) {\n+\t\t\tjsonw_start_object(jw_global);\n+\t\t\tjsonw_uint_field(jw_global, \"vlan\",\n+\t\t\t\t\t last_vid_start);\n+\t\t\tif (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN)\n+\t\t\t\tcontinue;\n+\t\t} else {\n+\t\t\tfprintf(fp, \"\\t %hu\", last_vid_start);\n+\t\t}\n+\t\tif (last_vid_start != vinfo->vid) {\n+\t\t\tif (jw_global)\n+\t\t\t\tjsonw_uint_field(jw_global, \"vlanEnd\",\n+\t\t\t\t\t\t vinfo->vid);\n+\t\t\telse\n+\t\t\t\tfprintf(fp, \"-%hu\", vinfo->vid);\n+\t\t}\n+\t\tif (vinfo->flags & BRIDGE_VLAN_INFO_PVID) {\n+\t\t\tif (jw_global) {\n+\t\t\t\tstart_json_vlan_flags_array(&vlan_flags);\n+\t\t\t\tjsonw_string(jw_global, \"PVID\");\n+\t\t\t} else {\n+\t\t\t\tfprintf(fp, \" PVID\");\n+\t\t\t}\n+\t\t}\n+\t\tif (vinfo->flags & BRIDGE_VLAN_INFO_UNTAGGED) {\n+\t\t\tif (jw_global) {\n+\t\t\t\tstart_json_vlan_flags_array(&vlan_flags);\n+\t\t\t\tjsonw_string(jw_global,\n+\t\t\t\t\t \"Egress Untagged\");\n+\t\t\t} else {\n+\t\t\t\tfprintf(fp, \" Egress Untagged\");\n+\t\t\t}\n+\t\t}\n+\t\tif (jw_global && vlan_flags) {\n+\t\t\tjsonw_end_array(jw_global);\n+\t\t\tvlan_flags = false;\n+\t\t}\n+\n+\t\tif (jw_global)\n+\t\t\tjsonw_end_object(jw_global);\n+\t\telse\n+\t\t\tfprintf(fp, \"\\n\");\n+\t}\n+}\n+\n int do_vlan(int argc, char **argv)\n {\n \tll_init_map(&rth);\n", "prefixes": [ "iproute2", "1/3" ] }