On Mon, 20 Aug 2018 11:05:08 -0700
Ori Bernstein <o...@eigenstate.org> wrote:
> On Mon, 20 Aug 2018 23:38:28 +0900 (JST), YASUOKA Masahiko 
> <yasu...@openbsd.org> wrote:
>> As far as I know, switch(4) assumes it receives packets located at 64
>> bit aligned memory.  So if the code like below
>> 
>>      *(uint64_t *)oxm->oxm_value = htobe64(val);
>> 
>> cause alignment faults, the assumption may be broken.  If so, the
>> place we should fix may not be here.
> 
> The reason we are suspicious here is because oxm_value comes from struct
> ofp_ox_match, which is defined like this:
> 
>       struct ofp_ox_match {
>               uint16_t        oxm_class;
>               uint8_t         oxm_fh;
>               uint8_t         oxm_length;
>               uint8_t         oxm_value[0];
>       } __packed;
> 
> While the packet may be aligned to 8 bytes, my reading is that the oxm_value
> itself is not at the start of the packet, and is not aligned within the
> ofp_ox_match. I'm not familiar enough with the open flowz to know if
> ofp_ox_match is guaranteed to start at a 4-byte alignment (which would
> push oxm_value out to an 8 byte alignment), but I suspect that's not the
> case.

You are right.  I'm sorry.  My understanding was wrong.

Overall flow match structures is designed to align to 64-bits, but as
for each fields, there is no such care.  So the diff seems ok.

--yasuoka

Reply via email to