[ovs-discuss] Adding a new OpenFlow action to ovs, ctx->xin->packet is null

Christian Stigen Larsen cslarsen at gmail.com
Wed May 14 03:24:03 UTC 2014


Hi,

> Den 11. mai 2014 kl. 04:19 skrev Ben Pfaff <blp at nicira.com>:
> 
>> On Sat, May 10, 2014 at 06:11:29PM +0200, Christian Stigen Larsen wrote:
>> 
>> Ben Pfaff <blp at nicira.com>:
>>>> Is do_xlate_actions ("translate actions"?) the wrong place for this kind of
>>>> stuff?  How can I get a pointer to the raw packet data?
>>> 
>>> Usually, ofproto-dpif-xlate should not actually implement the OpenFlow
>>> actions.
>> 
>> Sorry for being trigger-happy, but even if I chose to implement datapath
>> actions, how can I inspect the packet data?  For some reason I get a
>> NULL-pointer in ctx->xin->packet, while, e.g., OFPACT_OUTPUT in
>> do_xlate_actions gets the full packet.
> 
> Often the packet data is not available because userspace is not
> processing a particular packet.  Instead, it is deciding what to do with
> the entire class of packets specified by the flow data.  You are only
> guaranteed to get full packets if during processing you add a flag for
> "slow" processing as I described earlier.

Quick question: In odp-execute I call set_ether_type (cant remember the exact name at the moment) on the ofpbuf packet. In my example this buffer has size=81.

That is all I do in my action, and I can clearly see that it's working -- it sets the correct place under offset 12 in packet->l2 w/right number of bytes. 

The action after mine is a simple output:1 action, and works too.

However, wireshark reports that the packet is now 67 bytes (from l2 and up) -- and my testing shows it indeed is. Strangely enough, data is capped from L3, i.e. its tail is truncated. And 81-67=14, which is too much of a coincidence as the eth hdr is exactly 14 bytes. 

Again, all I do is set the ether type. Do you find this strange, or do you immediately know that I must have forgotten setting any magic flags or fields? If you can't think of anythinh it could be my code, but I've gone through it several times, and I don't do any bad memmoves or stuff like that. 

Regards,

Christian


More information about the discuss mailing list