From patchwork Thu Nov 18 16:36:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1556734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hw56K4KpSz9sXM for ; Fri, 19 Nov 2021 03:36:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0F6AF817F2; Thu, 18 Nov 2021 16:36:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sLMuo6yUPMaq; Thu, 18 Nov 2021 16:36:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 51D3D81882; Thu, 18 Nov 2021 16:36:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 29498C002E; Thu, 18 Nov 2021 16:36:36 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92BFBC0012 for ; Thu, 18 Nov 2021 16:36:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7345940486 for ; Thu, 18 Nov 2021 16:36:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lmYYK0jWW6tV for ; Thu, 18 Nov 2021 16:36:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0BB914047B for ; Thu, 18 Nov 2021 16:36:33 +0000 (UTC) Received: (Authenticated sender: i.maximets@ovn.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1247DFF809; Thu, 18 Nov 2021 16:36:26 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Thu, 18 Nov 2021 17:36:24 +0100 Message-Id: <20211118163624.1914228-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: Ilya Maximets Subject: [ovs-dev] [PATCH] tests/flowgen: Fix length field of 802.2 data link header. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Length in Data Link Header for these packets should not include source and destination MACs or the length field itself. Therefore, it should be 14 bytes less, otherwise other network tools like wireshark complains: Expert Info (Error/Malformed): Length field value goes past the end of the payload Additionally fixing the printing of the packet/flow configuration, as it currently prints '%s=%s' strings without any real data. Signed-off-by: Ilya Maximets Acked-by: Paolo Valerio --- tests/flowgen.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/flowgen.py b/tests/flowgen.py index 7ef32d13c..a6c0024bf 100755 --- a/tests/flowgen.py +++ b/tests/flowgen.py @@ -166,15 +166,15 @@ def output(attrs): ip = ip[:2] + struct.pack('>H', len(ip)) + ip[4:] packet += ip if attrs['DL_HEADER'].startswith('802.2'): - packet_len = len(packet) + packet_len = len(packet) - 14 if flow['DL_VLAN'] != 0xffff: packet_len -= 4 packet = (packet[:len_ofs] + struct.pack('>H', packet_len) + packet[len_ofs + 2:]) - print(' '.join(['%s=%s' for k, v in attrs.items()])) - print(' '.join(['%s=%s' for k, v in flow.items()])) + print(' '.join(['%s=%s' % (k, v) for k, v in attrs.items()])) + print(' '.join(['%s=%s' % (k, v) for k, v in flow.items()])) print() flows.write(struct.pack('>LH',