[ovs-dev] [PATCH] tests/flowgen: Fix length field of 802.2 data link header.

Ilya Maximets i.maximets at ovn.org
Thu Nov 18 16:36:24 UTC 2021


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 <i.maximets at ovn.org>
---
 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',
-- 
2.31.1



More information about the dev mailing list