Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[openflow-discuss] OpenFlow 1.1 ofp_packet_in padding clarification

Zoltán Lajos Kis zoltan.lajos.kis at
Fri Aug 26 02:18:27 PDT 2011


I need some clarification on the data field for ofp_packet_in. The OF 1.1 spec contains the following comment:

/* Ethernet frame, halfway through 32-bit word, so the IP header is 32-bit aligned. The amount of data is inferred from the length field in the header. Because of padding, offsetof(struct ofp_packet_in, data) == sizeof(struct ofp_packet_in) - 2. */

Does this supposed to mean that the data field should start with two bytes of padding (i.e. junk data), and the datapath packet should only follow after that (so that the ethernet header now ends after 16 bytes, so the IP header will start at a 32bit boundary)? In other words, the packet format should really be:

uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */
uint8_t table_id; /* ID of the table that was looked up */
uint8_t pad[2];
uint8_t data[0];

But in essence we are afraid the "implementor" would be dumb enough not to use e.g. the packed attribute, and so the compiler would mess things up, we instead moved the padding into the comments section?

Also I suppose the equation in the comment should read something like:
data_len = ofp_header.length - sizeof(struct ofp_packet_in) - 2.

What's the case with packet_out; should the data field also contain some implicit padding there for IP header alignment?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the openflow-discuss mailing list