summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipip
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2023-07-14 16:05:39 +0000
committerMatthew Smith <mgsmith@netgate.com>2023-07-14 17:42:26 +0000
commite870d5b6ac3171355aa61e576a178734f97fafda (patch)
treecf48069f7af94dec8aca0c82ed58b8ab6709e4aa /src/vnet/ipip
parent54641342887558b2b92813c6ccd9d93797b9f5a1 (diff)
ipip: populate mode in tunnel details
Type: improvement There is a mode field in ipip_tunnel_details. The handler for the dump API does not do anything to populate it so it always contains 0 (TUNNEL_API_MODE_P2P). This is correct for p2p tunnels but is wrong for multipoint tunnels. Populate the field with the correct mode. Signed-off-by: Matthew Smith <mgsmith@netgate.com> Change-Id: I6c1288a0d3929db0f67100748b5760c36b594f97
Diffstat (limited to 'src/vnet/ipip')
-rw-r--r--src/vnet/ipip/ipip_api.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/vnet/ipip/ipip_api.c b/src/vnet/ipip/ipip_api.c
index 50b6731af44..59ff2827fa1 100644
--- a/src/vnet/ipip/ipip_api.c
+++ b/src/vnet/ipip/ipip_api.c
@@ -105,6 +105,22 @@ vl_api_ipip_del_tunnel_t_handler (vl_api_ipip_del_tunnel_t * mp)
REPLY_MACRO (VL_API_IPIP_DEL_TUNNEL_REPLY);
}
+static vl_api_tunnel_mode_t
+ipip_tunnel_mode_encode (ipip_mode_t mode)
+{
+ switch (mode)
+ {
+ case IPIP_MODE_P2P:
+ return TUNNEL_API_MODE_P2P;
+ case IPIP_MODE_P2MP:
+ return TUNNEL_API_MODE_MP;
+ case IPIP_MODE_6RD:
+ return TUNNEL_API_MODE_P2P;
+ default:
+ return TUNNEL_API_MODE_P2P;
+ }
+}
+
static void
send_ipip_tunnel_details (ipip_tunnel_t * t, vl_api_ipip_tunnel_dump_t * mp)
{
@@ -113,8 +129,8 @@ send_ipip_tunnel_details (ipip_tunnel_t * t, vl_api_ipip_tunnel_dump_t * mp)
bool is_ipv6 = t->transport == IPIP_TRANSPORT_IP6 ? true : false;
fib_table_t *ft;
- ft = fib_table_get (t->fib_index, (is_ipv6 ? FIB_PROTOCOL_IP6 :
- FIB_PROTOCOL_IP4));
+ ft = fib_table_get (t->fib_index,
+ (is_ipv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4));
/* *INDENT-OFF* */
REPLY_MACRO_DETAILS2(VL_API_IPIP_TUNNEL_DETAILS,
@@ -126,6 +142,7 @@ send_ipip_tunnel_details (ipip_tunnel_t * t, vl_api_ipip_tunnel_dump_t * mp)
rmp->tunnel.sw_if_index = htonl (t->sw_if_index);
rmp->tunnel.dscp = ip_dscp_encode(t->dscp);
rmp->tunnel.flags = tunnel_encap_decap_flags_encode(t->flags);
+ rmp->tunnel.mode = ipip_tunnel_mode_encode (t->mode);
}));
/* *INDENT-ON* */
}