From patchwork Mon Feb 11 02:52:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li RongQing X-Patchwork-Id: 1039568 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=none (p=none dis=none) header.from=baidu.com 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 43yVht1jPMz9s4Z for ; Mon, 11 Feb 2019 13:53:18 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A6F47227E; Mon, 11 Feb 2019 02:53:16 +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 B867C2273 for ; Mon, 11 Feb 2019 02:52:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tc-sys-mailedm02.tc.baidu.com (mx134-tc.baidu.com [61.135.168.134]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 5C2D95E4 for ; Mon, 11 Feb 2019 02:52:57 +0000 (UTC) Received: from localhost (cp01-cos-dev01.cp01.baidu.com [10.92.119.46]) by tc-sys-mailedm02.tc.baidu.com (Postfix) with ESMTP id BD65C11C0042; Mon, 11 Feb 2019 10:52:54 +0800 (CST) From: Li RongQing To: dev@openvswitch.org, dlu998@gmail.com Date: Mon, 11 Feb 2019 10:52:54 +0800 Message-Id: <1549853574-17643-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH][v2] conntrack: Remove unnecessary check in process_ftp_ctl_v4 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 It has been assured that both first and second int from ftp command are not bigger than 255, so their combination(first int << 8 +second int) must not bigger than 65535 Co-authored-by: Wang Li Signed-off-by: Wang Li Signed-off-by: Li RongQing Cc: Darrell Ball --- lib/conntrack.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 6b46d0ca3..315a19e9e 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2997,12 +2997,7 @@ process_ftp_ctl_v4(struct conntrack *ct, return CT_FTP_CTL_INVALID; } - uint16_t port_lo_hs = value; - if (65535 - port_hs < port_lo_hs) { - return CT_FTP_CTL_INVALID; - } - - port_hs |= port_lo_hs; + port_hs |= value; ovs_be16 port = htons(port_hs); ovs_be32 conn_ipv4_addr;