aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-03-27 05:06:47 -0700
committerNeale Ranns <nranns@cisco.com>2019-03-27 13:40:50 +0000
commit4dd4cf4f9c02953f8ce7df0b2912e4da7c6786ed (patch)
treea576b3aec3b37fdc32b132ac554bbf7b20697559 /src/vnet
parentd709cbcb1ef80633af657c5427608831e5bbd919 (diff)
GBP: fixes for l3-out routing
Change-Id: I4d73b712da911588d511a8401b73cdc3c66346fe Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/vxlan-gbp/vxlan_gbp.api7
-rw-r--r--src/vnet/vxlan-gbp/vxlan_gbp_api.c26
2 files changed, 32 insertions, 1 deletions
diff --git a/src/vnet/vxlan-gbp/vxlan_gbp.api b/src/vnet/vxlan-gbp/vxlan_gbp.api
index 3e213ddc563..13ec50395bc 100644
--- a/src/vnet/vxlan-gbp/vxlan_gbp.api
+++ b/src/vnet/vxlan-gbp/vxlan_gbp.api
@@ -17,6 +17,12 @@
option version = "1.1.0";
import "vnet/ip/ip_types.api";
+enum vxlan_gbp_api_tunnel_mode
+{
+ VXLAN_GBP_API_TUNNEL_MODE_L2,
+ VXLAN_GBP_API_TUNNEL_MODE_L3,
+};
+
/** \brief Definition of a VXLAN GBP tunnel
@param instance - optional unique custom device instance, else ~0.
@param src - Source IP address
@@ -35,6 +41,7 @@ typedef vxlan_gbp_tunnel
u32 encap_table_id;
u32 vni;
u32 sw_if_index;
+ vl_api_vxlan_gbp_api_tunnel_mode_t mode;
};
/** \brief Create or delete a VXLAN-GBP tunnel
diff --git a/src/vnet/vxlan-gbp/vxlan_gbp_api.c b/src/vnet/vxlan-gbp/vxlan_gbp_api.c
index f5e97e5a364..6a87d4dda52 100644
--- a/src/vnet/vxlan-gbp/vxlan_gbp_api.c
+++ b/src/vnet/vxlan-gbp/vxlan_gbp_api.c
@@ -66,10 +66,29 @@ static void
REPLY_MACRO (VL_API_SW_INTERFACE_SET_VXLAN_GBP_BYPASS_REPLY);
}
+static int
+vxlan_gbp_tunnel_mode_decode (vl_api_vxlan_gbp_api_tunnel_mode_t in,
+ vxlan_gbp_tunnel_mode_t * out)
+{
+ in = clib_net_to_host_u32 (in);
+
+ switch (in)
+ {
+ case VXLAN_GBP_API_TUNNEL_MODE_L2:
+ *out = VXLAN_GBP_TUNNEL_MODE_L2;
+ return (0);
+ case VXLAN_GBP_API_TUNNEL_MODE_L3:
+ *out = VXLAN_GBP_TUNNEL_MODE_L3;
+ return (0);
+ }
+ return (1);
+}
+
static void vl_api_vxlan_gbp_tunnel_add_del_t_handler
(vl_api_vxlan_gbp_tunnel_add_del_t * mp)
{
vl_api_vxlan_gbp_tunnel_add_del_reply_t *rmp;
+ vxlan_gbp_tunnel_mode_t mode;
ip46_address_t src, dst;
ip46_type_t itype;
int rv = 0;
@@ -86,6 +105,11 @@ static void vl_api_vxlan_gbp_tunnel_add_del_t_handler
goto out;
}
+ rv = vxlan_gbp_tunnel_mode_decode (mp->tunnel.mode, &mode);
+
+ if (rv)
+ goto out;
+
vnet_vxlan_gbp_tunnel_add_del_args_t a = {
.is_add = mp->is_add,
.is_ip6 = (itype == IP46_TYPE_IP6),
@@ -95,7 +119,7 @@ static void vl_api_vxlan_gbp_tunnel_add_del_t_handler
.vni = ntohl (mp->tunnel.vni),
.dst = dst,
.src = src,
- .mode = VXLAN_GBP_TUNNEL_MODE_L2,
+ .mode = mode,
};
/* Check src & dst are different */