Ok, cancel that.
Basically from gdb I discovered that a previous pointer to a dp_packet is being 
overwritten, to explain better:

Suppose I send 3 packets “everyone”, “hello”, “a”

Once the packet “everyone” matches the flow, ovs  goes in my function
compose_foo(ctx):
                //prints the payload of the packet
                VLOG_ERR("%s", (char *) 
dp_packet_get_udp_payload(ctx->xin->packet));

Gdb shows --> dp_packet_get_udp_payload (b=0x7ffff626f1e0) where b is the 
pointer to the dp_packet
Everything is fine for the first packet so it is printed normally.

Second packet “hits” so compose_foo(ctx) is called again
Gdb shows --> dp_packet_get_udp_payload (b=0x7ffff626f460)
Pointer is different than the previous one so it is printed normally

Third packet (packet “a”) hits so compose_foo(ctx) is called for the last time
Gdb shows --> dp_packet_get_udp_payload (b=0x7ffff626f1e0)
pointer is the same as the one used for packet “everyone” so it overlaps its 
payload printing:

“a
eryone”

so basically the const struct dp_packet pointer isn’t cleaned/freed and it is 
overwritten causing the issue, now the question is how can I free this pointer?
Any idea how to do this?



L

From: Luca Mancini<mailto:luca.manc...@outlook.com>
Sent: Wednesday, May 20, 2020 17:15
To: William Tu<mailto:u9012...@gmail.com>
Cc: ovs-discuss@openvswitch.org<mailto:ovs-discuss@openvswitch.org>
Subject: Re: [ovs-discuss] ctx->xin-packet overlap


Ok I think I figured out the issue, basically while the 
dp_packet_get_udp_payload is called, sometimes, the execution goes back to 
do_xlate_Actions, “rewriting” ctx and therefore causing the overlap.
Is there a way to “freeze” the ctx value until the printing is done?


L

From: William Tu<mailto:u9012...@gmail.com>
Sent: Tuesday, May 19, 2020 17:41
To: Luca Mancini<mailto:luca.manc...@outlook.com>
Cc: ovs-discuss@openvswitch.org<mailto:ovs-discuss@openvswitch.org>
Subject: Re: [ovs-discuss] ctx->xin-packet overlap

On Mon, May 18, 2020 at 7:10 AM Luca Mancini <luca.manc...@outlook.com> wrote:
>
>
>
> 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”
>
>
Oh, I see your point.
Maybe you can try add a break point using gdb, and see where the memory
address is when assigning string to different indexes.
William


_______________________________________________
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to