[{"id":1764805,"web_url":"http://patchwork.ozlabs.org/comment/1764805/","msgid":"<20170907161346.GA25546@vergenet.net>","list_archive_url":null,"date":"2017-09-07T16:13:47","subject":"Re: [ovs-dev] [PATCH 1/2] lib/odp: Fix handling of set masked\n\taction in parse_odp_action","submitter":{"id":64714,"url":"http://patchwork.ozlabs.org/api/people/64714/","name":"Simon Horman","email":"simon.horman@netronome.com"},"content":"On Tue, Aug 29, 2017 at 07:30:23AM +0300, Roi Dayan wrote:\n> From: Paul Blakey <paulb@mellanox.com>\n> \n> If we find that we need to change from a SET to SET_MASKED action,\n> then we write the mask to the actions opfbuf. But if there was netlink\n> pad added to the buffer when writing the key, mask won't follow the\n> key data as per SET_MASKED spec.\n> \n> Fix that by removing the padding before writing the mask, and\n> readding it if needed for alignment.\n> \n> Fixes: 6d670e7f0d45 (\"lib/odp: Masked set action execution and printing.\")\n> Signed-off-by: Paul Blakey <paulb@mellanox.com>\n> Reviewed-by: Roi Dayan <roid@mellanox.com>\n\nSome minor nits below but that notwithstanding\n\nAcked-by: Simon Horman <simon.horman@netronome.com>\n\n> ---\n>  lib/odp-util.c | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/lib/odp-util.c b/lib/odp-util.c\n> index 4f1499e..0594840 100644\n> --- a/lib/odp-util.c\n> +++ b/lib/odp-util.c\n> @@ -1990,8 +1990,17 @@ parse_odp_action(const char *s, const struct simap *port_names,\n>          if (size == nl_attr_get_size(key)) {\n>              /* Change to masked set action if not fully masked. */\n>              if (!is_all_ones(mask + 1, size)) {\n> +                /* remove padding of eariler key payload  */\n> +                actions->size -= NLA_ALIGN(key->nla_len) - key->nla_len;\n> +\n> +                /* put mask payload right after key payload */\n>                  key->nla_len += size;\n>                  ofpbuf_put(actions, mask + 1, size);\n> +\n> +                /* add back the netlink padding, if needed */\n\nMaybe:\n\n                 /* Add new padding as needed */\n\n> +                ofpbuf_put_zeros(actions, NLA_ALIGN(key->nla_len) -\n> +                                          key->nla_len);\n\nThe indentation of the above seems wrong:\n\n+                ofpbuf_put_zeros(actions, NLA_ALIGN(key->nla_len) -\n+                                 key->nla_len);\n\n> +\n>                  /* 'actions' may have been reallocated by ofpbuf_put(). */\n>                  nested = ofpbuf_at_assert(actions, start_ofs, sizeof *nested);\n>                  nested->nla_type = OVS_ACTION_ATTR_SET_MASKED;\n> -- \n> 2.7.0\n>","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>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=netronome-com.20150623.gappssmtp.com\n\theader.i=@netronome-com.20150623.gappssmtp.com\n\theader.b=\"tNZNT0ON\"; dkim-atps=neutral"],"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 3xp59d2GHbz9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 02:13:57 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 2AA98B16;\n\tThu,  7 Sep 2017 16:13:53 +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 CC09CA71\n\tfor <dev@openvswitch.org>; Thu,  7 Sep 2017 16:13:51 +0000 (UTC)","from mail-wr0-f169.google.com (mail-wr0-f169.google.com\n\t[209.85.128.169])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 219FD1D7\n\tfor <dev@openvswitch.org>; Thu,  7 Sep 2017 16:13:51 +0000 (UTC)","by mail-wr0-f169.google.com with SMTP id o42so357244wrb.3\n\tfor <dev@openvswitch.org>; Thu, 07 Sep 2017 09:13:50 -0700 (PDT)","from vergenet.net (44.red-79-158-242.dynamicip.rima-tde.net.\n\t[79.158.242.44])\n\tby smtp.gmail.com with ESMTPSA id 77sm8938wmx.10.2017.09.07.09.13.47\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 07 Sep 2017 09:13:48 -0700 (PDT)"],"X-Greylist":"whitelisted by SQLgrey-1.7.6","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=netronome-com.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to:user-agent;\n\tbh=cTiuLymmCxBu0cma05ytEmY+160PKjMgXU5ypcU0vH0=;\n\tb=tNZNT0ON400DVzWPzXpcgr9Sir3T3b+baIxvTjB84xqAWem/boAliTpnQHuNCLT/ta\n\tc91kBLthkUUR2TJrdFxeB1SNsHsO5cl7IU6t/MC3LIDnBWxx+BjQu/HTyj3cOX/QNeva\n\tYmJYVhjWjDqe+RFNeAaH1XlJdyM0D/XB84Jo7dTOKzk+KK5pGVWH2pKO6MIV+hkVy5M0\n\tGli9aIwSrB7rx5mbs5yaoYDnitCAWhvYvnAfWd4KlegLpgv/JIpFNR/PgPY8BPFQ/CL9\n\tR32d3r3yRwllLPSUEbLtLR3Z6RFdzjitQoK268wfFjfv1ZXPam5yMljyFZITMT0s3Wrj\n\tD3ng==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=cTiuLymmCxBu0cma05ytEmY+160PKjMgXU5ypcU0vH0=;\n\tb=kY5sfmzISeph5PCoPWADRTQ++WuP3cY7KADCZ3MIIY+YqU7uP7ASnflWHPUG5Oxob5\n\tqOx5z8tw4hZWrqNJn6sRb61lhak1JRil96tb3IolQ/eq8z8xKoHFO3Z05kG3pXe1b1ww\n\tYpSrr4od54ZF2LrCUCqxRQSxNkpdfBfvgb4diyVMJHCviQIx3tdHFivrm0QDqVWOHHO7\n\trUi5mw0K5u5h+nkIdHRUvZbJ0BXjTmJJPrhsydsxSfDy7GSyQhkExd3UVRjROQ+4G2Ar\n\tPOssL0ctUHy7iMH6KE2QYDVz+cviqKl7GSMGQmtQGfARDb5kAB6lf8syGD9pw2eLNa8h\n\tXO3w==","X-Gm-Message-State":"AHPjjUgm2jXeSL0qWczJ91FTPTJG12Hy4dX6ZP4zSS3uOPltQZ4vnQq1\n\tlVu0bAJqwadsfv2L","X-Google-Smtp-Source":"ADKCNb5iJMhwULl8Vp0EXupvi5/FrAbUjs+7rZuOXzXk4gtdiA4QCcnTIHe1Hzlu4RUxdPef2VyRKA==","X-Received":"by 10.223.134.248 with SMTP id 53mr2292165wry.57.1504800828753; \n\tThu, 07 Sep 2017 09:13:48 -0700 (PDT)","Date":"Thu, 7 Sep 2017 18:13:47 +0200","From":"Simon Horman <simon.horman@netronome.com>","To":"Roi Dayan <roid@mellanox.com>","Message-ID":"<20170907161346.GA25546@vergenet.net>","References":"<1503981024-3627-1-git-send-email-roid@mellanox.com>\n\t<1503981024-3627-2-git-send-email-roid@mellanox.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<1503981024-3627-2-git-send-email-roid@mellanox.com>","User-Agent":"Mutt/1.5.23 (2014-03-12)","X-Spam-Status":"No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Cc":"dev@openvswitch.org","Subject":"Re: [ovs-dev] [PATCH 1/2] lib/odp: Fix handling of set masked\n\taction in parse_odp_action","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}}]