diff mbox series

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

Message ID 20211118163624.1914228-1-i.maximets@ovn.org
State Accepted
Headers show
Series [ovs-dev] tests/flowgen: Fix length field of 802.2 data link header. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Ilya Maximets Nov. 18, 2021, 4:36 p.m. UTC
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@ovn.org>
---
 tests/flowgen.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Paolo Valerio Nov. 24, 2021, 6:32 p.m. UTC | #1
Hello Ilya,

Ilya Maximets <i.maximets@ovn.org> writes:

> 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@ovn.org>
> ---

The patch LGTM and works as expected.
Do you think it makes sense to include a 'Fixes' tag?

In any case:

Acked-by: Paolo Valerio <pvalerio@redhat.com>
Ilya Maximets Nov. 30, 2021, 3 p.m. UTC | #2
On 11/24/21 19:32, Paolo Valerio wrote:
> Hello Ilya,
> 
> Ilya Maximets <i.maximets@ovn.org> writes:
> 
>> 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@ovn.org>
>> ---
> 
> The patch LGTM and works as expected.
> Do you think it makes sense to include a 'Fixes' tag?

I don't know perl enough to figure out if the issue existed
in the original perl script and I'm too lazy to actually test
that.  The issue exists on all supported branches and it's also
the issue with tests and not with the OVS itself, so the 'Fixes'
tag is not very important.

> 
> In any case:
> 
> Acked-by: Paolo Valerio <pvalerio@redhat.com>
> 

Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.
diff mbox series

Patch

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',