[ovs-discuss] DP_Packet Payload Modification

Luca Mancini luca.mancini at outlook.com
Fri Jun 5 18:00:07 UTC 2020


Hi Greg,
I realized I didn’t give a lot of context..
Basically, I’m implementing a custom action which is meant to buffer an x amount of dp_packets that match a certain flow, and then send a new packet directly from the switch, containing the buffer of packets, as its payload. At some other switch this payload is then meant to be extracted so that I can retrieve the buffer of dp_packets and send the single packets contained in the buffer to the correct hosts.
My action is implemented in userspace only for now since efficiency isn’t a concern for me atm. I already implemented the buffering mechanism and it works, and now I’m trying to create this custom udp packet so that I can store the buffer in it. For now I’m only trying to create a dummy udp packet with a “hello world” string as its payload just to see if I can create this custom packet however I just can’t figure out what I’m missing. My most recent attempt is the following:

1.Extract flow from one of the previously stored dp_packets
2.create a new dp_packet with dp_packet_new(65035)
3.use flow_compose() function on new packet to create a valid packet
4.add payload with dp_packet_put

Code:
struct flow flow;
flow_extract(&dp_packet_buff1[0].packet, &flow);
flow_compose(packetAggr, &flow, NULL, 0);
char * payload = "hello world";
dp_packet_put(packetAggr, payload, sizeof payload);

if I print out the payload I get the string “hello w” so maybe I’m forgetting something when I build the new packet.
Any help is very appreciated!

Cheers,

L


From: Gregory Rose<mailto:gvrose8192 at gmail.com>
Sent: Friday, June 5, 2020 18:58
To: Luca Mancini<mailto:luca.mancini at outlook.com>; ovs-discuss at openvswitch.org<mailto:ovs-discuss at openvswitch.org>
Subject: Re: [ovs-discuss] DP_Packet Payload Modification



On 6/4/2020 10:06 AM, Luca Mancini wrote:
> Hello,
> This is sort of a repost from my previous question about creating a custom udp payload.
> I figured I could just clone a received udp payload and modify its payload, do you think this is possible?  I tried creating a packet from 0 but I just couldn’t manage to do it.
>
> I’m guessing I could do something along the lines of dp_packet_clone(), dp_packet_l4() to get the pointer to the UDP header and then overwrite it with memcpy?
> Any help is really appreciated, Thanks!
>
> Luca Mancini

Luca,

I'm having a hard time understanding this.  If you want to generate a
UDP packet with custom payload why not just use scapy or some other such
tool?

- Greg

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


More information about the discuss mailing list