-void *
-pkt_push_ipv4 (vlib_main_t * vm, vlib_buffer_t * b, ip4_address_t * src,
- ip4_address_t * dst, int proto)
-{
- ip4_header_t *ih;
-
- /* make some room */
- ih = vlib_buffer_push_uninit (b, sizeof (ip4_header_t));
-
- ih->ip_version_and_header_length = 0x45;
- ih->tos = 0;
- ih->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b));
-
- /* iph->fragment_id = clib_host_to_net_u16(get_IP_ID ()); */
-
- /* TODO: decide if we allow fragments in case of control */
- ih->flags_and_fragment_offset = clib_host_to_net_u16 (IP_DF);
- ih->ttl = 255;
- ih->protocol = proto;
- ih->src_address.as_u32 = src->as_u32;
- ih->dst_address.as_u32 = dst->as_u32;
-
- ih->checksum = ip4_header_checksum (ih);
- return ih;
-}
-
-void *
-pkt_push_ipv6 (vlib_main_t * vm, vlib_buffer_t * b, ip6_address_t * src,
- ip6_address_t * dst, int proto)
-{
- ip6_header_t *ip6h;
- u16 payload_length;
-
- /* make some room */
- ip6h = vlib_buffer_push_uninit (b, sizeof (ip6_header_t));
-
- ip6h->ip_version_traffic_class_and_flow_label =
- clib_host_to_net_u32 (0x6 << 28);
-
- /* calculate ip6 payload length */
- payload_length = vlib_buffer_length_in_chain (vm, b);
- payload_length -= sizeof (*ip6h);
-
- ip6h->payload_length = clib_host_to_net_u16 (payload_length);
-
- ip6h->hop_limit = 0xff;
- ip6h->protocol = proto;
- clib_memcpy (ip6h->src_address.as_u8, src->as_u8,
- sizeof (ip6h->src_address));
- clib_memcpy (ip6h->dst_address.as_u8, dst->as_u8,
- sizeof (ip6h->src_address));
-
- return ip6h;
-}
-