ip: frags should have as much space for headers as original 54/43754/2
authorFlorin Coras <[email protected]>
Thu, 25 Sep 2025 17:52:21 +0000 (13:52 -0400)
committerFlorin Coras <[email protected]>
Thu, 25 Sep 2025 18:05:23 +0000 (18:05 +0000)
Type: improvement

Change-Id: Ic8ef26f588a7c161abbe63b3887a76faa32872de
Signed-off-by: Florin Coras <[email protected]>
src/vnet/ip/ip_frag.c

index aa7a031..adf49e9 100644 (file)
@@ -173,8 +173,9 @@ ip4_frag_do_fragment (vlib_main_t * vm, u32 from_bi, u16 mtu,
       vec_add1 (*buffer, to_bi);
       frag_set_sw_if_index (to_b, org_from_b);
 
-      /* Copy ip4 header */
-      to_data = vlib_buffer_get_current (to_b);
+      /* Make sure we have as much space for headers as the original and copy
+       * ip4 header */
+      to_data = vlib_buffer_make_headroom (to_b, org_from_b->current_data);
       clib_memcpy_fast (to_data, org_from_packet, head_bytes);
       to_ip4 = (ip4_header_t *) (to_data + l2unfragmentablesize);
       to_data = (void *) (to_ip4 + 1);