aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ipip/ipip_cli.c
AgeCommit message (Expand)AuthorFilesLines
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-2/+2
2020-12-08tunnel: add cli support for encap_decap flagsMohammed Hawari1-2/+7
2020-12-08ipip: correct ipip_cli.c indentationMohammed Hawari1-212/+277
2020-11-19ipip: Don't crash when showing non-existant tunnel indexNeale Ranns1-0/+2
2020-09-22ipip: Add option to tunnel create help stringNeale Ranns1-1/+1
2020-01-27ipip: Multi-point interfaceNeale Ranns1-1/+56
2020-01-27tunnel: Common types for IP tunnelsNeale Ranns1-2/+2
2019-12-03ipip: Tunnel flags controlling copying data to/from payload/encapNeale Ranns1-7/+11
2019-10-15ipip: fix typos in short_helpIgnas Bacius1-3/+3
2019-04-196rd: fix debug cli short-helpBenoƮt Ganne1-1/+2
2018-08-22IPIP and SIXRD tunnels create API needs table-IDs not fib-indexesNeale Ranns1-22/+59
2018-05-25VPP-1277: IPIP - Copy TOS/TC from inner packet to outer.Ole Troan1-0/+1
2018-03-14IPIP: Add IP{v4,v6} over IP{v4,v6} configured tunnel support.Ole Troan1-0/+318
Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2020 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 __CNAT_SRC_POLICY_H__
#define __CNAT_SRC_POLICY_H__

// #include <vnet/udp/udp.h>
#include <cnat/cnat_types.h>
#include <cnat/cnat_session.h>
#include <cnat/cnat_translation.h>

typedef enum
{
  CNAT_SPORT_PROTO_TCP,
  CNAT_SPORT_PROTO_UDP,
  CNAT_SPORT_PROTO_ICMP,
  CNAT_SPORT_PROTO_ICMP6,
  CNAT_N_SPORT_PROTO
} cnat_sport_proto_t;

typedef enum cnat_source_policy_errors_
{
  CNAT_SOURCE_ERROR_EXHAUSTED_PORTS = 1,
  CNAT_SOURCE_ERROR_USE_DEFAULT = 2,
} cnat_source_policy_errors_t;

typedef struct cnat_src_port_allocator_
{
  /* Source ports bitmap for snat */
  clib_bitmap_t *bmap;

  /* Lock for src_ports access */
  clib_spinlock_t lock;
} cnat_src_port_allocator_t;

/* function to use to compute source (IP, port) for a new session to a vip */
typedef cnat_source_policy_errors_t (*cnat_vip_source_policy_t)
  (vlib_main_t * vm, vlib_buffer_t * b, cnat_session_t * session,
   u32 * rsession_flags, const cnat_translation_t * ct,
   cnat_node_ctx_t * ctx);

typedef struct cnat_src_policy_main_
{
  cnat_vip_source_policy_t vip_policy;
  cnat_vip_source_policy_t default_policy;

  /* Per proto source ports allocator for snat */
  cnat_src_port_allocator_t *src_ports;
} cnat_src_policy_main_t;

extern cnat_src_policy_main_t cnat_src_policy_main;

void cnat_register_vip_src_policy (cnat_vip_source_policy_t fp);
int cnat_allocate_port (u16 * port, ip_protocol_t iproto);
void cnat_free_port (u16 port, ip_protocol_t iproto);

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */

#endif