On 19 Jan 2026, at 19:10, Ilya Maximets wrote:
> On 1/19/26 5:57 PM, Aaron Conole wrote: >> Eelco Chaudron via dev <[email protected]> writes: >> >>> Add the '--len' option to 'ovs-ofctl compose-packet', which >>> allows truncation or extension (with zeros) of the generated >>> packet. >>> >>> Fixes: 90b6e83beb60 ("tests: Fix NSH decap header test for real Ethernet >>> devices.") >>> Signed-off-by: Eelco Chaudron <[email protected]> [...] >>> + if (opt_len) { >>> + size_t p_len = dp_packet_size(&p); >>> + >>> + if (opt_len > p_len) { >>> + dp_packet_put_zeros(&p, opt_len - p_len); >>> + } else { >>> + dp_packet_set_size(&p, opt_len); >>> + } >>> + } >>> + >> >> I think we should be using packet_expand() instead of the direct >> dp_packet_put_zeros call - the reason is to ensure that checksums are >> properly regenerated. WDYT? > > +1 from me on this one. Main part is length fields though. Without > updating the length in the header, this is just padding. Thanks Ilya and Aaron, I’ll switch this to use packet_expand(). I won’t support truncating packets here, as there’s no real need for it, and it avoids the extra complexity of getting that right. I’ll send a v2. //Eelco [...] _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
