diff options
author | Maxime Peim <mpeim@cisco.com> | 2024-03-11 10:35:16 +0100 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2024-05-28 11:56:46 +0000 |
commit | 0720d65c7b0cf7106742ce02a0512bf647d5e517 (patch) | |
tree | c957bef8c00558424240fbea51893de41361220a /src/plugins/urpf/urpf.c | |
parent | 7624083c27125d1d0abd11738f7dceb2990969ed (diff) |
urpf: export to use it externally
Type: improvement
Change-Id: Ia70f16c92dfc153256db6dcdf23f5487d5a7b678
Signed-off-by: Maxime Peim <mpeim@cisco.com>
Diffstat (limited to 'src/plugins/urpf/urpf.c')
-rw-r--r-- | src/plugins/urpf/urpf.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/plugins/urpf/urpf.c b/src/plugins/urpf/urpf.c index e5209caafb4..1e7d6c0fb91 100644 --- a/src/plugins/urpf/urpf.c +++ b/src/plugins/urpf/urpf.c @@ -60,7 +60,17 @@ static const char *urpf_feats[N_AF][VLIB_N_DIR][URPF_N_MODES] = urpf_data_t *urpf_cfgs[N_AF][VLIB_N_DIR]; u8 * -format_urpf_mode (u8 * s, va_list * a) +format_urpf_trace (u8 *s, va_list *va) +{ + CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *); + CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *); + urpf_trace_t *t = va_arg (*va, urpf_trace_t *); + + return format (s, "uRPF:%d fib:%d", t->urpf, t->fib_index); +} + +__clib_export u8 * +format_urpf_mode (u8 *s, va_list *a) { urpf_mode_t mode = va_arg (*a, int); @@ -76,8 +86,8 @@ format_urpf_mode (u8 * s, va_list * a) return (format (s, "unknown")); } -static uword -unformat_urpf_mode (unformat_input_t * input, va_list * args) +__clib_export uword +unformat_urpf_mode (unformat_input_t *input, va_list *args) { urpf_mode_t *mode = va_arg (*args, urpf_mode_t *); @@ -94,7 +104,16 @@ unformat_urpf_mode (unformat_input_t * input, va_list * args) return 0; } -int +__clib_export int +urpf_feature_enable_disable (ip_address_family_t af, vlib_dir_t dir, + urpf_mode_t mode, u32 sw_if_index, int enable) +{ + return vnet_feature_enable_disable (urpf_feat_arcs[af][dir], + urpf_feats[af][dir][mode], sw_if_index, + enable, 0, 0); +} + +__clib_export int urpf_update (urpf_mode_t mode, u32 sw_if_index, ip_address_family_t af, vlib_dir_t dir, u32 table_id) { |