> On 12.04.2021., at 10:34, David Gohberg <[email protected]> wrote: > > [Edited Message Follows] > > moving the buffer backwards by 14 looks correct for small packets, but for > 1500 byte packets I get `truncated-ip - 14 bytes missing` error from tcpdump. > After the clone I'm restoring the original offset: > vlib_buffer_advance (b0, -14); > u16 n_cloned = vlib_buffer_clone (vm, bi0, (u32*)&cbi0, 2, > VLIB_BUFFER_CLONE_HEAD_SIZE); > vlib_buffer_advance (b0, 14);
If you look into my explanation how cloning works you can realize that using b0 after clone is bad idea. b0 is pointer to buffer which is not head buffer anymore. b0 = vlib_get_buffer (vm, cbi0[0]); after cloning may help. Still this is ugly hack. If you are executing this code inside IP path, there is no guarantee that l2 header will be there as packet may arrive from l3 interface (memif, tun) or from l3 encapsulation (ipsec). Also packet may be dot1Q tagged so ethernet header will not be 14 bytes long. — Damjan
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#19177): https://lists.fd.io/g/vpp-dev/message/19177 Mute This Topic: https://lists.fd.io/mt/81938105/21656 Group Owner: [email protected] Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
