#include <vnet/ipip/ipip.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/mpls/mpls.h>
-#include <vnet/pg/pg.h>
+#include <vnet/tunnel/tunnel_dp.h>
#include <vppinfra/sparse_vec.h>
#define foreach_ipip_input_next \
ip4_header_t *ip40;
ip6_header_t *ip60;
u32 next0 = IPIP_INPUT_NEXT_DROP;
- ip46_address_t src0 = ip46_address_initializer, dst0 =
- ip46_address_initializer;
- ipip_transport_t transport0;
u8 inner_protocol0;
bi0 = to_next[0] = from[0];
b0 = vlib_get_buffer (vm, bi0);
+ ipip_tunnel_key_t key0 = {
+ .fib_index = vnet_buffer (b0)->ip.fib_index,
+ .mode = IPIP_MODE_P2P,
+ };
+
if (is_ipv6)
{
ip60 = vlib_buffer_get_current (b0);
}
vlib_buffer_advance (b0, sizeof (*ip60));
- ip_set (&src0, &ip60->src_address, false);
- ip_set (&dst0, &ip60->dst_address, false);
+ ip_set (&key0.dst, &ip60->src_address, false);
+ ip_set (&key0.src, &ip60->dst_address, false);
inner_protocol0 = ip60->protocol;
- transport0 = IPIP_TRANSPORT_IP6;
+ key0.transport = IPIP_TRANSPORT_IP6;
}
else
{
goto drop;
}
vlib_buffer_advance (b0, sizeof (*ip40));
- ip_set (&src0, &ip40->src_address, true);
- ip_set (&dst0, &ip40->dst_address, true);
+ ip_set (&key0.dst, &ip40->src_address, true);
+ ip_set (&key0.src, &ip40->dst_address, true);
inner_protocol0 = ip40->protocol;
- transport0 = IPIP_TRANSPORT_IP4;
+ key0.transport = IPIP_TRANSPORT_IP4;
}
/*
* Find tunnel. First a lookup for P2P tunnels, then a lookup
* for multipoint tunnels
*/
- ipip_tunnel_key_t key0 = {.transport = transport0,
- .fib_index = vnet_buffer (b0)->ip.fib_index,
- .src = dst0,
- .dst = src0
- };
ipip_tunnel_t *t0 = ipip_tunnel_db_find (&key0);
if (!t0)
{
ip46_address_reset (&key0.dst);
+ key0.mode = IPIP_MODE_6RD;
t0 = ipip_tunnel_db_find (&key0);
if (!t0)
{
{
next0 = IPIP_INPUT_NEXT_IP6_INPUT;
- if (t0->flags & IPIP_TUNNEL_FLAG_DECAP_COPY_ECN)
- {
- if (is_ipv6)
- ip6_set_ecn_network_order ((ip60 + 1),
- ip6_ecn_network_order (ip60));
- else
- ip6_set_ecn_network_order ((ip6_header_t *) (ip40 + 1),
- ip4_header_get_ecn (ip40));
- }
+ if (is_ipv6)
+ tunnel_decap_fixup_6o6 (t0->flags, (ip60 + 1), ip60);
+ else
+ tunnel_decap_fixup_6o4 (t0->flags,
+ (ip6_header_t *) (ip40 + 1), ip40);
}
else if (inner_protocol0 == IP_PROTOCOL_IP_IN_IP)
{
next0 = IPIP_INPUT_NEXT_IP4_INPUT;
- if (t0->flags & IPIP_TUNNEL_FLAG_DECAP_COPY_ECN)
- {
- if (is_ipv6)
- ip4_header_set_ecn_w_chksum ((ip4_header_t *) (ip60 + 1),
- ip6_ecn_network_order
- (ip60));
- else
- ip4_header_set_ecn_w_chksum (ip40 + 1,
- ip4_header_get_ecn (ip40));
- }
+
+ if (is_ipv6)
+ tunnel_decap_fixup_4o6 (t0->flags,
+ (ip4_header_t *) (ip60 + 1), ip60);
+ else
+ tunnel_decap_fixup_4o4 (t0->flags, ip40 + 1, ip40);
}
if (!is_ipv6 && t0->mode == IPIP_MODE_6RD