Hi Michał, I will fix the style guide and spec alignment issues you pointed at elsewhere... > -----Original Message----- > > + if (key.phase == KEY_REFRESH_PHASE_TWO) { > > + memcpy(out + 1, key.new_key, 16); > > + snb_flags |= PROV_FLAG_KR; > > + } else > > + memcpy(out + 1, key.old_key, 16); > > + > > + l_put_be16(net_idx, out + 1 + 16); > > + l_put_u8(snb_flags, out + 1 + 16 + 2); > > + l_put_be32(iv_index, out + 1 + 16 + 2 + 1); > > + l_put_be16(primary, out + 1 + 16 + 2 + 1 + 4); > > Not really related to this patchset, but a general comment about packet > building and parsing: could we please move away from calculating byte offsets > and use packed structs instead? Do you have any opinion on that? You are probably right about this. Technically, this is a "Network Packet" (even though we locally encrypt it before sending) and so we should treat it like any packet we send over a socket (for instance, the HCI sockets we use to talk to controllers). This is a vestige of my "old man engineering" where I couldn't always trust compilers across all platforms to faithfully pack octets the same, but obviously if we are trusting the packing for HCI, we should be trusting the packing for this. I will scrub the code for opportunities for packing this (and other similar) structures.