From 08e0312fe2ecb10e10acf334c71440df7be95cac Mon Sep 17 00:00:00 2001 From: Pierre Pfister Date: Fri, 15 Jul 2016 09:19:39 +0100 Subject: L2TP: Add option for custom fib id for outgoing encapsulated packets If a custom fib ID is used (different from ~0), the associated fib is used to forward outgoing encapsulated packets. Otherwise, the fib used is the same as for any packet received on the original RX interface (L2TP does not modify RX interface index). Change-Id: I4533d5f7fa432c78c937d3acdd802d0d1c92a0c7 Signed-off-by: Pierre Pfister --- vpp/vpp-api/api.c | 15 +++++++++++++++ vpp/vpp-api/vpe.api | 2 ++ 2 files changed, 17 insertions(+) (limited to 'vpp/vpp-api') diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index f6b1b739..6a5a152e 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -4329,6 +4329,20 @@ static void vl_api_l2tpv3_create_tunnel_t_handler goto out; } + u32 encap_fib_index; + + if (mp->encap_vrf_id != ~0) { + uword *p; + ip6_main_t *im = &ip6_main; + if (!(p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id)))) { + rv = VNET_API_ERROR_NO_SUCH_FIB; + goto out; + } + encap_fib_index = p[0]; + } else { + encap_fib_index = ~0; + } + rv = create_l2tpv3_ipv6_tunnel (lm, (ip6_address_t *) mp->client_address, (ip6_address_t *) mp->our_address, @@ -4337,6 +4351,7 @@ static void vl_api_l2tpv3_create_tunnel_t_handler clib_net_to_host_u64(mp->local_cookie), clib_net_to_host_u64(mp->remote_cookie), mp->l2_sublayer_present, + encap_fib_index, &sw_if_index); out: diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api index 25e6ebaa..841f3088 100644 --- a/vpp/vpp-api/vpe.api +++ b/vpp/vpp-api/vpe.api @@ -1694,6 +1694,7 @@ define dhcp_proxy_config_2_reply { @param remote_session_id - remote tunnel session id @param local_cookie - local tunnel cookie @param l2_sublayer_present - l2 sublayer is present in packets if non-zero + @param encap_vrf_id - fib identifier used for outgoing encapsulated packets */ define l2tpv3_create_tunnel { u32 client_index; @@ -1706,6 +1707,7 @@ define l2tpv3_create_tunnel { u64 local_cookie; u64 remote_cookie; u8 l2_sublayer_present; + u32 encap_vrf_id; }; /** \brief l2tpv3 tunnel interface create response -- cgit 1.2.3-korg