Hi Ihar, Simon,

This is not very pretty but would it improve the situation (not even
importing scapy anymore)?

fmt_pkt() {
    echo "import binascii; \
          out = binascii.hexlify(raw($1)); \
          out.decode()" | scapy -H 2> /dev/null | awk '{print $4}' |
          cut -f 2 -d "'"
}

Regards,
Dumitru

On 4/20/23 14:56, Ihar Hrachyshka wrote:
> IANAL but
> 
> I don't think it's more of a problem than e.g. autoconf being GPL.
> (It's not.) We don't link with scapy, and it's only used in test
> suite. (Also, scapy was already used in the test suite before the
> patch.)
> 
> 
> On Thu, Apr 20, 2023 at 8:36 AM Simon Horman <simon.hor...@corigine.com> 
> wrote:
>>
>> On Wed, Apr 12, 2023 at 01:29:48AM +0000, Ihar Hrachyshka wrote:
>>> Scapy allows to define packets in descriptive form that is easier to
>>> digest and debug.
>>>
>>> Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com>
>>> ---
>>>  tests/ovn-macros.at | 23 +++++++++++++++++++++++
>>>  1 file changed, 23 insertions(+)
>>>
>>> diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
>>> index ee942e8a6..40ded7bd4 100644
>>> --- a/tests/ovn-macros.at
>>> +++ b/tests/ovn-macros.at
>>> @@ -817,6 +817,29 @@ ovn_trace_client() {
>>>      ovs-appctl -t $target trace "$@" | tee trace | sed '/^# /d'
>>>  }
>>>
>>> +# Receives a string that represents scapy python code that represents a 
>>> packet.
>>> +# Returns a hex-string that contains bytes that reflect the packet 
>>> description.
>>> +#
>>> +# Scapy docs: https://scapy.readthedocs.io/en/latest/usage.html
>>> +#
>>> +# Example of usage:
>>> +#
>>> +# packet=$(fmt_pkt "\
>>> +#     Ether(dst='ff:ff:ff:ff:ff:ff', src='50:64:00:00:00:01') /\
>>> +#     IPv6(src='abed::1', dst='ff02::1:ff00:2')               /\
>>> +#     ICMPv6ND_NS(tgt='abed::2')                               \
>>> +# ")
>>> +#
>>> +# ovs-appctl netdev-dummy/receive $vif $packet
>>> +#
>>> +fmt_pkt() {
>>> +    echo "from scapy.all import *; \
>>
>> Hi Ihar,
>>
>> My understanding is that Scapy's licence is GPL v2 [1]
>> whereas OVN is Apache. Is that a problem here?
>>
>> [1] 
>> https://github.com/secdev/scapy/blob/e65180e048ffdb0284a218b6e5ff6d090d4217bd/scapy/all.py#L1
>>
>>> +          import binascii; \
>>> +          out = binascii.hexlify(raw($1)); \
>>> +          print(out)" | python3 \
>>> +    | sed s/^b\'// | sed s/\'$//  # hexlify prints as b'...' -> truncate
>>> +}
>>> +
>>>  OVS_END_SHELL_HELPERS
>>>
>>>  m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], 
>>> [ignore])])
>>> --
>>> 2.34.1
>>>
>>> _______________________________________________
>>> dev mailing list
>>> d...@openvswitch.org
>>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>>
>>
> 
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to