aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/srv6-as/node.c
AgeCommit message (Expand)AuthorFilesLines
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-18/+20
2018-07-13srv6-as: Adding support for L2 trafficFrancois Clad1-8/+155
2018-07-11srv6-as: Adding rewrite countersFrancois Clad1-5/+22
2018-02-01srv6-as: fixing coverity issuesFrancois Clad1-8/+32
2018-01-19SRv6 static proxy pluginFrancois Clad1-0/+492
'>128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
/*
 * Copyright (c) 2016 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.
 */

option version = "4.2.1";

import "vnet/ip/ip_types.api";
import "vnet/interface_types.api";

/** \brief Add MAP domains
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param ip6_prefix - Rule IPv6 prefix
    @param ip4_prefix - Rule IPv4 prefix
    @param ip6_src - MAP domain IPv6 BR address / Tunnel source
    @param ea_bits_len - Embedded Address bits length
    @param psid_offset - Port Set Identifier (PSID) offset
    @param psid_length - PSID length
    @param mtu - MTU. default 1280
    @param tag - A user field stored with the MAP
*/
autoendian define map_add_domain
{
  u32 client_index;
  u32 context;
  vl_api_ip6_prefix_t ip6_prefix;
  vl_api_ip4_prefix_t ip4_prefix;
  vl_api_ip6_prefix_t ip6_src;
  u8 ea_bits_len;
  u8 psid_offset;
  u8 psid_length;
  u16 mtu [default=1280];
  string tag[64];
};

/** \brief Reply for MAP domain add
    @param context - returned sender context, to match reply w/ request
    @param index - MAP domain index
    @param retval - return code
*/
define map_add_domain_reply
{
  u32 context;
  u32 index;
  i32 retval;
};

/** \brief Delete MAP domain
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param index - MAP Domain index
*/
autoreply define map_del_domain
{
  u32 client_index;
  u32 context;
  u32 index;
};


/** \brief Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param index - MAP Domain index
    @param is_add - If 1 add rule, if 0 delete rule
    @param ip6_dst - MAP CE IPv6 address
    @param psid - Rule PSID
*/
autoreply define map_add_del_rule
{
  u32 client_index;
  u32 context;
  u32 index;
  bool is_add;
  vl_api_ip6_address_t ip6_dst;
  u16 psid;
};


/** \brief Get list of map domains
    @param client_index - opaque cookie to identify the sender
*/
service {
  rpc map_domains_get returns map_domains_get_reply
    stream map_domain_details;
};

define map_domains_get
{
  u32 client_index;
  u32 context;
  u32 cursor;
};

define map_domains_get_reply
{
  u32 context;
  i32 retval;
  u32 cursor;
};

define map_domain_dump
{
  option deprecated;
  u32 client_index;
  u32 context;
};

/** \brief Details about a single MAP domain
    @param context - returned sender context, to match reply w/ request
    @param domain_index - MAP domain index
    @param ip6_prefix - Rule IPv6 prefix
    @param ip4_prefix - Rule IPv4 prefix
    @param ip6_src - MAP domain IPv6 BR address / Tunnel source
    @param ea_bits_len - Embedded Address bits length
    @param psid_offset - Port Set Identifier (PSID) offset
    @param psid_length - PSID length
    @param flags -
    @param mtu - MTU
    @param tag - The user field stored with the MAP at creation time
*/
define map_domain_details
{
  u32 context;
  u32 domain_index;
  vl_api_ip6_prefix_t ip6_prefix;
  vl_api_ip4_prefix_t ip4_prefix;
  vl_api_ip6_prefix_t ip6_src;
  u8 ea_bits_len;
  u8 psid_offset;
  u8 psid_length;
  u8 flags;
  u16 mtu;
  string tag[64];
};

define map_rule_dump
{
  u32 client_index;
  u32 context;
  u32 domain_index;
};

define map_rule_details
{
  u32 context;
  vl_api_ip6_address_t ip6_dst;
  u16 psid;
};

/** \brief Enable or disable a MAP interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index -
    @param is_enable - 0=disable, 1=enable interface
    @param is_translation -  0=encapsulation, 1=translation
*/
autoreply define map_if_enable_disable
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  bool is_enable;
  bool is_translation; /* 0 - encapsulation, 1 - translation */
};

/** \brief Request for a single block of summary stats
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define map_summary_stats
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for map_summary_stats request
    @param context - sender context, to match reply w/ request
    @param retval - return code for request
    @param total_bindings -
    @param total_pkts -
    @param total_ip4_fragments -
    @param total_security_check -
*/
define map_summary_stats_reply
{
  u32 context;
  i32 retval;
  u64 total_bindings;
  u64 total_pkts[2];
  u64 total_bytes[2];
  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 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 tc_class instead
    @param tc_class - class field value when copy == 0
*/
autoreply define map_param_set_traffic_class
{
  u32 client_index;
  u32 context;
  bool copy;
  u8 tc_class;
};


/** \brief Set MAP TCP parameters
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @parma tcp_mss - TCP MSS clamping value
*/
autoreply define map_param_set_tcp
{
  u32 client_index;
  u32 context;
  u16 tcp_mss;
};


/** \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 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;
  bool sec_check_enable;
  bool sec_check_fragments;
  bool tc_copy;
  u8 tc_class;
};

/*
 * MAP Error counters/messages
 */
counters map {
  none {
    severity info;
    type counter64;
    units "packets";
    description "valid MAP packets";
  };
  bad_protocol {
    severity error;
    type counter64;
    units "packets";
    description "bad protocol";
  };
  sec_check {
    severity error;
    type counter64;
    units "packets";
    description "security check failed";
  };
  encap_sec_check {
    severity error;
    type counter64;
    units "packets";
    description "encap security check failed";
  };
  decap_sec_check {
    severity error;
    type counter64;
    units "packets";
    description "decap security check failed";
  };
  icmp {
    severity error;
    type counter64;
    units "packets";
    description "unable to translate ICMP";
  };
  icmp_relay {
    severity error;
    type counter64;
    units "packets";
    description "unable to relay ICMP";
  };
  unknown {
    severity error;
    type counter64;
    units "packets";
    description "unknown";
  };
  no_binding {
    severity error;
    type counter64;
    units "packets";
    description "no binding";
  };
  no_domain {
    severity error;
    type counter64;
    units "packets";
    description "no domain";
  };
  fragmented {
    severity error;
    type counter64;
    units "packets";
    description "packet is a fragment";
  };
  fragment_memory {
    severity error;
    type counter64;
    units "packets";
    description "could not cache fragment";
  };
  fragment_malformed {
    severity error;
    type counter64;
    units "packets";
    description "fragment has unexpected format";
  };
  fragment_dropped {
    severity error;
    type counter64;
    units "packets";
    description "dropped cached fragment";
  };
  malformed {
    severity error;
    type counter64;
    units "packets";
    description "malformed packet";
  };
  df_set {
    severity error;
    type counter64;
    units "packets";
    description "can't fragment, DF set";
  };
  time_exceeded {
    severity error;
    type counter64;
    units "packets";
    description "time exceeded";
  };
};
paths {
  "/err/ip4-map" "map";
  "/err/ip6-map" "map";
  "/err/ip4-t-map" "map";
  "/err/ip6-t-map" "map";
};