21 #include <mss_clamp/mss_clamp.api_types.h> 30 if (dir4 == MSS_CLAMP_DIR_NONE && dir6 == MSS_CLAMP_DIR_NONE)
36 sw_if_index, enable, 0, 0);
39 sw_if_index, enable, 0, 0);
41 if ((dir6 & MSS_CLAMP_DIR_RX) != MSS_CLAMP_DIR_NONE)
43 sw_if_index, enable, 0, 0);
44 if ((dir6 & MSS_CLAMP_DIR_TX) != MSS_CLAMP_DIR_NONE)
46 sw_if_index, enable, 0, 0);
53 u8 *dir_enabled4, *dir_enabled6;
56 if (dir4 == MSS_CLAMP_DIR_NONE)
58 if (dir6 == MSS_CLAMP_DIR_NONE)
73 (*dir_enabled6) & ~dir6, 0);
76 ~(*dir_enabled6) & dir6, 1);
88 int rv = VNET_API_ERROR_FEATURE_DISABLED;
99 *mss4 = MSS_CLAMP_DIR_NONE;
112 *mss6 = MSS_CLAMP_DIR_NONE;
121 u8 *result = va_arg (*args,
u8 *);
125 dir = MSS_CLAMP_DIR_NONE;
126 else if (
unformat (input,
"enable"))
144 u8 dir4 = ~0, dir6 = ~0;
145 u32 mss4 = ~0, mss6 = ~0;
154 else if (
unformat (input,
"ip4-mss %d", &mss4))
156 else if (
unformat (input,
"ip6-mss %d", &mss6))
165 if (sw_if_index == ~0)
168 if (dir4 == (
u8) ~0 || dir6 == (
u8) ~0)
170 0,
"Please specify the MSS clamping direction for ip4 and ip6");
172 if (dir4 != MSS_CLAMP_DIR_NONE)
176 0,
"Please specify the Max Segment Size for ip4");
180 if (dir6 != MSS_CLAMP_DIR_NONE)
184 0,
"Please specify the Max Segment Size for ip6");
199 .path =
"set interface tcp-mss-clamp",
200 .short_help =
"set interface tcp-mss-clamp <interface-name> " 201 "ip4 [enable|disable|rx|tx] ip4-mss <size> " 202 "ip6 [enable|disable|rx|tx] ip6-mss <size>",
209 u8 dir = va_arg (*args,
u32);
210 u16 mss = va_arg (*args,
u32);
212 (((d) == (MSS_CLAMP_DIR_RX | MSS_CLAMP_DIR_TX)) ? \ 214 (((d) == MSS_CLAMP_DIR_RX) ? " [RX]" : " [TX]")) 216 if (MSS_CLAMP_DIR_NONE == dir)
218 return format (s,
"disabled");
241 if (sw_if_index == ~0)
247 if (MSS_CLAMP_DIR_NONE != dir4 || MSS_CLAMP_DIR_NONE != dir6)
272 .path =
"show interface tcp-mss-clamp",
273 .short_help =
"show interface tcp-mss-clamp [interface-name]",
274 .long_help =
"show TCP MSS clamping configurations",
#define vec_foreach_index(var, v)
Iterate over vector indices.
static void mssc_enable_disable_feat(u32 sw_if_index, u8 dir4, u8 dir6, int enable)
enumflag MSS_CLAMP_DIR_TX
vnet_feature_config_main_t * cm
static clib_error_t * mssc_init(vlib_main_t *vm)
unformat_function_t unformat_vnet_sw_interface
format_function_t format_vnet_sw_if_index_name
int mssc_enable_disable(u32 sw_if_index, u8 dir4, u8 dir6, u16 mss4, u16 mss6)
#define VLIB_INIT_FUNCTION(x)
description fragment has unexpected format
#define clib_error_return(e, args...)
vnet_main_t * vnet_get_main(void)
static uword unformat_mssc_dir(unformat_input_t *input, va_list *args)
static clib_error_t * mssc_enable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vl_api_interface_index_t sw_if_index
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static u8 * format_vnet_api_errno(u8 *s, va_list *args)
int mssc_get_mss(u32 sw_if_index, u8 *dir4, u8 *dir6, u16 *mss4, u16 *mss6)
#define VLIB_CLI_COMMAND(x,...)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static u8 * format_mssc_clamping(u8 *s, va_list *args)
static clib_error_t * mssc_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
enumflag MSS_CLAMP_DIR_RX
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)