From patchwork Mon Jan 28 08:48:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Deep Ajmera X-Patchwork-Id: 1031754 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=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="RcOMffpm"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="iaCptJIv"; 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 43p3H40k8Fz9s7h for ; Mon, 28 Jan 2019 19:50:07 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 88ED21E37; Mon, 28 Jan 2019 08:50: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 A6B3C1E22 for ; Mon, 28 Jan 2019 08:48:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E3A303F7 for ; Mon, 28 Jan 2019 08:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1548665289; x=1551257289; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=a+L2DFHT7aN2SfEiq3kSaO9+4D001PGlsokpzaQ+Ldo=; b=RcOMffpmanekXaTGwx+8OcQMf2tdfyVYULC5M49QLwm9EBzEadJzmXYob0Srrbvb wWsTp88kFwCoU73sduIHVd7+3RuEDYZZRyoMVZP/pmNfjqVYDNuq7pbucbBey/xI Kq/KsNfiRMvfQRrx1ZtakyL8FdEkWg9FxmCAT/BANFo=; X-AuditID: c1b4fb2d-2198b9e00000062f-48-5c4ec1c913d5 Received: from ESESSMB504.ericsson.se (Unknown_Domain [153.88.183.122]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 8C.8F.01583.9C1CE4C5; Mon, 28 Jan 2019 09:48:09 +0100 (CET) Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESSMB504.ericsson.se (153.88.183.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 28 Jan 2019 09:48:01 +0100 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB502.ericsson.se (153.88.183.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Mon, 28 Jan 2019 09:48:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a+L2DFHT7aN2SfEiq3kSaO9+4D001PGlsokpzaQ+Ldo=; b=iaCptJIvtJi0XBObDefoImCMhdGiGfEEryAuX+qY+CYSPJzXDH2vLcmuEQtpUuPucv0GDhW7bNex1dRQ51pUaim9JSffeem7baHtuBMOx3hdPPjaesbFO9e6VgRh01AC11t3sngB+4ZqJo7vBnhmqX8Y8H+AL74GPFgd49VuvCM= Received: from HE1PR0701MB2698.eurprd07.prod.outlook.com (10.168.188.17) by HE1PR0701MB2667.eurprd07.prod.outlook.com (10.168.188.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.10; Mon, 28 Jan 2019 08:48:00 +0000 Received: from HE1PR0701MB2698.eurprd07.prod.outlook.com ([fe80::4d74:46d7:e081:b4ed]) by HE1PR0701MB2698.eurprd07.prod.outlook.com ([fe80::4d74:46d7:e081:b4ed%9]) with mapi id 15.20.1580.012; Mon, 28 Jan 2019 08:48:00 +0000 From: Vishal Deep Ajmera To: "dev@openvswitch.org" Thread-Topic: [PATCH] conntrack: Exclude l2 pad bytes from L4 checksum validation Thread-Index: AQHUtuYsPupdPOo6TEOZ+izO85gb4g== Date: Mon, 28 Jan 2019 08:48:00 +0000 Message-ID: <1548694155-28734-1-git-send-email-vishal.deep.ajmera@ericsson.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::32) To HE1PR0701MB2698.eurprd07.prod.outlook.com (2603:10a6:3:98::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vishal.deep.ajmera@ericsson.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-originating-ip: [125.16.213.150] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0701MB2667; 6:tnfoFxU1/Sm1wPubaLzCJvsqIsrqYbv5oaBQvJ4HaaGDGWaFptGlDv1cnR4ec4g24+o3BGwrJbMCGlr0VG9L+lZv4dnPBQnvKEUmj7iwwGSQSELwXf0DJzZkXMzQa3t9fLFGHzpZDEwwAwixyJFUvr1VhLFiFaI5W5B7KubGNepqzNbEcx5g2t2bwH6vanMAZsm4IhHpxJq90Lnb2jZMlakkCnuUK2surShxWQdrfSJnR9rYg2AERu46ym2BBs6gU9qQetbKPV6e5/drG/0i5d1bOIKedjH+4NVovNogH2qa32zlSfVCiDv1JYKsbq5uQuAAQliZv9/CgNCFA/DJQrmTKfDQuQWUhieR3RWMY4cjPrms/STqK+uNnYplGWnN6D/M7QX6kK+3y4WyIPqVkKk43AhTw2XuwYXYF7zxwiiR00Yy8t8ZRfvqSGK6S4fG1TfyrXfg1WGg1tNvXeHQNA==; 5:eD8sdoQH0j/HQzQk8+TXZQE888nD0+2K8Q28bl50LbuIeeoCFg4F3fbLkjLXKiXk+XJ2JmM+KjWFfmA6/K7pTPWO7nFfKpq9w/WNPTAC4Qx5o3WJmA96wECSVraqpCnzdOcBTiCno3y/lxd9SQRd7cH0c0KBxjQ6oxidNB5cOwSXvDN/LQ4sNWEVh9uieKEjPCvxTwa6o/WOVMvrKZ4IwA==; 7:Ek4F4jUWpCj2O+FlMyEKkdLiOlwDW9pzsHvnajuaUd8fsS/C7mYQtLkCpWXaPh3VfYPvrXHWFpacFUxhslHvmUvqgLhQFHxxAMTUe6/TiNvztRRHcNqJCOwn5hhZJ2CRVOrMatkdNkJ6ER8fp8gwMQ== x-ms-office365-filtering-correlation-id: a5291c9d-02af-4ff9-ca85-08d684fd4e80 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020); SRVR:HE1PR0701MB2667; x-ms-traffictypediagnostic: HE1PR0701MB2667: x-microsoft-antispam-prvs: x-forefront-prvs: 0931CB1479 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(396003)(376002)(366004)(39860400002)(189003)(199004)(106356001)(7736002)(105586002)(52116002)(6436002)(5640700003)(2351001)(6486002)(2501003)(55236004)(6506007)(99286004)(486006)(386003)(71190400001)(305945005)(102836004)(71200400001)(2906002)(6512007)(50226002)(2616005)(476003)(186003)(53936002)(107886003)(25786009)(6916009)(4326008)(316002)(66066001)(36756003)(54906003)(8936002)(14444005)(256004)(8676002)(81156014)(81166006)(1730700003)(6116002)(86362001)(3846002)(26005)(478600001)(14454004)(68736007)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0701MB2667; H:HE1PR0701MB2698.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: bcDTInmUBGKVBzVxsvbTe4Y+XyVY8v6KBfYdNdqt+be4+6ZnhGGC6bVBq4q5gnAqzPWOt1TYK4c3Wdt1Qx7IeLKUIE8UBcqTu3sqRaObuC8qcwaaDW4iGexgguaq0bMqq1i4wlVh33JmpcxVWyfT/Etp50DmUbeOi2Dqyn1F7Qs6yHidkPtJQGc64E4XkA0+AYFIK+jQdXF5a//3ZgS+HOgkUFN1p/TdVf2dTstgz/rJLjogSxGOWZjyLh7Lud3llo4Wmh1kbELvRw0H9SQB3r0KCorEvVWqsrxtDQssrCM3zQhV1Xrp0IsocLJmyJf1ETRD5TztW3/ejKGp5Yd9xwN1SUwFhuhBizGEduBBlACFhy9k8KaPQjMQ4gU50da2QXe79ZeXS9d9O/FFlryqWSqED1JIVxCIlTnQsh0+W24= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a5291c9d-02af-4ff9-ca85-08d684fd4e80 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2019 08:47:58.7730 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0701MB2667 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsUyM2J7le7Jg34xBife8VocPb2H2YHR49nN /4wBjFFcNimpOZllqUX6dglcGSv3SRQ85qm4cXo2awPjC84uRk4OCQETib6NB9m7GLk4hASO MEo8uTGRBcL5xihxt6eJGcJZwiTxbsULsDIWgQnMEq2vpzFBZKYzSfy+ORvKecYosXNNNxvI ZDYBK4lfU/pZQGwRAX2JQz1nwQYzC8xhlNj3ezETSEJYwEfi0b0vrBBFwRK7e3YzQdh6EtfO fWAGsVkEVCWmv5kGZvMK+Ev8v3odbAGjgJjE91NrwOqZBcQlbj2ZzwTxkoDEkj3nmSFsUYmX j/+xgiyWEJjBKNH8qZcRojlJ4s2WP4wQRToSZ68/gbLlJBavvswGYStJXFyzmB3ClpW4NL+b EWJQC7vE5U/foYp8JbpXz2KHSDxhlFj8qoUVZurUA5uhuvMlehe3QsVlJFaduAZ13lVWiV+f WSYw6s1C8gWErSdxY+oUNghbW2LZwtfMs8AhIChxcuYTlgWMLKsYRYtTi4tz042M9VKLMpOL i/Pz9PJSSzYxAlPFwS2/dXcwrn7teIhRgINRiYeX+YBfjBBrYllxZe4hRgkOZiUR3qy9QCHe lMTKqtSi/Pii0pzU4kOM0hwsSuK8f4QEY4QE0hNLUrNTUwtSi2CyTBycUg2M5Za5YqfDN734 xXNhM3P7zRvf5DmdkzgNFt/u89k3aWlfTdI1ucDfr/prn0at3uxU/9Y+iU92e9ddT8v6hYns /+y7r/7f5nHl9CXRQBXvuCLLWx1fm7UfL1rQfWOVusKTLZOe/ZaIuWLXtE+L7R/bHQs1QzbW vXs2ftpgHcp8qd7QSkpnM+8PJZbijERDLeai4kQAFnWwaBEDAAA= X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Nitin Katiyar Subject: [ovs-dev] [PATCH] conntrack: Exclude l2 pad bytes from L4 checksum validation 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Userspace conntrack implementation in OVS is including L2 (Ethernet) pad bytes as well for L4 checksum validation. This is a bug and any packet with non-zero L2 padding bytes will be treated as invalid packet by conntrack due to checksum failures. This patch fixes the conntrack implementation by ignoring L2 pad bytes for L4 checksum validation. Signed-off-by: Vishal Deep Ajmera Co-authored-by: Venkatesan Pradeep Co-authored-by: Nitin Katiyar Signed-off-by: Venkatesan Pradeep Signed-off-by: Nitin Katiyar --- lib/conntrack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index f732b9e..1f6dccf 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -1973,8 +1973,8 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type, if (!hwol_bad_l4_csum) { bool hwol_good_l4_csum = dp_packet_l4_checksum_valid(pkt); /* Validate the checksum only when hwol is not supported. */ - if (extract_l4(&ctx->key, l4, tail - l4, &ctx->icmp_related, l3, - !hwol_good_l4_csum)) { + if (extract_l4(&ctx->key, l4, (tail - l4) - dp_packet_l2_pad_size(pkt), + &ctx->icmp_related, l3, !hwol_good_l4_csum)) { ctx->hash = conn_key_hash(&ctx->key, ct->hash_basis); return true; }