static u32 running_fragment_id;
-static void
+void
ip4_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer,
ip_frag_error_t * error)
{
ptr = 0;
max = (mtu - sizeof (*ip4) - vnet_buffer (p)->ip_frag.header_offset) & ~0x7;
- if (rem < (p->current_length - offset - sizeof (*ip4)))
+ if (rem > (p->current_length - offset - sizeof (*ip4)))
{
*error = IP_FRAG_ERROR_MALFORMED;
return;
return;
}
+ if (p->flags & VLIB_BUFFER_NEXT_PRESENT)
+ {
+ *error = IP_FRAG_ERROR_MALFORMED;
+ return;
+ }
+
if (ip4_is_fragment (ip4))
{
ip_frag_id = ip4->fragment_id;
vnet_buffer (p)->sw_if_index[VLIB_RX];
vnet_buffer (b)->sw_if_index[VLIB_TX] =
vnet_buffer (p)->sw_if_index[VLIB_TX];
+ /* Copy Adj_index in case DPO based node is sending for the fragmentation,
+ the packet would be sent back to the proper DPO next node and Index */
+ vnet_buffer (b)->ip.adj_index[VLIB_RX] =
+ vnet_buffer (p)->ip.adj_index[VLIB_RX];
+ vnet_buffer (b)->ip.adj_index[VLIB_TX] =
+ vnet_buffer (p)->ip.adj_index[VLIB_TX];
fip4 = (ip4_header_t *) (vlib_buffer_get_current (b) + offset);
//Copy offset and ip4 header
}
-static void
+void
ip6_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer,
ip_frag_error_t * error)
{
return;
}
+ if (p->flags & VLIB_BUFFER_NEXT_PRESENT)
+ {
+ *error = IP_FRAG_ERROR_MALFORMED;
+ return;
+ }
+
u8 has_more;
u16 initial_offset;
if (*next_header == IP_PROTOCOL_IPV6_FRAGMENTATION)
vnet_buffer (p)->sw_if_index[VLIB_RX];
vnet_buffer (b)->sw_if_index[VLIB_TX] =
vnet_buffer (p)->sw_if_index[VLIB_TX];
+
+ /* Copy Adj_index in case DPO based node is sending for the fragmentation,
+ the packet would be sent back to the proper DPO next node and Index */
+ vnet_buffer (b)->ip.adj_index[VLIB_RX] =
+ vnet_buffer (p)->ip.adj_index[VLIB_RX];
+ vnet_buffer (b)->ip.adj_index[VLIB_TX] =
+ vnet_buffer (p)->ip.adj_index[VLIB_TX];
+
clib_memcpy (vlib_buffer_get_current (b),
vlib_buffer_get_current (p), headers_len);
clib_memcpy (vlib_buffer_get_current (b) + headers_len,