SRv6 dynamic proxy plugin

Change-Id: Ie460005510b8a70d00de31b6651e762cc3a63229
Signed-off-by: Francois Clad <fclad@cisco.com>
This commit is contained in:
Francois Clad
2018-01-17 12:18:41 +01:00
committed by Damjan Marion
parent b93078df66
commit b4d43d7901
8 changed files with 1011 additions and 0 deletions

View File

@ -159,6 +159,11 @@ M: Hongjun Ni <hongjun.ni@intel.com>
F: src/plugins/pppoe/
F: src/plugins/pppoe.am
Plugin - IPv6 Segment Routing Dynamic Proxy
M: Francois Clad <fclad@cisco.com>
F: src/plugins/srv6-ad/
F: src/plugins/srv6_ad.am
Plugin - IPv6 Segment Routing Masquerading Proxy
M: Francois Clad <fclad@cisco.com>
F: src/plugins/srv6-am/

View File

@ -221,6 +221,7 @@ PLUGIN_ENABLED(marvell)
PLUGIN_ENABLED(memif)
PLUGIN_ENABLED(pppoe)
PLUGIN_ENABLED(sixrd)
PLUGIN_ENABLED(srv6ad)
PLUGIN_ENABLED(srv6am)
PLUGIN_ENABLED(srv6as)
PLUGIN_ENABLED(nat)

View File

@ -83,6 +83,10 @@ if ENABLE_SIXRD_PLUGIN
include sixrd.am
endif
if ENABLE_SRV6AD_PLUGIN
include srv6_ad.am
endif
if ENABLE_SRV6AM_PLUGIN
include srv6_am.am
endif

358
src/plugins/srv6-ad/ad.c Normal file

File diff suppressed because it is too large Load Diff

77
src/plugins/srv6-ad/ad.h Normal file
View File

@ -0,0 +1,77 @@
/*
* Copyright (c) 2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __included_srv6_ad_h__
#define __included_srv6_ad_h__
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/srv6/sr.h>
#include <vnet/srv6/sr_packet.h>
#include <vppinfra/error.h>
#include <vppinfra/elog.h>
#define DA_IP4 4
#define DA_IP6 6
typedef struct
{
u16 msg_id_base; /**< API message ID base */
vlib_main_t *vlib_main; /**< [convenience] vlib main */
vnet_main_t *vnet_main; /**< [convenience] vnet main */
dpo_type_t srv6_ad_dpo_type; /**< DPO type */
u32 srv6_localsid_behavior_id; /**< SRv6 LocalSID behavior number */
u32 *sw_iface_localsid4; /**< Retrieve local SID from iface */
u32 *sw_iface_localsid6; /**< Retrieve local SID from iface */
} srv6_ad_main_t;
/*
* This is the memory that will be stored per each localsid
* the user instantiates
*/
typedef struct
{
ip46_address_t nh_addr; /**< Proxied device address */
u32 sw_if_index_out; /**< Outgoing iface to proxied dev. */
u32 nh_adj; /**< Adjacency index for out. iface */
u8 ip_version;
u32 sw_if_index_in; /**< Incoming iface from proxied dev. */
u8 *rewrite; /**< Headers to be rewritten */
} srv6_ad_localsid_t;
srv6_ad_main_t srv6_ad_main;
format_function_t format_srv6_ad_localsid;
unformat_function_t unformat_srv6_ad_localsid;
void srv6_ad_dpo_lock (dpo_id_t * dpo);
void srv6_ad_dpo_unlock (dpo_id_t * dpo);
extern vlib_node_registration_t srv6_ad_localsid_node;
#endif /* __included_srv6_ad_h__ */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

View File

@ -0,0 +1,23 @@
# SRv6 endpoint to SR-unaware appliance via dynamic proxy (End.AD) {#srv6_ad_plugin_doc}
## Overview
The "Endpoint to SR-unaware appliance via dynamic proxy" (End.AD) is a two-parts
proxy function for processing SRv6 encapsulated traffic on behalf of an
SR-unaware appliance. The first part decapsulates the incoming traffic and sends
it towards an appliance on a specific interface, while the second
re-encapsulates the traffic coming back from the appliance.
In this scenario, there are no restrictions on the operations that can be
performed by the appliance on the stream of packets. It may operate at all
protocol layers, terminate transport layer connections, generate new packets and
initiate transport layer connections. This function may also be used to
integrate an IPv4-only appliance into an SRv6 policy.
The End.AD function relies on a local caching mechanism to learn and
re-encapsulate the traffic with the same headers that were removed.
This cache is used to store the IPv6 header and its
extension headers while the appliance processes the inner packet. In the
following, we refer to an entry in this cache as C(type,iface), where type is
either IPv4 or IPv6 and iface is the receiving interface on the SRv6 proxy
(IFACE-IN).

521
src/plugins/srv6-ad/node.c Normal file

File diff suppressed because it is too large Load Diff

22
src/plugins/srv6_ad.am Normal file
View File

@ -0,0 +1,22 @@
# Copyright (c) 2016 Cisco Systems, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
vppplugins_LTLIBRARIES += srv6ad_plugin.la
srv6ad_plugin_la_SOURCES = \
srv6-ad/ad.c \
srv6-ad/node.c
noinst_HEADERS += srv6-ad/ad.h
# vi:syntax=automake