From patchwork Thu Dec 13 23:08:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013196 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="Tbl4bmy4"; 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 43G8bM17xBz9s4s for ; Fri, 14 Dec 2018 10:12:31 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E529E13D1; Thu, 13 Dec 2018 23:08:33 +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 3AEE7114E for ; Thu, 13 Dec 2018 23:08:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A79AF7C3 for ; Thu, 13 Dec 2018 23:08:31 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id p8so1778144plo.2 for ; Thu, 13 Dec 2018 15:08:31 -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=Itk9J5qEUZ1hBlZUJe4Y0j9yXmSKcDtbgrMOSkb0xQY=; b=Tbl4bmy4oEOr3n7WkvyCP/wMc93ha7aSHdgcNiv41Px/xalZ51AdvHJVBGV5d6/KEM mNMwI9hQ1DPmvJGrvNzIxYMKY3gAUFxgKHHj3du1Gt1GijlimS103ujPlOgl6gA5ihgN 6Fjlp2+J12a3ptRwnASKI10nj3712ddQfmOr4j80Mvna3CusSDN0hX3oFXdHqQhsbpOC kd9CT2Wkug2nAJdyW4ECdSdSuumej0ZcBRpO8jez2cYb/164N6juDlCs84xQ773GZOO8 pYn6oyxpr/cjO6VjsE1fz/te7E8vWv6N+pwxOh++YN7avYByLB7xs5jaBVd6AIRRoTOx HVMw== 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=Itk9J5qEUZ1hBlZUJe4Y0j9yXmSKcDtbgrMOSkb0xQY=; b=CUiUD0Tl0QKcOlSU6lE2EgmrnjDgr6OiALRFjtGzitAGSgGLtFXAsNUBO6qxPIGXCK wajEcU5W3rNYV42UUz6cZuLrC4OSVOmRk81VGcPBaVV2PLDfQqLk7V8NJiSW59gZ7qBg nRQRzk4Ivyq8MVWLSOCT10Eh/HzTnif4jEaUk5U+5i/8vpo+NRh4Z68wygtiosQp8BGK 4RVsdnNyNpZRWDRNCS6SguujF6nVJtA4lTWZ6iml3RiCGsqRvfj2LmkKIxYxcKaiuftS XYxq8cyKeQY2dN95NpGRyruliDGdWm79dCLn0yfzXbfcKDs3E6J79Yju/yXoelW0d3JC bfPg== X-Gm-Message-State: AA+aEWYzLuzNUFaAadQhb3dTiLFy2RJsyw7CLuPp+kc8OUnZhgh8z6v4 kcVdOOAovZF5QbRcgR7hILJ/wB/+ X-Google-Smtp-Source: AFSGD/XmDJh37ut5mNYXvVjZJa9Z+ZbNoHFLpQl4L5qmAGaM3y+3AhnJDJCmGVdLKcETiMXgBj6Q3w== X-Received: by 2002:a17:902:2f03:: with SMTP id s3mr607313plb.277.1544742510778; Thu, 13 Dec 2018 15:08:30 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:30 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:18 -0800 Message-Id: <1544742505-5177-2-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Acked-by: William Tu --- 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 Thu Dec 13 23:08:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013197 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="Fdwjz+u7"; 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 43G8bN4PZ0z9s9G for ; Fri, 14 Dec 2018 10:12:32 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 98A0213C8; Thu, 13 Dec 2018 23:08:34 +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 4075D13AB for ; Thu, 13 Dec 2018 23:08:33 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B09A3735 for ; Thu, 13 Dec 2018 23:08:32 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id y1so1757091plp.9 for ; Thu, 13 Dec 2018 15:08:32 -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=5gdv5bjkxdlDfC5Wt6k76xl5dUCvDbvi8Ro3uPEM01Q=; b=Fdwjz+u76RWmZ4j3s3k+LeEvkGJpCXc+7VsHW85VrQNr2blB9Splh+nxe2tTsJOi42 NFv31/6lBKBzIxw8JuLogwuEESYfAUTfvI+ginsdBpgvpuHWpHHbueLsZLLOtov21+9b CDuoBmXvPAwlEjErX1E6IAqGnA/mypIfLuJbfpK/BMeuRygqY5WzbKPEmjAOU3YMSwbE PYUnEoB3ghe0PjgldX4t8tKi3fgeDFe1ji19PSA/VUr3WKKy5IVAyWfSxIjSgEEBjX4i i8/E74zB6MRXeCYlkQoxr9kAZHf6ADrwZ3TA13FVP9pLxy4c6ZPcCSrhJGNk1QzN40M2 0w0g== 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=5gdv5bjkxdlDfC5Wt6k76xl5dUCvDbvi8Ro3uPEM01Q=; b=KPojKkWZaDA5IGbdAAyHOqeo5BLhuwscXNvvmexviLD3COO3UbMh64QshtuQ+T+bLT cbAPkuH+KvLZH/b/8MWD/TJQHM69ZHTbvvoU3cNa6pdAod66HVAPGQCQnWYPqxB7ERF/ lm16zzpfyKO/y8nkYWllZC+68si836gx9mUnqXT6PylKdYskpiM2kiaRSUXOcjj/UAB2 mSN9RjmfdmdUG4BlK134wP+nXZhEp+LSZKvlFaNTXGPTB+hzDwugDWOgHYSXxuGV5PR0 pGPCrlWZ4pzbqwSZQONfQid0d4RBr+Jf1vKzYG7Tzb+lcJj1r6umm99aPPPF006BDxKP T9sA== X-Gm-Message-State: AA+aEWYbKsRqHE6Xb73vcV01U82gFjgk4Vb36C5awVpT7uYnraHqCZCl n3CTVtZRNJdmKwgszC/LXYcXeSpl X-Google-Smtp-Source: AFSGD/VhDG3YeO//HAHslFRJAl770EzLltAzZuzrAH369Hjz1qIwkZTMJHmNArWvymo++qP5WiYhFQ== X-Received: by 2002:a17:902:1682:: with SMTP id h2mr634537plh.243.1544742511889; Thu, 13 Dec 2018 15:08:31 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:31 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:19 -0800 Message-Id: <1544742505-5177-3-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Thu Dec 13 23:08:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013193 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="llRYQwsA"; 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 43G8Y1001Rz9rxp for ; Fri, 14 Dec 2018 10:10:28 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 383EB13D5; Thu, 13 Dec 2018 23:08:35 +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 0F42E13D4 for ; Thu, 13 Dec 2018 23:08:34 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C1395735 for ; Thu, 13 Dec 2018 23:08:33 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id 101so1768073pld.6 for ; Thu, 13 Dec 2018 15:08:33 -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=BgHFZctOgciu84wMCqaY0Mqv3mjKTmckf09XzyDotAI=; b=llRYQwsAarMjDpNKs689VNfg+fXn/+haoCE25mgvlRZQVqEaRXjswbf31QS12Ozsjp YP6zLSn9TFw1YIf+m/M6lBKj822+OXlgAv6awJWspD3UkAM2hEbNkWcCpiwO7kUrvJel XG2b+Wj9Q2AdAZLD+3qan+4HOKGU6FT3wSGU1BR6NSgU9+P/+x4k7R7Xh+GwYEsodbbc sTmm33Koc782AfoaNmdfHp8Ovp7B7N/23Ms9swdLzpYO0t63c/TS7Fh2O7KVWGQmA02P g3PbEQy/NjBuu6tq+jYP/7bUcGeBZap+9CNrtSekxBZx2HvyLz2MetfDeQ2XBhJ5rMs0 rxfg== 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=BgHFZctOgciu84wMCqaY0Mqv3mjKTmckf09XzyDotAI=; b=lZ0AnoiFrq0DN3DzpG3uWvc0JVM2wn+mFleVI362qxuert5WsF3uqVlqaQReLOhXMQ i6SNmEB/bwe18c/QmP+60CgcdVBiippMzXSpufOrTOW7/Xl8z+lj3NMJr8Wz1JEzxzSe l5jaCrk63hrzoO7PmwV5UGNUsgPQQJMYeuU4EpbqE0clvgkZch5qWDpfvHHG5PEhMWV7 jNytOR31EcJV79GeSYo5FZWf9v5iI+kc32xdpM/67eheiNHOE0WyyfDwRkIur8kXBnDj 4U5i53IsR7JldfLw3Z/5fqFh/5pwmvoyL1XT9OLlnr6/0V7ZauHE7dwny2oSIyIxzFtR eihA== X-Gm-Message-State: AA+aEWY5kVHnuydYp3knwc2yWhvkVrQs04wFqHsZ7qsN39yAA04vphzk 8lyTTvQDY9Kaid6YZrRwFR/V6Y/x X-Google-Smtp-Source: AFSGD/W4CYDg5vy+Z00TL8vhBa/02jCG3pE21VwIuGG5UtnCHBQRP4hHQKQac7AEofX2ZQKlWtCW0A== X-Received: by 2002:a17:902:20c6:: with SMTP id v6mr686016plg.156.1544742512993; Thu, 13 Dec 2018 15:08:32 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:32 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:20 -0800 Message-Id: <1544742505-5177-4-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Thu Dec 13 23:08:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013195 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="G2Z9vIwU"; 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 43G8Yd5nM1z9rxp for ; Fri, 14 Dec 2018 10:11:01 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0EB3C13EC; Thu, 13 Dec 2018 23:08:37 +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 D2EAF13E5 for ; Thu, 13 Dec 2018 23:08:35 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id DDCFE735 for ; Thu, 13 Dec 2018 23:08:34 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id gn14so1762681plb.10 for ; Thu, 13 Dec 2018 15:08:34 -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=PcrR85NZWFUQN8UmdhjklnAfntuyXLUJ0VhXNVDGMuY=; b=G2Z9vIwU7icxDnahKI/TPXowQiSxy1KBpjy6swklIE9FYlJB9KE1MeOqoCohAmPmF7 PqQEf5p4KLpUHzeN7n10IEyl3wMj8LLqlW8VpcBBZBMrUA9frxU8MiTsv2Y1H+oZWp3v aWSp4WO0Q/Qz20X48kL/ErIk7MDej8jgzq/X/ALFuI+90zAOYuvasQ+zjBZk6tt77A27 91/PqIOA7GgavL7uxs4hXoZ2M7y0YPAo/xDnd/r+x8w2eGJdyZm1zUiFMDS2ZhfLCxh5 oXxNSDB7Ey/OKOIUpvSU4jC//gWx8Jah0Yh8cGMszqRzeh6j498vosEwmiahX+/hj7PT HSUw== 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=PcrR85NZWFUQN8UmdhjklnAfntuyXLUJ0VhXNVDGMuY=; b=Dlv9vh/uA2N1Mbdk4unDK2d5s3Ly7DayRklWhM6mmFS9Zo5ncP0qAkX54ZRrFXNMOG iuahJfxi+QdXzZAqgBPF3OmOxLjldk7is7vlY/AbpWm34RH6Wvqe2LWZqSdjj0XgCEv5 YlGKqdsRmeEOwUdg7RchCRA4lv9rTbT1GnxOM1MAgOLegWWsM8PHDsUCNaRtkbfphYGK wIPyhhdkJ8lZn51T2Szdv13+jJOj/b74phvxPZHfZKs/++YIRSHFKyvOd/JtzyHyi8iG 4uw7WO0H13SxEr8e849DwzL5eu/xqq9GfwScFJc0AQn4ItFkr1LETbFSRkwOtZFVTehL 28Cg== X-Gm-Message-State: AA+aEWagrhYwksiw7u3RGqmKG05FDX/uwkvkiMD03oNPyXD4ngt+mSFn KnMBimQoRnCBiGF6J1K2Q3Skuk4x X-Google-Smtp-Source: AFSGD/VYCcEHQZwCcukWq569bc90ifZGZZJ90N8u1Dzu56zIlkSSBKjaGxgk+SXm9FamEavpXuQbKA== X-Received: by 2002:a17:902:34a:: with SMTP id 68mr681990pld.268.1544742514047; Thu, 13 Dec 2018 15:08:34 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:33 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:21 -0800 Message-Id: <1544742505-5177-5-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Thu Dec 13 23:08:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013194 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="BCXYcOFV"; 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 43G8YW4gmyz9rxp for ; Fri, 14 Dec 2018 10:10:55 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A7E9513EF; Thu, 13 Dec 2018 23:08:37 +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 41EB113C2 for ; Thu, 13 Dec 2018 23:08:36 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D8368735 for ; Thu, 13 Dec 2018 23:08:35 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id u6so1758396plm.8 for ; Thu, 13 Dec 2018 15:08:35 -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=9UHJHirDDSl7ijiW4baCEitKa2xzmqgQP4NRpnOx1tk=; b=BCXYcOFVet80KMl4jezIV/kScHhyelFQPtR6USuK5OIjGIllL/0CxqXwlztRrcsNhC aHODoKG3HJGfsZLJRQlpC5/3UMtloriItyKVFtd25Yfud8bt4xYfNq+ZCGQKn3lN5viI /2zLV71TjlS6oe9V1xHu4RtQBvmp36g7JAf3/Bz6DgxoneRdabx1mR5Mx/n09U6PY32X H+DPEB8Qz+VoeSsViRMBw2B02XsLuqp5TcyH1EiG69s8B1+MXqA35sX1sdhMPlBpyFWB D2H7gugoznKiqa+OX3y7yQJ2hJ3N4b8+6VXvVtGSkZKZNSX0VigxL6H8K02QFw2LlpA/ foYQ== 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=9UHJHirDDSl7ijiW4baCEitKa2xzmqgQP4NRpnOx1tk=; b=nClvo5QirgxYFGPsw1Puh7wqA98x46bFIDLLAR+c8zQzSEwO+OYYZMZHh4xaIrZX7r 97hEhdrWNdD5QNGK/0CFihyJGaN6qq0dQsyUjQ+mG7lrevogkpr+g01MxLrmKcQ1aMaQ KBlEvPNBypX2CiAbHDYUiB70OlM9gz40jCCJljYeLwbqYS0tv7C75IfcwkjrFJiv++H8 V9f02VNAo9PG2OM5IEBgAE/knXXj1Uhy7ZF+izUIZPc8h1LIOlnlKGdeXlZGxn2k8LMg rPKlWnrpxcLzhNbucOm9/8hm57N453nZGEfK44yy8PPwAHk2nxIgoS9vGj3Yu2oqFotX nfkw== X-Gm-Message-State: AA+aEWZdr2oWwoAhGPGfOh+PKBAGtykk0aOe2CgRATkKElY0kqkVaFjD 17Tz1LdhcGfdBBZuPXaJDpPXrLrq X-Google-Smtp-Source: AFSGD/XKXC7/OzCwa0aZNnfWw1nBpGz4atvy+XM45y7P8z0T/IA5gAJhliIu5cey77bpYflKElYjsw== X-Received: by 2002:a17:902:4081:: with SMTP id c1mr662709pld.87.1544742515112; Thu, 13 Dec 2018 15:08:35 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:34 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:22 -0800 Message-Id: <1544742505-5177-6-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Thu Dec 13 23:08:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013198 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="Fl9GglaW"; 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 43G8bV6gtGz9s9G for ; Fri, 14 Dec 2018 10:12:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 41B8E13F4; Thu, 13 Dec 2018 23:08:38 +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 45B4E13EE for ; Thu, 13 Dec 2018 23:08:37 +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 EB11F735 for ; Thu, 13 Dec 2018 23:08:36 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id w7so1733263pgp.13 for ; Thu, 13 Dec 2018 15:08:36 -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=U4+UMv5qVudOQeQl4wNt2Ncq+1Z7emaJUxXB3/BAccM=; b=Fl9GglaWX7OYyXpF2Tkl+6F616Z5xzXouyFcnmr6O4lIkHUEdtZMYxb2QRhc8h4jQN 7fQ/z4/HvJ41ZRYlazovhMYjQqz0kY/FMcI9pVwIgs8vmBJUamMZkD3b1w+KWBYeNCOe 22Ba8HYnkO8axSFotfHB8SBjWIJAMaDy35gPWiLzIrW477G1xfBn0djSryVButmD8Yu6 Nfrl8mW01TWWB1gTgprd8xIHVtgG2XNcfJKKn81ILlu/aIuIQW4Zvjwioph7ohmRGJD0 ljdKVON0bXdb4ere7LZX041rZpb3gOIszgu6uhTDwMuAEtu8m4c4Zd5vxdwNwjcOLwX3 Jcqg== 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=U4+UMv5qVudOQeQl4wNt2Ncq+1Z7emaJUxXB3/BAccM=; b=T0g8t/kN12kvwPE4lZ1b5H9G/LGpbjMgjwK55fbNGKQh6S7aI4vsjnDaOLoA3DThO7 s5E57B3z01qqPShwWbZKgO5+nt/WxKlXXyJZmcgOSeoky4iNHc1PnEtzrZod+v1ZZczF 7b6OQOhjYsFaahK+rkJuVdTwduaG8cxDXLrfipmPZtKJWnUaFbVICz174SXEqisLFLUX SS0oaR9mpdni88F4DactKv6S0efk2kDjvBBOMQOf2yLKdlXb6Amv85BviiCz3NEdBBRP pgt8tPzxjNOD19CPYVZ7YNuNe7/U6kF+RgKoS0llTizlcQfc+E+pWKWFM5hcvIKXo8wu XgmQ== X-Gm-Message-State: AA+aEWZ8nwoelLvj8W2jHvSuK8yy/7N/0UFmru1r1f2RlN0EMW+HU8dD jIGeDQ8v9cbU+m1SRSNoQ6pMBBnX X-Google-Smtp-Source: AFSGD/VBzOJ7ybIdmVHWt3/YrWJHdz0cWkCl27zXCaQRMHhwIi6ZhtUi0RCt1XGUWblDN8XPsYJ0eA== X-Received: by 2002:a63:f74f:: with SMTP id f15mr633849pgk.190.1544742516144; Thu, 13 Dec 2018 15:08:36 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:35 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:23 -0800 Message-Id: <1544742505-5177-7-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Thu Dec 13 23:08:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013199 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="EtVX+S2f"; 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 43G8br5bQRz9s4s for ; Fri, 14 Dec 2018 10:12:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id CA82D13FB; Thu, 13 Dec 2018 23:08:39 +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 3326113F3 for ; Thu, 13 Dec 2018 23:08:38 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EDCB3735 for ; Thu, 13 Dec 2018 23:08:37 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id a14so1755298plm.12 for ; Thu, 13 Dec 2018 15:08:37 -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=AM/Q5dIkTjDicVIVt6eXnQihpCCoqzA8CxrX+uqthMo=; b=EtVX+S2feQ8fkjFBPtrZSUfhr22DaK+gqFm7r138mWVwzn2CCXfIjUILBCyLUFu9Ie pDutEMpM/lnI3w6Ot/C/gU0DJbirqg007eJTgeVdbEefsDiIASaXHrqtHCsTmLL6Ujf9 zlqCe2M8EsNOXmYaGosFBweHbj4coQ8/pQeX8IL9d6ActFaNgx51BmUJqEu++A4I+9m4 trtaIdwgEjRgeJ94K1I5nZC6+2lSqao0oi9P3vEE1uZ95cYOmQ4Lj1EEzHYpFi+6Ni4+ xUc+jeV6D5k8xIY0KOGoMAX2dkrclDo6XQ0+PIHVePM0fyvIDFJTD8rnZoCVq94fbCuH XT6g== 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=AM/Q5dIkTjDicVIVt6eXnQihpCCoqzA8CxrX+uqthMo=; b=hESXg/C6g3RwmqjDbcQkvaiDXMIoPKZnZFJjMGL2sXWdwklQRrzjTB51VCbraR4MYD NnqKkjJhNtDVQITg0jrctKVmshTPy0gLrhF1xST3WdbFHS6LkY6a4Qi9m6W5o4P7zyTt 9ZCNSO3icLeeIsrmg1k9NtzOwjwAvVBGlgmk7Pug0loqkwB+1BF9vTEFA6MZ/Yf1OURo +nf4qXhl1btkJhG3xF32U8xrWt7hSCsMvn/wnWLZvw481MIBuGC4YabEqWQO+Po6guAr JE6yFIqqGPA2TjFaXgUzp7nib/isUy/XOPm9yDQFTfviOgkmvHbrKsGNzyX4Fz4v2/QP 1qxg== X-Gm-Message-State: AA+aEWb+sEv9iGCCaaRNBjLjjTHxj1oRlp62tWzpyyjMLdNIPGuiZRcK QQ2H99iVhb2iZ27hphKlizNJLjL/ X-Google-Smtp-Source: AFSGD/WQ/CGFaCCBkd6qEg6eK87n8X9FbW5rASMhhcNEQP/L3p8y0IRYCiXCMYZ/Vpc8Xkp/8mklHQ== X-Received: by 2002:a17:902:5066:: with SMTP id f35mr684397plh.78.1544742517218; Thu, 13 Dec 2018 15:08:37 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:36 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:24 -0800 Message-Id: <1544742505-5177-8-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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 Thu Dec 13 23:08:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1013201 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="mRBZpuI9"; 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 43G8cB4RWsz9rxp for ; Fri, 14 Dec 2018 10:13:14 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6749F13F8; Thu, 13 Dec 2018 23:08:41 +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 5C8F513E5 for ; Thu, 13 Dec 2018 23:08:39 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EAD3C827 for ; Thu, 13 Dec 2018 23:08:38 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id w4so1781344plz.1 for ; Thu, 13 Dec 2018 15:08:38 -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=VBpU8gcWmkUPF8dHmAlludAb39MwUnJx3wRpiJDJVK4=; b=mRBZpuI9IJA7MpIIyf6ZApgVH372d7YTkEnu7on7/wPWVof3vgrR7oo6G1dDH2nvb7 MoPEgRiOce0ZSs2PPHlq9lEgHQ4nMAucw/PnlCQy1MSwHgCMdHPucRvIV00MSVEgV1XA 30tb8P3Y3BkbPAHB7717PtefWitafJCoWExObeu0Hjw8W4N2eVPtdUyHWbnNxOvuc1gP na0gyl/T0gL1PuUZs6X1vbcuqYU7DR0rv9vIbuCyy1a/ZAp414nHeQbaCn2ntsgo/3Pv arUBpcfEyOnypi40Y8HnkKTqWafTPXGRC+Uj0EAQH7Q1Q3DYg6kHs5EtdJnriWxbsFdZ sc/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=VBpU8gcWmkUPF8dHmAlludAb39MwUnJx3wRpiJDJVK4=; b=MFrJxLWHpXDZ/yvLdpxhkTYlDE1Xf2GIGeG6uT4YwT2hhtKs9rt+9OU1WTVHNZY7KG 6AaIsXRfSG6LIGI2S8GZ84WWKde69brISEalelAKMwF1dyOhR7r0xwNRh/ZNX6t6tY6g WyiJKIpUJxVy1T+I/ofTo+UuNLACaDUJw6EDwPmBwUeYAEieamT7GgLgpBPaKQNoXAFI svw6jN9Krn3For7mtM08MBo15AoJdcj/JGHAzYAPZQVDNoMoBQp1jc0HIwTTFSMgnvr1 2CvYOybnY/FBo/EwwVqLeU6VomitN3Jc62Qz6MGBmLpcu+C/ebxvY2Vo/XNJWaYXnRDW lZ9w== X-Gm-Message-State: AA+aEWZN3wtuDF4jiQqXnWZFu4hJsYhgqSKCWVquqIe1KCpp7H0QYdqC CaKpMKH+MQYBdETOA9e/tC8WIEab X-Google-Smtp-Source: AFSGD/Ws2m229SEtN4MOvmyQaOxzC2RRABqDEoEupNl4TaZrFbphZt5bTXftHp8ekKlN4TAMFuPbXg== X-Received: by 2002:a17:902:4225:: with SMTP id g34mr692096pld.152.1544742518285; Thu, 13 Dec 2018 15:08:38 -0800 (PST) Received: from gizo.domain ([97.115.152.49]) by smtp.gmail.com with ESMTPSA id m3sm3458352pgl.69.2018.12.13.15.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 15:08:37 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Thu, 13 Dec 2018 15:08:25 -0800 Message-Id: <1544742505-5177-9-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544742505-5177-1-git-send-email-gvrose8192@gmail.com> References: <1544742505-5177-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] [V2 with ACKS 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; }