*/
#include <vlib/vlib.h>
-#include <vnet/pg/pg.h>
+
#include <vnet/vxlan-gbp/vxlan_gbp.h>
typedef struct
vxlan4_gbp_tunnel_key_t key4;
int rv;
- key4.key[1] = ((u64) fib_index << 32) | vxlan_gbp0->vni_reserved;
- key4.key[0] = (((u64) ip4_0->dst_address.as_u32 << 32) |
- ip4_0->src_address.as_u32);
+ key4.key[1] = (((u64) fib_index << 32) |
+ (vxlan_gbp0->vni_reserved &
+ clib_host_to_net_u32 (0xffffff00)));
+ key4.key[0] =
+ (((u64) ip4_0->dst_address.as_u32 << 32) | ip4_0->src_address.as_u32);
if (PREDICT_FALSE (key4.key[0] != cache->key[0] ||
key4.key[1] != cache->key[1]))
.key = {
[0] = ip6_0->src_address.as_u64[0],
[1] = ip6_0->src_address.as_u64[1],
- [2] = (((u64) fib_index) << 32) | vxlan_gbp0->vni_reserved,
+ [2] = ((((u64) fib_index) << 32) |
+ (vxlan_gbp0->vni_reserved &
+ clib_host_to_net_u32 (0xffffff00))),
}
};
int rv;
vlib_buffer_advance (b0, sizeof *vxlan_gbp0);
vlib_buffer_advance (b1, sizeof *vxlan_gbp1);
+ u8 i_and_g0 = ((flags0 & VXLAN_GBP_FLAGS_GI) == VXLAN_GBP_FLAGS_GI);
+ u8 i_and_g1 = ((flags1 & VXLAN_GBP_FLAGS_GI) == VXLAN_GBP_FLAGS_GI);
+
/* Validate VXLAN_GBP tunnel encap-fib index against packet */
- if (PREDICT_FALSE
- (t0 == NULL
- || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
+ if (PREDICT_FALSE (t0 == NULL || !i_and_g0))
{
- if (t0 != NULL
- && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
+ if (t0 != NULL && !i_and_g0)
{
error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
vlib_increment_combined_counter
else
{
error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
- next0 = VXLAN_GBP_INPUT_NEXT_NO_TUNNEL;
+ next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
+ if (is_ip4)
+ b0->punt_reason =
+ vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4];
+ else
+ b0->punt_reason =
+ vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP6];
}
b0->error = node->errors[error0];
}
pkts_decapsulated++;
}
- vnet_buffer2 (b0)->gbp.flags = vxlan_gbp_get_gpflags (vxlan_gbp0);
+ vnet_buffer2 (b0)->gbp.flags = (vxlan_gbp_get_gpflags (vxlan_gbp0) |
+ VXLAN_GBP_GPFLAGS_R);
vnet_buffer2 (b0)->gbp.sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
- if (PREDICT_FALSE
- (t1 == 0 || flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
+ if (PREDICT_FALSE (t1 == NULL || !i_and_g1))
{
- if (t1 != 0
- && flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
+ if (t1 != NULL && !i_and_g1)
{
error1 = VXLAN_GBP_ERROR_BAD_FLAGS;
vlib_increment_combined_counter
else
{
error1 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
- next1 = VXLAN_GBP_INPUT_NEXT_NO_TUNNEL;
+ next1 = VXLAN_GBP_INPUT_NEXT_PUNT;
+ if (is_ip4)
+ b1->punt_reason =
+ vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4];
+ else
+ b1->punt_reason =
+ vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP6];
}
b1->error = node->errors[error1];
}
(rx_counter, thread_index, t1->sw_if_index, 1, len1);
}
- vnet_buffer2 (b1)->gbp.flags = vxlan_gbp_get_gpflags (vxlan_gbp1);
+ vnet_buffer2 (b1)->gbp.flags = (vxlan_gbp_get_gpflags (vxlan_gbp1) |
+ VXLAN_GBP_GPFLAGS_R);
+
vnet_buffer2 (b1)->gbp.sclass = vxlan_gbp_get_sclass (vxlan_gbp1);
vnet_update_l2_len (b0);
/* pop (ip, udp, vxlan_gbp) */
vlib_buffer_advance (b0, sizeof (*vxlan_gbp0));
+
+ u8 i_and_g0 = ((flags0 & VXLAN_GBP_FLAGS_GI) == VXLAN_GBP_FLAGS_GI);
+
/* Validate VXLAN_GBP tunnel encap-fib index against packet */
- if (PREDICT_FALSE
- (t0 == NULL
- || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
+ if (PREDICT_FALSE (t0 == NULL || !i_and_g0))
{
- if (t0 != NULL
- && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
+ if (t0 != NULL && !i_and_g0)
{
error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
vlib_increment_combined_counter
else
{
error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
- next0 = VXLAN_GBP_INPUT_NEXT_NO_TUNNEL;
+ next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
+ if (is_ip4)
+ b0->punt_reason =
+ vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4];
+ else
+ b0->punt_reason =
+ vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP6];
}
b0->error = node->errors[error0];
}
vlib_increment_combined_counter
(rx_counter, thread_index, t0->sw_if_index, 1, len0);
}
- vnet_buffer2 (b0)->gbp.flags = vxlan_gbp_get_gpflags (vxlan_gbp0);
+ vnet_buffer2 (b0)->gbp.flags = (vxlan_gbp_get_gpflags (vxlan_gbp0) |
+ VXLAN_GBP_GPFLAGS_R);
+
vnet_buffer2 (b0)->gbp.sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
/* Required to make the l2 tag push / pop code work on l2 subifs */
IP_VXLAN_GBP_BYPASS_NEXT_DROP,
IP_VXLAN_GBP_BYPASS_NEXT_VXLAN_GBP,
IP_VXLAN_GBP_BYPASS_N_NEXT,
-} ip_vxan_gbp_bypass_next_t;
+} ip_vxlan_gbp_bypass_next_t;
always_inline uword
ip_vxlan_gbp_bypass_inline (vlib_main_t * vm,