From patchwork Wed Dec 5 18:55:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="s/3ZHE7W"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397Hp2cf2z9s8J for ; Thu, 6 Dec 2018 05:56:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 371E7B0B; Wed, 5 Dec 2018 18:56:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 06878B08 for ; Wed, 5 Dec 2018 18:56:00 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6F955830 for ; Wed, 5 Dec 2018 18:55:59 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id c123so10470672pfb.0 for ; Wed, 05 Dec 2018 10:55:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dENcs4/JwrU09yt+jdzBMvT1zY8lcuSK97mOZaIeeYs=; b=s/3ZHE7WChrsC5kmXW13PPcBBcDN2tmTNNA4/9K10Klr1s4aJXgRcNM+SwfrsIk59S qvpQrN++RO8/4QjXUwAdcBHRup3uqIlCzXbbJc1IjNb3qKu9jsSwFp4s9FxdR/wskulr Kkq9LDCVoizQPNCphz1sR6HQGZUp7Ecfc+Oiqs4Y8PxL714tkQKOsfWgQmvKvwDD8MX4 kkaOEiMjVyz6fkdw/MNzf93AlhN6MOFE39NtTF63IBL0P+08FaYNmu8JblkWdqLX1WJ2 d1FXwHsW/DRqSuERqkt5ttTBV+9C3WezdX9k3g2fZPAHhHvFLGjrYl10nKKEBc20uJzl RsrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dENcs4/JwrU09yt+jdzBMvT1zY8lcuSK97mOZaIeeYs=; b=lqnygTiO0AaeuUtL1qcKN43tRwvOqd94RN3OsgiUlcX7Tso9TYlqYcsPbQzvc5oe5j 0fcx2dkPS/JKLOAau0TRkBerjRWhGAA1uMnFdj9QHIbCAt84knuSA1v30/j9SFJmc41g IBHOwN4YX+rgahTWYBbG12gzLcR8mAqGLc9S/4bghc1slZ/CAmqWOEBb2AGIamoHHzO2 oxJI7ihkvYSHU7Q5ItpSS41Bbx8zeCz9WpC2HoAWKucvbNh1G6Keh2F+uUoKGMAee2TM dhUuFJC0jYGnBWPAoGaySL1P9lxVaZ0Fl36duSFgTlhOif555Cth1myRcUeS0z3MZhcf IstQ== X-Gm-Message-State: AA+aEWY/4RRG2Qu1p8pFfzBlKpD3ifk/jDL3kfMCQB/KzJ/giI7jaedU NFbecgyOhAASc6Gl5++24I4QaY6K X-Google-Smtp-Source: AFSGD/XojPHsSVuahp8Ar3/OobRi33LIYXkY2OY4b3LwYoSpNrcbSHHj9asbHHuYfS2ODMzTc3zgLA== X-Received: by 2002:a63:990a:: with SMTP id d10mr20416373pge.279.1544036158580; Wed, 05 Dec 2018 10:55:58 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.55.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:55:57 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:45 -0800 Message-Id: <1544036152-27247-2-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Kees Cook Subject: [ovs-dev] [PATCH 1/8] datapath: kmalloc() -> kmalloc_array() X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Kees Cook Upstream commit: commit 6da2ec56059c3c7a7e5f729e6349e74ace1e5c57 Author: Kees Cook Date: Tue Jun 12 13:55:00 2018 -0700 treewide: kmalloc() -> kmalloc_array() The kmalloc() function has a 2-factor argument form, kmalloc_array(). This patch replaces cases of: kmalloc(a * b, gfp) with: kmalloc_array(a * b, gfp) as well as handling cases of: kmalloc(a * b * c, gfp) with: kmalloc(array3_size(a, b, c), gfp) as it's slightly less ugly than: kmalloc_array(array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: kmalloc(4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. The tools/ directory was manually excluded, since it has its own implementation of kmalloc(). The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ type TYPE; expression THING, E; @@ ( kmalloc( - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | kmalloc( - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression COUNT; typedef u8; typedef __u8; @@ ( kmalloc( - sizeof(u8) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(__u8) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(char) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(unsigned char) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(u8) * COUNT + COUNT , ...) | kmalloc( - sizeof(__u8) * COUNT + COUNT , ...) | kmalloc( - sizeof(char) * COUNT + COUNT , ...) | kmalloc( - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - kmalloc + kmalloc_array ( - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ identifier SIZE, COUNT; @@ - kmalloc + kmalloc_array ( - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( kmalloc( - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( kmalloc( - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kmalloc( - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kmalloc( - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ identifier STRIDE, SIZE, COUNT; @@ ( kmalloc( - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression E1, E2, E3; constant C1, C2, C3; @@ ( kmalloc(C1 * C2 * C3, ...) | kmalloc( - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | kmalloc( - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | kmalloc( - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | kmalloc( - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( kmalloc(sizeof(THING) * C2, ...) | kmalloc(sizeof(TYPE) * C2, ...) | kmalloc(C1 * C2 * C3, ...) | kmalloc(C1 * C2, ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - (E1) * E2 + E1, E2 , ...) | - kmalloc + kmalloc_array ( - (E1) * (E2) + E1, E2 , ...) | - kmalloc + kmalloc_array ( - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook CC: Kees Cook Signed-off-by: Greg Rose --- datapath/datapath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 3f1cdb0..2febcb3 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1594,8 +1594,9 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) goto err_destroy_table; } - dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), - GFP_KERNEL); + dp->ports = kmalloc_array(DP_VPORT_HASH_BUCKETS, + sizeof(struct hlist_head), + GFP_KERNEL); if (!dp->ports) { err = -ENOMEM; goto err_destroy_percpu; From patchwork Wed Dec 5 18:55:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gtCx5kp5"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397JX6w45z9s8J for ; Thu, 6 Dec 2018 05:57:16 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D27A1B43; Wed, 5 Dec 2018 18:56:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 30685AF0 for ; Wed, 5 Dec 2018 18:56:01 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 92F61830 for ; Wed, 5 Dec 2018 18:56:00 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id z23so10502714plo.0 for ; Wed, 05 Dec 2018 10:56:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2AR24lErDEMJGyclpzt76BF9XnLbcTOex6f0ESNuMp4=; b=gtCx5kp537LW/eQGIilCF/KsRXSH6/NW2d93SP+8OpGgTD0m/VQnb7EJ+GFkkjrfbb znkdve+7Pot++CWXMNras45EIn+DTCHXi2n/+qc3ES3OMzB68RkfDjANzlz+hAg6jer1 4zXArFj8XusApdwuBRzJAiI/nmjqANBUlFFXl9qa3uq365Kt9ctD5ft5SE3G7bXXLeRF xtmol8yMm4FdNVnDm5vjX8RJQm11BU3iQNwbAKfg+pblC4qkksBh1rnBJLGzosRkrm7U RGUTLyKtC7toy29kjLHhnBlVVY7n14LfWLcITDTimmJf3iXAi+Swp3+JcpnK1safkzNv rzJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2AR24lErDEMJGyclpzt76BF9XnLbcTOex6f0ESNuMp4=; b=LJCAQ57zBNzi6SDOG+DWAHhEzy1dgnEFxY5p+SWlmfeOwjvSrIfciV6KJDIO43IqBR BX++kgWUKPx1sC3aUUJJfVi88C6CymCXvpmjOwE1e0lpi/ltanbBdp4EZvIjzf8SvMS3 FMrFC3+4EHoCvfywkvb9ly742pN/nfdxPePMwdp26p43xwsQ7GNL6bCe0+58kuKFzyrz ZeF3GEAx4b32th/wESHQ+WM7nzVxHEnazBl0uXQm7odXqV2VUJXjhD7ArAhho7mBcaBg jIgEn1YaOr57K/lqhCw4V8BOyfauCHK4XbklFYGHb0l0/Vncj8W48jAaQiAUWsWJ2DF4 RH3Q== X-Gm-Message-State: AA+aEWbjh6GD5LYltbrr1Gq42dlUFXZN6lY56ZsIc/nxTZfFCS0kqR0P HMt3KPVGejQK4b6W63iZrDIZmpqM X-Google-Smtp-Source: AFSGD/VTqCUiz12OK7tBVR4dSfIGkKnYbvqMv1Sflj+cjUr00LxvVbmUdsFUKWkcT3XCvukdw7hQTA== X-Received: by 2002:a17:902:ab84:: with SMTP id f4mr24685550plr.207.1544036159841; Wed, 05 Dec 2018 10:55:59 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.55.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:55:59 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:46 -0800 Message-Id: <1544036152-27247-3-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Kees Cook Subject: [ovs-dev] [PATCH 2/8] datapath: kzalloc() -> kcalloc() X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Kees Cook Upstream commit: commit 6396bb221514d2876fd6dc0aa2a1f240d99b37bb Author: Kees Cook Date: Tue Jun 12 14:03:40 2018 -0700 treewide: kzalloc() -> kcalloc() The kzalloc() function has a 2-factor argument form, kcalloc(). This patch replaces cases of: kzalloc(a * b, gfp) with: kcalloc(a * b, gfp) as well as handling cases of: kzalloc(a * b * c, gfp) with: kzalloc(array3_size(a, b, c), gfp) as it's slightly less ugly than: kzalloc_array(array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: kzalloc(4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ type TYPE; expression THING, E; @@ ( kzalloc( - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | kzalloc( - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression COUNT; typedef u8; typedef __u8; @@ ( kzalloc( - sizeof(u8) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(__u8) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(char) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(unsigned char) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(u8) * COUNT + COUNT , ...) | kzalloc( - sizeof(__u8) * COUNT + COUNT , ...) | kzalloc( - sizeof(char) * COUNT + COUNT , ...) | kzalloc( - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - kzalloc + kcalloc ( - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ identifier SIZE, COUNT; @@ - kzalloc + kcalloc ( - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( kzalloc( - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kzalloc( - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kzalloc( - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kzalloc( - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( kzalloc( - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kzalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kzalloc( - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kzalloc( - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kzalloc( - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | kzalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ identifier STRIDE, SIZE, COUNT; @@ ( kzalloc( - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression E1, E2, E3; constant C1, C2, C3; @@ ( kzalloc(C1 * C2 * C3, ...) | kzalloc( - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | kzalloc( - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | kzalloc( - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | kzalloc( - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( kzalloc(sizeof(THING) * C2, ...) | kzalloc(sizeof(TYPE) * C2, ...) | kzalloc(C1 * C2 * C3, ...) | kzalloc(C1 * C2, ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - kzalloc + kcalloc ( - (E1) * E2 + E1, E2 , ...) | - kzalloc + kcalloc ( - (E1) * (E2) + E1, E2 , ...) | - kzalloc + kcalloc ( - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook CC: Kees Cook Signed-off-by: Greg Rose Acked-by: William Tu --- datapath/vport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/vport.c b/datapath/vport.c index e1b321f..ed7f23e 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -58,7 +58,7 @@ int ovs_vport_init(void) { int err; - dev_table = kzalloc(VPORT_HASH_BUCKETS * sizeof(struct hlist_head), + dev_table = kcalloc(VPORT_HASH_BUCKETS, sizeof(struct hlist_head), GFP_KERNEL); if (!dev_table) return -ENOMEM; From patchwork Wed Dec 5 18:55:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008391 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tg09QmNe"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397KM2Gnsz9s8J for ; Thu, 6 Dec 2018 05:57:59 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 72C4DB63; Wed, 5 Dec 2018 18:56:03 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E6AE3B4B for ; Wed, 5 Dec 2018 18:56:01 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AA5E6808 for ; Wed, 5 Dec 2018 18:56:01 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id y4so9412457pgc.12 for ; Wed, 05 Dec 2018 10:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jdWNxFXbAqOu5qmhJDDG9RyQj6k7zMHAOd7RaRyh3vk=; b=tg09QmNedJiTUaIabgT1Z85bfYudBgAnKWy0UXeVPrIX4Y2ocqgmSOHZ2MM/LcupAw 6aT4raJXI4ATBRxPJWR7SmPlH5Oq6YtF4b6VziaJknFjPot3Dz/VY8tVdHFijcegOWj/ MGVNx2xutkWoA7FpNI9ytOYD1k9eF7rpQoQiDnUiD1Axy7KwVLOAvEsD/W1sxsOBQRoK tY09tLtMaR++VbVckvyzxt3P7RR8K8WnUK3gnIL3QJ/lQttQ7DEb6Tuk4WMX+jcWMKE+ DmTqQjdRgNXI3l1ENjeTjIpMh8saMoBYpL8GyCwgDelPMvua9/dRrjKszPBgpkHKXVpy uF7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jdWNxFXbAqOu5qmhJDDG9RyQj6k7zMHAOd7RaRyh3vk=; b=oRj2qsAI6rqYNyoFW7WSC6/DyuOh1FnWF7heKNtJ74ZYMlpz6UyI44JDdyvUo33LLZ BcKh6F6KcVDbCIrWeFDpsZOToruY063PN3LElZBkJJvFGw5pXtuu6+Vy3+2IXvVtOXny gJ9Fb5MGRJy/JelKmqZiUYcyMfbY6H+MfsmkLplC8gMtuWjjVvy5nVuUjEvMGI4jdtf6 XFt4XDprSJCCFXYxQ8fEW3yoBnDy439sAdnal38LGMUNKg2F5oFwVhmWF+5gwBv1gRbH 2wr55ecn2/UiQnNF9ZUQBKBy7WGOk/Bt0Uw4k34U0bxEsJxWUt9XFUEDLpfkwWrbWXUi ovLw== X-Gm-Message-State: AA+aEWYDXy0kqN9MCH8zRfh4Fk6bdSwiTN4qqyDetMmymAzXpG359h/t eNx87iV343RJjIQfjgohzH0SLKbl X-Google-Smtp-Source: AFSGD/V5bLfR8Ak2YHAf615qimUbshFZba7scWOmD3jqYYO6AZA7G/XP1xZkWvkIcjb9BI8ALVHA0Q== X-Received: by 2002:a63:413:: with SMTP id 19mr20110404pge.7.1544036160851; Wed, 05 Dec 2018 10:56:00 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.55.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:00 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:47 -0800 Message-Id: <1544036152-27247-4-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 3/8] compat: Fixup ip_tunnel_info_opts_set X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org A new flags parameter has been added in 4.19 so add compat fixup. Signed-off-by: Greg Rose Reviewed-by: Yifeng Sun --- acinclude.m4 | 3 +++ datapath/linux/compat/include/net/ip_tunnels.h | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index ed83df4..92b4d6c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -897,6 +897,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_VOID_NDO_GET_STATS64])]) OVS_GREP_IFELSE([$KSRC/include/linux/timer.h], [init_timer_deferrable], [OVS_DEFINE([HAVE_INIT_TIMER_DEFERRABLE])]) + OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip_tunnels.h], + [ip_tunnel_info_opts_set], [flags], + [OVS_DEFINE([HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index ce6fca4..dd90306 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -13,7 +13,21 @@ #define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000) #endif #define ovs_ip_tunnel_encap ip_tunnel_encap -#else + +#ifndef HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS +static inline void rpl_ip_tunnel_info_opts_set(struct ip_tunnel_info *info, + const void *from, int len, + __be16 flags) +{ + memcpy(ip_tunnel_info_opts(info), from, len); + info->options_len = len; + info->key.tun_flags |= flags; +} + +#define ip_tunnel_info_opts_set rpl_ip_tunnel_info_opts_set +#endif + +#else /* USE_UPSTREAM_TUNNEL */ #include #include From patchwork Wed Dec 5 18:55:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008392 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YeuWv3kj"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397LN2mwVz9s8J for ; Thu, 6 Dec 2018 05:58:52 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2BD18B80; Wed, 5 Dec 2018 18:56:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4E902B4C for ; Wed, 5 Dec 2018 18:56:03 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id DEFE9808 for ; Wed, 5 Dec 2018 18:56:02 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id g62so10445461pfd.12 for ; Wed, 05 Dec 2018 10:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GEoK2BhfUv4QzIYlrMU6WUWhnOdDI1UNrepR6SThoGA=; b=YeuWv3kjj3rp/S7AgeQIMK6PgOrxV1QCwt8I4Pku+1uiQPn1dCGNqqtAOj8TgkMCdr KyuxUigSMq6oseOoJr2a0GDQ2sTlydaL/pL4OsfrDEIVfImPqN5nM8ULatbQDaKhZIWU xe/sDTv+O5+FbRdfD9xzCCoipxfxOCNzddNCsCM7JaVasSKPmeW38Sg5oNWA6fiysBgf R5FY7Zss+l1rLyVzcfaP3L61jnq3TT7ijg6/DGKUN6sNuHyy0p4hO2aeaYOiKdY1uguj 2gY1oy9OqflX9nNdtFVyz+u0wazx3nvPAVxBbq3hVrczgfMNAVXpHDr6UsBsAYmhKs9n 8UzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GEoK2BhfUv4QzIYlrMU6WUWhnOdDI1UNrepR6SThoGA=; b=RApUyncFAuixFEoJPF3V8/B4dlysJ/tnpHd2qY96eCvIybnWU0KDNEvBK0SdGysYUF dVPvzEBobllSSOrkyS1mckUOjzuV4ScnbiJyl7YuTLK3vmwkv+yaSvOrVCU+q/iqwz+B PI/vcPpuwf063MCw+iRPP8Fj2YU3mYFZKU5C2kyqQi1Nu95SFl1SHxdErKz3L2liFqcW G6EFJ6iKyb8qdE5lVRvJMMSiK7Zx8pDe7HnwHNMdq3R+hrarnO2+YlWSIv6Crt1l39SF vGEMjXMFs5OX5xq1FEST35hGPkPcy6nXG10jaGpWmUdZX5fNzXczj88lc5R4EU1gA7Fo qdDA== X-Gm-Message-State: AA+aEWatU26nGOT8XEbOFeAVX2Bp7fWWxelRzDQfFhIOwHhKNrQWDwvX uvp7g3lEZ5tFrdWKY1tNFc9BlJmT X-Google-Smtp-Source: AFSGD/VPlP9Hy7p81vMK2i13g8VFQDW0A4HKvW9PzvJTOrh5cJcZ55Ye9ZhIP8sK31Nd71EDzzmGzw== X-Received: by 2002:a63:cb4a:: with SMTP id m10mr20578768pgi.105.1544036162069; Wed, 05 Dec 2018 10:56:02 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:01 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:48 -0800 Message-Id: <1544036152-27247-5-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Pieter Jansen van Vuuren Subject: [ovs-dev] [PATCH 4/8] datapath: check tunnel option type in tunnel flags X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Pieter Jansen van Vuuren Upstream commit: commit 256c87c17c53e60882a43dcf3e98f3bf859eaf6f Author: Pieter Jansen van Vuuren Date: Tue Jun 26 21:39:36 2018 -0700 net: check tunnel option type in tunnel flags Check the tunnel option type stored in tunnel flags when creating options for tunnels. Thereby ensuring we do not set geneve, vxlan or erspan tunnel options on interfaces that are not associated with them. Make sure all users of the infrastructure set correct flags, for the BPF helper we have to set all bits to keep backward compatibility. Signed-off-by: Pieter Jansen van Vuuren Signed-off-by: Jakub Kicinski Signed-off-by: David S. Miller CC: Pieter Jansen van Vuuren Signed-off-by: Greg Rose Acked-by: William Tu --- datapath/flow_netlink.c | 7 ++++++- datapath/linux/compat/geneve.c | 3 ++- datapath/linux/compat/include/net/ip_tunnels.h | 4 +++- datapath/linux/compat/ip_gre.c | 2 ++ datapath/linux/compat/vxlan.c | 3 ++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index ee0c184..19341bc 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -2521,7 +2521,9 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, struct ovs_tunnel_info *ovs_tun; struct nlattr *a; int err = 0, start, opts_type; + __be16 dst_opt_type; + dst_opt_type = 0; ovs_match_init(&match, &key, true, NULL); opts_type = ip_tun_from_nlattr(nla_data(attr), &match, false, log); if (opts_type < 0) @@ -2533,10 +2535,13 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, err = validate_geneve_opts(&key); if (err < 0) return err; + dst_opt_type = TUNNEL_GENEVE_OPT; break; case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS: + dst_opt_type = TUNNEL_VXLAN_OPT; break; case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS: + dst_opt_type = TUNNEL_ERSPAN_OPT; break; } } @@ -2578,7 +2583,7 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, */ ip_tunnel_info_opts_set(tun_info, TUN_METADATA_OPTS(&key, key.tun_opts_len), - key.tun_opts_len); + key.tun_opts_len, dst_opt_type); add_nested_action_end(*sfa, start); return err; diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c index 77632ae..c044b14 100644 --- a/datapath/linux/compat/geneve.c +++ b/datapath/linux/compat/geneve.c @@ -252,7 +252,8 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, goto drop; /* Update tunnel dst according to Geneve options. */ ip_tunnel_info_opts_set(&tun_dst->u.tun_info, - gnvh->options, gnvh->opt_len * 4); + gnvh->options, gnvh->opt_len * 4, + TUNNEL_GENEVE_OPT); } else { /* Drop packets w/ critical options, * since we don't support any... diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index dd90306..da64a94 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -214,10 +214,12 @@ static inline void ip_tunnel_info_opts_get(void *to, } static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info, - const void *from, int len) + const void *from, int len, + __be16 flags) { memcpy(ip_tunnel_info_opts(info), from, len); info->options_len = len; + info->key.tun_flags |= flags; } static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 0faf8ab..89ef455 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -601,6 +601,8 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev, goto err_free_skb; key = &tun_info->key; + if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) + goto err_free_rt; md = ip_tunnel_info_opts(tun_info); if (!md) goto err_free_rt; diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c index b38a7be..23118e8 100644 --- a/datapath/linux/compat/vxlan.c +++ b/datapath/linux/compat/vxlan.c @@ -1101,7 +1101,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, label = info->key.label; udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM); - if (info->options_len) + if (info->options_len && + info->key.tun_flags & TUNNEL_VXLAN_OPT) md = ip_tunnel_info_opts(info); } else { md->gbp = skb->mark; From patchwork Wed Dec 5 18:55:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="truA01EB"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397M43Kxzz9s8J for ; Thu, 6 Dec 2018 05:59:28 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id B38A0B8F; Wed, 5 Dec 2018 18:56:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 50DAEB79 for ; Wed, 5 Dec 2018 18:56:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id F0F0A830 for ; Wed, 5 Dec 2018 18:56:03 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id 17so9444976pgg.1 for ; Wed, 05 Dec 2018 10:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lkvyKmB0RG/1xagOCeVie1r3EYUbJHV62bPSj2X9/qA=; b=truA01EBnaAEfrWl/iOFv6elUuqGEIyn3Jd70iNqGHgXQ5CL0cbPKkvFArYh/wGls/ EB6O/csLowu2l69Ie9pgv5lxaJ260lr5QdVyM9fzubGoV45mGswqp6SMAMtuyBJyDVMj VBzqosiUAIAxVZHPxATuIUVA2Ofty58uCGmk4L3bw3qz20dnHXsY1S7+ywrdzbxao7ST 2fCMq0bq0gO4GXDzCstsbW25Qx3xLY92O1uJAMLggj1lTk91b8fx4aFwrSxPMipWb/SC jam5T9dbrCVfzGXOEnlLuHY2Hx86daxmKg5EynpwAnk/vqvvUePIno/BQF40/rrH6Nlh WR+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lkvyKmB0RG/1xagOCeVie1r3EYUbJHV62bPSj2X9/qA=; b=ba+oUi70GziMA06LVAJuCiS2F5Hvb16w78ZcKd4bc2iQ4+th2/6wsHjcqI8hDOzVxx vcS6h7tfu0PRk6ZkVawlvFwEzp/r/sGbm3IsFdpctum9afoUl2gCunNIDudv+Leu1KHl 0tM4dBxCHqr5nTzqyP2LP1beY1gYahb1igUomp0RVjvCZLsfimJ8pQ/uANa/CKEHxzrZ bQBwOsznMc5CcJloRhexGuRhpCMxb2Rt/TyRX724Brv11waIu8ftuFLxpU2Q+6lmOpq2 X+QGy8fIaH4yKU+PzdYv7Vfm/EeEX13CIR/VKBiYt8WKf/a+d4+k8nOd2wNau+9BvWq7 jZlA== X-Gm-Message-State: AA+aEWZegfP2QwqsdOarH9ru5v+JmwaYvjFFqH005nBAW/oM7js0nSXs h4Q4EOtKx9TYxyC09GwYFoG9E/hV X-Google-Smtp-Source: AFSGD/WJf5/bWRp8u7v0VXPPI5qWChj5OocuepIJyHFFI7u760H2KDNNgAUyyVEyl6GvhRRaiuY8BA== X-Received: by 2002:a63:160d:: with SMTP id w13mr22038806pgl.43.1544036163265; Wed, 05 Dec 2018 10:56:03 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:02 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:49 -0800 Message-Id: <1544036152-27247-6-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 5/8] datapath: Derive IP protocol number for IPv6 later frags X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Yi-Hung Wei Upstream commit: commit fa642f08839bf2ff35b2f6c6a6c062aee8121ba8 Author: Yi-Hung Wei Date: Tue Sep 4 15:33:41 2018 -0700 openvswitch: Derive IP protocol number for IPv6 later frags Currently, OVS only parses the IP protocol number for the first IPv6 fragment, but sets the IP protocol number for the later fragments to be NEXTHDF_FRAGMENT. This patch tries to derive the IP protocol number for the IPV6 later frags so that we can match that. Signed-off-by: Yi-Hung Wei Acked-by: Pravin B Shelar Signed-off-by: David S. Miller CC: Yi-Hung Wei Signed-off-by: Greg Rose Acked-by: Yi-Hung Wei --- datapath/flow.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/datapath/flow.c b/datapath/flow.c index fadc074..f685cf3 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -254,21 +254,18 @@ static bool icmphdr_ok(struct sk_buff *skb) static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key) { + unsigned short frag_off; + unsigned int payload_ofs = 0; unsigned int nh_ofs = skb_network_offset(skb); unsigned int nh_len; - int payload_ofs; struct ipv6hdr *nh; - uint8_t nexthdr; - __be16 frag_off; - int err; + int err, nexthdr, flags = 0; err = check_header(skb, nh_ofs + sizeof(*nh)); if (unlikely(err)) return err; nh = ipv6_hdr(skb); - nexthdr = nh->nexthdr; - payload_ofs = (u8 *)(nh + 1) - skb->data; key->ip.proto = NEXTHDR_NONE; key->ip.tos = ipv6_get_dsfield(nh); @@ -277,10 +274,9 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key) key->ipv6.addr.src = nh->saddr; key->ipv6.addr.dst = nh->daddr; - payload_ofs = ipv6_skip_exthdr(skb, payload_ofs, &nexthdr, &frag_off); - - if (frag_off) { - if (frag_off & htons(~0x7)) + nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags); + if (flags & IP6_FH_F_FRAG) { + if (frag_off) key->ip.frag = OVS_FRAG_TYPE_LATER; else key->ip.frag = OVS_FRAG_TYPE_FIRST; @@ -288,11 +284,11 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key) key->ip.frag = OVS_FRAG_TYPE_NONE; } - /* Delayed handling of error in ipv6_skip_exthdr() as it - * always sets frag_off to a valid value which may be + /* Delayed handling of error in ipv6_find_hdr() as it + * always sets flags and frag_off to a valid value which may be * used to set key->ip.frag above. */ - if (unlikely(payload_ofs < 0)) + if (unlikely(nexthdr < 0)) return -EPROTO; nh_len = payload_ofs - nh_ofs; From patchwork Wed Dec 5 18:55:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lA/FoYfC"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397Mc0gk4z9s8J for ; Thu, 6 Dec 2018 05:59:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4CEDDBA2; Wed, 5 Dec 2018 18:56:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id AFAEFB7D for ; Wed, 5 Dec 2018 18:56:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 476D3830 for ; Wed, 5 Dec 2018 18:56:05 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id n2so9435286pgm.3 for ; Wed, 05 Dec 2018 10:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IAN63j53gCicXE89t2Bi7skoyOdghOhvRoDHGU0HeUc=; b=lA/FoYfCucZWchE6kgrnfvX82Ro3yZ72HzC3zA72Y2uIk4RsshplGYHemKHK4KLJCY uO2n5f+dZs1927it/bfR7GdyFPkO2YOoM8DXWspjL7yV1axQ0D9z2/FR3sLhganrQz3I rHcth9HrVKAlVAuypi7E8JyJBJZJ5m3PItUpnKr8uVIUsEVpbH1RIrLJLnB2llEMNiAW W8/uIvbN4v9wuDx7zFpTjWipo1orFtMhrSyQaUqMzZTXEK5SDlIDDs66P1qKHJLdHvgj TmnmlNlHLXGBlrFadwM0y/1w1bY+RspFIEaZBp+R4tKzEsBQUgo/ZJoO30mXI1hpGGe4 RS/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IAN63j53gCicXE89t2Bi7skoyOdghOhvRoDHGU0HeUc=; b=hL9w3BqLzd5N5vJxMZjK6aR+1nHe7A/XNlG/g2lhYjPkCnYn+P0laj8qg4OO6YRlHN lRshZaV8w6TmSyv9mW6UeSy0BUYxk7OVOQAqJ91qzWHJH4q4PJCSdK58agYiGDKozEZJ yOXntVTSuODoivMTCkHW78POh9S6F54/opJC33xEZj3aLkwH3lgyONdwGF1eWMAiRjjB bvFBeDdIizlFB/5UE1a09wnEfIlXHnAuhfmcx8VYEJ5iHm5WRbLYgYrsANal40k+JjlC PLcsHlBIXWAAR7ECpk8plWefmd3uGymT+7eX/qI+KbHtfzw6X4Ps4PUAwOUN3MXaFW5s o90A== X-Gm-Message-State: AA+aEWYZod/exZCl/TNIoZXlOcTm33gKubU/2wzqSaEbMkMYVMeGWOUe 6cT8CrUDJ2/XRAHjRLdrdr0q9ZpR X-Google-Smtp-Source: AFSGD/XwzBXZeU1JOXdWgR2gjVhYgdXLiGi+aZSjQaPgvD1k2DBLH7/OQF/tIimHmxD0CdfeSCa6iQ== X-Received: by 2002:a63:790e:: with SMTP id u14mr20168879pgc.452.1544036164463; Wed, 05 Dec 2018 10:56:04 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.56.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:03 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:50 -0800 Message-Id: <1544036152-27247-7-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: YueHaibing Subject: [ovs-dev] [PATCH 6/8] datapath: fix return type of ndo_start_xmit function X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: YueHaibing Upstream commit: commit eddf11e18dff0e8671e06ce54e64cfc843303ab9 Author: YueHaibing Date: Wed Sep 26 17:15:38 2018 +0800 net: ovs: fix return type of ndo_start_xmit function The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, so make sure the implementation in this driver has returns 'netdev_tx_t' value, and change the function return type to netdev_tx_t. Found by coccinelle. Signed-off-by: YueHaibing Signed-off-by: David S. Miller CC: YueHaibing Signed-off-by: Greg Rose Acked-by: William Tu --- datapath/vport-internal_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index 629965e..0318f58 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -43,7 +43,8 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev) } /* Called with rcu_read_lock_bh. */ -static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) +static netdev_tx_t +internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) { int len, err; @@ -62,7 +63,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) } else { netdev->stats.tx_errors++; } - return 0; + return NETDEV_TX_OK; } static int internal_dev_open(struct net_device *netdev) From patchwork Wed Dec 5 18:55:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="H2Wj7ThW"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397N920cQz9sB7 for ; Thu, 6 Dec 2018 06:00:25 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D5B14BAD; Wed, 5 Dec 2018 18:56:09 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0C833B8A for ; Wed, 5 Dec 2018 18:56:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CDCE7808 for ; Wed, 5 Dec 2018 18:56:06 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id 80so9426019pge.4 for ; Wed, 05 Dec 2018 10:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nZFSCwvEroB1rMUOvCLmr/Arm0pjhBuuQg3BGWXKT9g=; b=H2Wj7ThWdkbX1s7qyKgXdTgROsPvomsO99JK95Ea7eb7qTaPpoAWLPoXGMwI97Hot4 hDwmluBvlTgOiDZRfD1+Al7+YvuN5Z0DVNu5LwsHs7ShBGLisIvBGX7aIERJLZnDpYOs 8kAGao8G2X7BpzyZtY7PaVbPH0nwfIe+jt61slQRAGBidViC/enNp8oEAWqlEx6g78D0 NyoeBy8GiRqd3QzxMKtuAF5OLpF70i7v8IyhikJpKv9P+GnHu0yXIosa0Zrls8wP9WUH aS1ha1/ejdLJ4Zvsr4VwdXBEYYDzUoYNrVZ5KkMrN6xRleeHlIlGQv5x8bIfW9iPrHtI UD+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nZFSCwvEroB1rMUOvCLmr/Arm0pjhBuuQg3BGWXKT9g=; b=WUTprd+R9nJ9GksWhnGLEjAmjN7rga6NFlh7duU98CQKEPZLueIXgq5bGP9p0kyGrm YQb+x8djH6OrBFHZ6xj4XVdy8Rxrhq+tX1wpooEfvfnZdApnBn2YQX5vOj1/YXpt7RPA jFHkbBu8bu13je4P5SiFtU0V/Enq8dkHux7eYIclzLXtVRWElIIny1gaLje/1eet04uP 6/Jslfd6jpnGwNLiC7T9ZGIPzgA6UPk1MafuKr8kCm/+YC05gt2qlaEyPFZE5Jl+GBTL DhnuAmUA9kkBQDjMtytSaDjV7ZoCUIOHm1jjqZZ5BnXfJXt9bjcFedXROtPCsFv0dB4L iuUg== X-Gm-Message-State: AA+aEWZEKTMdtT6dIQsTHam/ShWUBqIzHi+9Xgd12QZ0BeABZT7KrONS zyc79IDE9SZjbB/gbWBKVbBarC6W X-Google-Smtp-Source: AFSGD/UAVuIyr6xmNDcOfSTkkq9FLC8B2NlVVLwcriIm0HUA5R0PPJanqLai0TxATlWIXSaLV/OsBw== X-Received: by 2002:a62:dbc2:: with SMTP id f185mr25293621pfg.235.1544036166145; Wed, 05 Dec 2018 10:56:06 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.56.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:05 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:51 -0800 Message-Id: <1544036152-27247-8-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner Subject: [ovs-dev] [PATCH 7/8] datapath: load NAT helper X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Flavio Leitner Upstream commit: commit 17c357efe5eceebdc3971a48b3d4d61a03c1178b Author: Flavio Leitner Date: Fri Sep 28 14:51:28 2018 -0300 openvswitch: load NAT helper Load the respective NAT helper module if the flow uses it. Signed-off-by: Flavio Leitner Signed-off-by: David S. Miller CC: Flavio Leitner Signed-off-by: Greg Rose Acked-by: Flavio Leitner --- datapath/conntrack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index c6e731b..952b6ad 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -1370,6 +1370,10 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name, rcu_assign_pointer(help->helper, helper); info->helper = helper; + + if (info->nat) + request_module("ip_nat_%s", name); + return 0; } From patchwork Wed Dec 5 18:55:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008396 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fgUT7bSi"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397Ng3CBkz9sB7 for ; Thu, 6 Dec 2018 06:00:51 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 69C8CB9B; Wed, 5 Dec 2018 18:56:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EA8DEBAE for ; Wed, 5 Dec 2018 18:56:08 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 86CF3834 for ; Wed, 5 Dec 2018 18:56:08 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id g189so9425790pgc.5 for ; Wed, 05 Dec 2018 10:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Cie2ROvUi4XlAoqCcqDJCT/Pq6M3CZvKSqTBKRry7tQ=; b=fgUT7bSiXsjeVnRAwuNN6oT4qoQlB3W/TBbT2KYUaGwmCQT52vnHK7XVBZUZVP8hoz o7HiJYIgKmKu857VvSoRlH1bJIecOwfUKN5W8btjHB5zguvRFCaU6dB9JHwq0IESnrul /+ii9CWkh3kpvVOz+lL0XF8eqIy8gQ77duW6htttlO9zlOUvSedoRsuDabuPEO1mg8u5 69zwGuCOpDgOIrLahrwgu0ovoR9k34p90hs5rpPIB8D6g99YD7AVgUEgQigEh1DkPcvl drOKm8aJfiI5ZNy65FgpQeE8tw14NRw7+AuUthGelEk6Il0s8lljRmtEKVBupKHsgtbu qGeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Cie2ROvUi4XlAoqCcqDJCT/Pq6M3CZvKSqTBKRry7tQ=; b=QPEmivg0kWIYxdk2e1WC+83JaZnqaq2BD8ZpxzhvJ67SWpd52Ql8+URqorRyR7Xcih ia1x/pKglBAP4oIAoNOIpnCFo1DbaJ3U7BWAKz7E0q/j26hZniG5ZpRdc7rSwW/9IqIH h9Sa3Fp78Kb6Ilhxgidc4hhmTUOxynGe5gKcYN/nOiwiFJLsID0ffE+A1TGSyB3GLXPw NOWH7n00ZYVFmgeO7z1Y7uGaVBuUaubs7XoWFNSIFy1iJuc7Noq6ne+gLeh4Dt5ZROeP +L+53jAC64O+NsD5W31OIirgpFevDbo0nH9hRJkoM5rqZlcWmiy6IguwsuhKq1nJh2yK 6SDw== X-Gm-Message-State: AA+aEWZGfuGfNZw2nak8yDQvQRK59BrOfarGr4+xSc6N+fb3Xfivqh8R WgQdhC5w9mECTYnsjNEbnk3d3A5z X-Google-Smtp-Source: AFSGD/WucHjRguTSmgXnvAPT7jRTavlX58AKauWsL+s+1ZImF0HrJXABz7mK4ad6xRUMu2StTL7PrA== X-Received: by 2002:a63:6704:: with SMTP id b4mr21568975pgc.100.1544036167670; Wed, 05 Dec 2018 10:56:07 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.56.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:07 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:52 -0800 Message-Id: <1544036152-27247-9-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Colin Ian King Subject: [ovs-dev] [PATCH 8/8] datapath: fix spelling mistake "execeeds" -> "exceeds" X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Colin Ian King Upstream commit: commit 43d0e96022ae3c66743c01bba6c18a3afec7b578 Author: Colin Ian King Date: Tue Nov 27 14:37:17 2018 +0000 openvswitch: fix spelling mistake "execeeds" -> "exceeds" There is a spelling mistake in a net_warn_ratelimited message, fix this. Signed-off-by: Colin Ian King Reviewed-by: Simon Horman Signed-off-by: David S. Miller CC: Colin Ian King Signed-off-by: Greg Rose Acked-by: William Tu --- datapath/conntrack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 952b6ad..a7dc9e0 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -1216,7 +1216,7 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); if (err) { net_warn_ratelimited("openvswitch: zone: %u " - "execeeds conntrack limit\n", + "exceeds conntrack limit\n", info->zone.id); return err; }