MAP: Add API support for setting parameters.

Change-Id: Ic67073e1f2ebe54bee5cb96a951eb92a28b1de06
Signed-off-by: Jon Loeliger <jdl@netgate.com>
This commit is contained in:
Jon Loeliger
2018-12-06 11:49:17 -06:00
committed by Ole Trøan
parent 193c47d900
commit 5a2e278a09
4 changed files with 650 additions and 214 deletions
+168 -1
View File
@@ -13,7 +13,7 @@
* limitations under the License.
*/
option version = "2.2.0";
option version = "2.3.0";
import "vnet/ip/ip_types.api";
@@ -153,3 +153,170 @@ define map_summary_stats_reply
u64 total_ip4_fragments;
u64 total_security_check[2];
};
/** \brief Set MAP fragmentation parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param inner - 1=frag inner packet, 0=frag tunnel packets
@param ignore_df - 1=IP4 fragment despite DF bit, 0=honor DF
*/
autoreply define map_param_set_fragmentation
{
u32 client_index;
u32 context;
bool inner;
bool ignore_df;
};
/** \brief Set MAP ICMP parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param icmp4_err_relay_src - IPv4 ICMP err relay src address
*/
autoreply define map_param_set_icmp
{
u32 client_index;
u32 context;
vl_api_ip4_address_t ip4_err_relay_src;
};
/** \brief Set MAP ICMP6 parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param enable_unreachable - 1 = send ICMP unreachable err msgs
*/
autoreply define map_param_set_icmp6
{
u32 client_index;
u32 context;
bool enable_unreachable;
};
/** \brief Add/delete MAP pre-resolve IP addresses parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param is_add - 1 = Add non-zero IP addresses, 0 = delete
@param ip4_nh_address - direct IP4 next-hop address
@param ip6_nh_address - direct IP6 next-hop address
*/
autoreply define map_param_add_del_pre_resolve
{
u32 client_index;
u32 context;
bool is_add;
vl_api_ip4_address_t ip4_nh_address;
vl_api_ip6_address_t ip6_nh_address;
};
/** \brief Set MAP reassembly parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param is_ip6 - 1 = params apply to IPv6, 0 = params apply to IPv4
@param lifetime_ms - reassembly valid lifetime, or ~0
@param pool_size - max number of reassemblies, or ~0
@param buffers - max number of reassembly buffers, or ~0
@param ht_ratio - hash-table size factor, or ~0
*/
autoreply define map_param_set_reassembly
{
u32 client_index;
u32 context;
bool is_ip6;
u16 lifetime_ms;
u16 pool_size;
u32 buffers;
f64 ht_ratio;
};
/** \brief Set MAP security-check parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param enable - 1=enable security check on first inbound packet
@param fragments - 1=enable check on (subsequent) fragments too
*/
autoreply define map_param_set_security_check
{
u32 client_index;
u32 context;
bool enable;
bool fragments;
};
/** \brief Set MAP traffic class parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param copy - 1 = copy packet class/TOS field, 0 = use class instead
@param class - class field value when copy == 0
*/
autoreply define map_param_set_traffic_class
{
u32 client_index;
u32 context;
bool copy;
u8 class;
};
/** \brief Request for a single block of MAP parameters
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
*/
define map_param_get
{
u32 client_index;
u32 context;
};
/** \brief Reply for map_param_get request
@param context - sender context, to match reply w/ request
@param retval - return code for request
@param inner - 1=frag inner packet, 0=frag tunnel packets, ~0=untouched
@param ignore_df - 1=IP4 fragm despite DF bit, 0=honor DF, ~0=untouched
@param icmp_ip4_err_relay_src - IPv4 ICMP err relay src address
@param icmp6_enable_unreachable - 1 = send ICMP unreachable err msgs
@param ip4_nh_address - direct IP4 next-hop address
@param ip6_nh_address - direct IP6 next-hop address
@param ip4_lifetime_ms - reassembly valid lifetime, or ~0
@param ip4_pool_size - max number of reassemblies, or ~0
@param ip4_buffers - max number of reassembly buffers, or ~0
@param ip4_ht_ratio - reassembly valid lifetime, or ~0
@param ip6_lifetime_ms - max number of reassemblies, or ~0
@param ip6_pool_size - max number of reassemblies, or ~0
@param ip6_buffers - max number of reassembly buffers, or ~0
@param ip6_ht_ratio - hash-table size factor, or ~0
@param sec_check_enable - 1=enable security check on first inbound packet
@param sec_check_fragments - 1=enable check on (subsequent) fragments too
@param tc_copy - 1 = copy packet class/TOS field, 0 = use class instead
@param tc_class - class field value when copy == 0
*/
define map_param_get_reply
{
u32 context;
i32 retval;
u8 frag_inner;
u8 frag_ignore_df;
vl_api_ip4_address_t icmp_ip4_err_relay_src;
bool icmp6_enable_unreachable;
vl_api_ip4_address_t ip4_nh_address;
vl_api_ip6_address_t ip6_nh_address;
u16 ip4_lifetime_ms;
u16 ip4_pool_size;
u32 ip4_buffers;
f64 ip4_ht_ratio;
u16 ip6_lifetime_ms;
u16 ip6_pool_size;
u32 ip6_buffers;
f64 ip6_ht_ratio;
bool sec_check_enable;
bool sec_check_fragments;
bool tc_copy;
u8 tc_class;
};
+126 -212
View File
File diff suppressed because it is too large Load Diff
+18
View File
@@ -25,6 +25,13 @@
#define MAP_SKIP_IP6_LOOKUP 1
#define MAP_ERR_GOOD 0
#define MAP_ERR_BAD_POOL_SIZE -1
#define MAP_ERR_BAD_HT_RATIO -2
#define MAP_ERR_BAD_LIFETIME -3
#define MAP_ERR_BAD_BUFFERS -4
#define MAP_ERR_BAD_BUFFERS_TOO_LARGE -5
int map_create_domain (ip4_address_t * ip4_prefix, u8 ip4_prefix_len,
ip6_address_t * ip6_prefix, u8 ip6_prefix_len,
ip6_address_t * ip6_src, u8 ip6_src_len,
@@ -35,6 +42,17 @@ int map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep,
u8 is_add);
u8 *format_map_trace (u8 * s, va_list * args);
int map_param_set_fragmentation (bool inner, bool ignore_df);
int map_param_set_icmp (ip4_address_t * ip4_err_relay_src);
int map_param_set_icmp6 (u8 enable_unreachable);
void map_pre_resolve (ip4_address_t * ip4, ip6_address_t * ip6, int is_del);
int map_param_set_reassembly (bool is_ipv6, u16 lifetime_ms,
u16 pool_size, u32 buffers, f64 ht_ratio,
u32 * reass, u32 * packets);
int map_param_set_security_check (bool enable, bool fragments);
int map_param_set_traffic_class (bool copy, u8 tc);
typedef enum
{
MAP_DOMAIN_PREFIX = 1 << 0,
File diff suppressed because it is too large Load Diff