On Mon, May 18, 2020 at 6:10 AM Luca Mancini <[email protected]> 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 > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-discuss _______________________________________________ discuss mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
