summaryrefslogtreecommitdiffstats
path: root/src/vnet/geneve/decap.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-04-03 07:46:28 +0000
committerDamjan Marion <dmarion@me.com>2020-04-10 12:21:30 +0000
commit91fd910d7d7611a28d1f85482ed5d5c3ee6a8853 (patch)
treef2594418e3e7e80a69f16491da15a7af152feb1a /src/vnet/geneve/decap.c
parentae9c45938bdf6e180f83f02aed31113e60db20a9 (diff)
geneve: Fix the byte swapping for the VNI
Type: fix - swipe away the vomit indent left last time. - add tests for VNIs > 16bit Change-Id: I2d1f591bfb9d7a18996c38969365a509168d4193 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/geneve/decap.c')
-rw-r--r--src/vnet/geneve/decap.c76
1 files changed, 31 insertions, 45 deletions
diff --git a/src/vnet/geneve/decap.c b/src/vnet/geneve/decap.c
index a04c1d41e90..10a17cef35d 100644
--- a/src/vnet/geneve/decap.c
+++ b/src/vnet/geneve/decap.c
@@ -213,7 +213,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4)
{
key4_0.remote = ip4_0->src_address.as_u32;
- key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64))
@@ -248,7 +248,7 @@ geneve_input (vlib_main_t * vm,
(ip4_address_is_multicast (&ip4_0->dst_address)))
{
key4_0.remote = ip4_0->dst_address.as_u32;
- key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */
p0 = hash_get (vxm->geneve4_tunnel_by_key, key4_0.as_u64);
if (PREDICT_TRUE (p0 != NULL))
@@ -266,7 +266,7 @@ geneve_input (vlib_main_t * vm,
{
key6_0.remote.as_u64[0] = ip6_0->src_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->src_address.as_u64[1];
- key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE
@@ -303,7 +303,7 @@ geneve_input (vlib_main_t * vm,
{
key6_0.remote.as_u64[0] = ip6_0->dst_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->dst_address.as_u64[1];
- key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
p0 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_0);
if (PREDICT_TRUE (p0 != NULL))
{
@@ -380,7 +380,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4)
{
key4_1.remote = ip4_1->src_address.as_u32;
- key4_1.vni = vnet_get_geneve_vni_bigendian (geneve1);
+ key4_1.vni = vnet_get_geneve_vni_network_order (geneve1);
/* Make sure unicast GENEVE tunnel exist by packet SIP and VNI */
if (PREDICT_FALSE (key4_1.as_u64 != last_key4.as_u64))
@@ -415,7 +415,7 @@ geneve_input (vlib_main_t * vm,
(ip4_address_is_multicast (&ip4_1->dst_address)))
{
key4_1.remote = ip4_1->dst_address.as_u32;
- key4_1.vni = vnet_get_geneve_vni_bigendian (geneve1);
+ key4_1.vni = vnet_get_geneve_vni_network_order (geneve1);
/* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */
p1 = hash_get (vxm->geneve4_tunnel_by_key, key4_1.as_u64);
if (PREDICT_TRUE (p1 != NULL))
@@ -433,7 +433,7 @@ geneve_input (vlib_main_t * vm,
{
key6_1.remote.as_u64[0] = ip6_1->src_address.as_u64[0];
key6_1.remote.as_u64[1] = ip6_1->src_address.as_u64[1];
- key6_1.vni = vnet_get_geneve_vni_bigendian (geneve1);
+ key6_1.vni = vnet_get_geneve_vni_network_order (geneve1);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE
@@ -472,7 +472,7 @@ geneve_input (vlib_main_t * vm,
{
key6_1.remote.as_u64[0] = ip6_1->dst_address.as_u64[0];
key6_1.remote.as_u64[1] = ip6_1->dst_address.as_u64[1];
- key6_1.vni = vnet_get_geneve_vni_bigendian (geneve1);
+ key6_1.vni = vnet_get_geneve_vni_network_order (geneve1);
p1 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_1);
if (PREDICT_TRUE (p1 != NULL))
{
@@ -618,7 +618,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4)
{
key4_0.remote = ip4_0->src_address.as_u32;
- key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure unicast GENEVE tunnel exist by packet SIP and VNI */
if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64))
@@ -653,7 +653,7 @@ geneve_input (vlib_main_t * vm,
(ip4_address_is_multicast (&ip4_0->dst_address)))
{
key4_0.remote = ip4_0->dst_address.as_u32;
- key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */
p0 = hash_get (vxm->geneve4_tunnel_by_key, key4_0.as_u64);
if (PREDICT_TRUE (p0 != NULL))
@@ -671,7 +671,7 @@ geneve_input (vlib_main_t * vm,
{
key6_0.remote.as_u64[0] = ip6_0->src_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->src_address.as_u64[1];
- key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE
@@ -708,7 +708,7 @@ geneve_input (vlib_main_t * vm,
{
key6_0.remote.as_u64[0] = ip6_0->dst_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->dst_address.as_u64[1];
- key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0);
+ key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
p0 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_0);
if (PREDICT_TRUE (p0 != NULL))
{
@@ -1240,24 +1240,17 @@ VLIB_NODE_FN (ip4_geneve_bypass_node) (vlib_main_t * vm,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_geneve_bypass_node) =
{
- .name = "ip4-geneve-bypass",.vector_size =
- sizeof (u32),.n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,.next_nodes =
+ .name = "ip4-geneve-bypass",
+ .vector_size = sizeof (u32),
+ .n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,.next_nodes =
{
- [IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop",
- [IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve4-input",}
-,.format_buffer = format_ip4_header,.format_trace =
- format_ip4_forward_next_trace,};
-
-#ifndef CLIB_MARCH_VARIANT
-/* Dummy init function to get us linked in. */
- clib_error_t *ip4_geneve_bypass_init (vlib_main_t * vm)
-{
- return 0;
-}
-
-VLIB_INIT_FUNCTION (ip4_geneve_bypass_init);
+ [IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop",
+ [IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve4-input",
+ },
+ .format_buffer = format_ip4_header,
+ .format_trace = format_ip4_forward_next_trace,
+};
/* *INDENT-ON* */
-#endif /* CLIB_MARCH_VARIANT */
VLIB_NODE_FN (ip6_geneve_bypass_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
@@ -1269,26 +1262,19 @@ VLIB_NODE_FN (ip6_geneve_bypass_node) (vlib_main_t * vm,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_geneve_bypass_node) =
{
- .name = "ip6-geneve-bypass",.vector_size =
- sizeof (u32),.n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,.next_nodes =
+ .name = "ip6-geneve-bypass",
+ .vector_size = sizeof (u32),
+ .n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,
+ .next_nodes =
{
- [IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop",
- [IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve6-input",}
-,.format_buffer = format_ip6_header,.format_trace =
- format_ip6_forward_next_trace,};
+ [IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop",
+ [IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve6-input",
+ },
+ .format_buffer = format_ip6_header,
+ .format_trace = format_ip6_forward_next_trace,
+};
/* *INDENT-ON* */
-#ifndef CLIB_MARCH_VARIANT
-/* Dummy init function to get us linked in. */
-clib_error_t *
-ip6_geneve_bypass_init (vlib_main_t * vm)
-{
- return 0;
-}
-
-VLIB_INIT_FUNCTION (ip6_geneve_bypass_init);
-#endif /* CLIB_MARCH_VARIANT */
-
/*
* fd.io coding-style-patch-verification: ON
*