[ovs-discuss] ctx->xin-packet overlap

Luca Mancini luca.mancini at outlook.com
Mon May 18 14:10:06 UTC 2020


Hi William,

Thanks for replying so promptly.
I’m still not quite sure what you mean, when I print I use:

VLOG_ERR(   “%s”     ,      (char *) dp_packet_get_udp_payload(dp_packet_buff[index])     );

Why would the second packet received assigned from ctx->xin->packet and stored in dp_packet_buff[index + 1] overlap with the first packet.
So using the example from before upon first packet:

1. Index=0
2. Ctx->xin->packet = “everyone”
3. dp_packet_buff[0] = {“Everyone”}
4. print with VLOG_ERR as above
5. index++
6. Ctx->xin->packet = “hello”
7. But dp_packet_buff[1] ={“hello ne”} instead of {“hello”}

Isn’t the problem due to ctx->xin->packet being overwritten by subsequent packets? To explain better, on point 6 the actual packet contained in ctx->xin-packet is “hello ne” and not “hello”


Luca

From: William Tu<mailto:u9012063 at gmail.com>
Sent: Monday, May 18, 2020 15:22
To: Luca Mancini<mailto:luca.mancini at outlook.com>
Cc: ovs-discuss at openvswitch.org<mailto:ovs-discuss at openvswitch.org>
Subject: Re: [ovs-discuss] ctx->xin-packet overlap

On Mon, May 18, 2020 at 6:10 AM Luca Mancini <luca.mancini at outlook.com> wrote:
>
> Hi,
>
> In userspace I’m storing the packets received in an array of struct dp_packets, however if I try to print these packets I notice that as packets come in, they overlap as if for every packet received the previous ctx->xin->packet is overwritten.
>
>
>
> My code looks something like:
>
>
>
>
>
> Dp_packet_buff[index] = ctx->xin->packet;
>
> VLOG_ERR(   “%s”     ,      (char *) dp_packet_get_udp_payload(dp_packet_buff[index)     );
>
you're printing %s, so it will print char until hitting '\0'
probably you should print in hex, and give it a fixed length.
ex:
struct ds ds;
ds_put_hex(&ds,  dp_packet_get_udp_payload(dp_packet_buff[index], 20)
VLOG_ERR(   “%s”  , ds_cstr(&ds));

William
> Index++
>
>
>
> e.g:
>
> 3 packets arrive: “everyone”, “hello”, ”aa”
>
>
>
> The array stores [“everyone”, “hello ne”, “aa  lo ne”]
>
> Instead of [“everyone”, “hello”, “aa”]
>
>
>
> Basically if the received packet is smaller than the one before it, it overwrites what is contained in ctx->xin->packet and it keeps the remainder of the previous “non-overwritten” string.
>
> Is anyone able to tell me how to fix this, is there a way to cancel what is contained in ctx->xin->packet after saving it in the buffer? I’ve tried setting it to NULL but the overwriting still occurs.
>
> Been working on this bug for 3 days, hopefully someone can help me out,
>
> Thanks
>
>
>
> Luca
>
>
>
> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20200518/f2cf781c/attachment-0001.html>


More information about the discuss mailing list