37 s =
format(s,
":%u,", t->sport);
49 s =
format(s,
":%u", t->dport);
63 s =
format(s,
":%u,", t->sport);
71 s =
format(s,
":%u", t->dport);
75 s =
format(s,
" copy byte@[%d->%d]", t->from_offset, t->to_offset);
77 s =
format(s,
" clear byte@[%d]", t->clear_offset);
125 else if (
unformat(input,
"sport %d", &sport)) {
126 if (sport == 0 || sport > 65535)
130 }
else if (
unformat(input,
"dport %d", &dport)) {
131 if (dport == 0 || dport > 65535)
153 else if (
unformat(input,
"sport %d", &sport)) {
154 if (sport == 0 || sport > 65535)
158 }
else if (
unformat(input,
"dport %d", &dport)) {
159 if (dport == 0 || dport > 65535)
163 }
else if (
unformat(input,
"copy-byte-at-offset %d %d", &from_offset,
165 if (from_offset == to_offset || to_offset > 255 ||
171 }
else if (
unformat(input,
"clear-byte-at-offset %d", &clear_offset)) {
172 if (clear_offset > 255)
187 bool in =
false, out =
false;
188 bool match_set =
false, rewrite_set =
false;
204 else if (
unformat(line_input,
"interface %U",
208 else if (
unformat(line_input,
"in")) {
210 }
else if (
unformat(line_input,
"out")) {
212 }
else if (
unformat(line_input,
"del")) {
220 if (sw_if_index == ~0) {
225 if ((in && out) || (!in && !out)) {
241 if ((match.dport || match.sport) &&
242 (match.proto != 17 && match.proto != 6)) {
260 0,
"Attaching binding to interface failed %d", rv);
267 if (binding_index == ~0) {
294 .path =
"set pnat translation",
295 .short_help =
"set pnat translation interface <name> match <5-tuple> " 296 "rewrite <tuple> {in|out} [del]",
316 .path =
"show pnat translations",
317 .short_help =
"show pnat translations",
336 .path =
"show pnat interfaces",
337 .short_help =
"show pnat interfaces",
u32 pnat_flow_lookup(u32 sw_if_index, pnat_attachment_point_t attachment, pnat_match_tuple_t *match)
u8 * format_pnat_match_tuple(u8 *s, va_list *args)
static clib_error_t * show_pnat_interfaces_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach(VAR, POOL)
Iterate through pool.
pnat_rewrite_tuple_t rewrite
Fixed length block allocator.
static u8 * format_pnat_interface(u8 *s, va_list *args)
uword unformat_pnat_rewrite_tuple(unformat_input_t *input, va_list *args)
unformat_function_t unformat_vnet_sw_interface
static u8 * format_pnat_mask(u8 *s, va_list *args)
int pnat_binding_detach(u32 sw_if_index, pnat_attachment_point_t attachment, u32 binding_index)
description fragment has unexpected format
#define clib_error_return(e, args...)
vnet_main_t * vnet_get_main(void)
vl_api_pnat_attachment_point_t pnat_attachment_point_t
vl_api_pnat_mask_t pnat_mask_t
static clib_error_t * set_pnat_translation_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
pnat_translation_t * translations
vl_api_interface_index_t sw_if_index
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static clib_error_t * show_pnat_translations_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vl_api_pnat_rewrite_tuple_t pnat_rewrite_tuple_t
uword unformat_pnat_match_tuple(unformat_input_t *input, va_list *args)
#define VLIB_CLI_COMMAND(x,...)
vl_api_pnat_match_tuple_t pnat_match_tuple_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
int pnat_binding_del(u32 index)
int pnat_binding_add(pnat_match_tuple_t *match, pnat_rewrite_tuple_t *rewrite, u32 *index)
u8 * format_pnat_translation(u8 *s, va_list *args)
pnat_interface_t * interfaces
u8 * format_pnat_rewrite_tuple(u8 *s, va_list *args)
int pnat_binding_attach(u32 sw_if_index, pnat_attachment_point_t attachment, u32 binding_index)