2 * Copyright (c) 2018 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/ipsec/ipsec.h>
17 #include <vnet/ipsec/ipsec_sa.h>
20 test_ipsec_command_fn (vlib_main_t * vm,
21 unformat_input_t * input, vlib_cli_command_t * cmd)
29 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
31 if (unformat (input, "sa %d", &sa_id))
33 else if (unformat (input, "seq 0x%llx", &seq_num))
41 ipsec_main_t *im = &ipsec_main;
45 sa_index = ipsec_sa_find_and_lock (sa_id);
46 sa = pool_elt_at_index (im->sad, sa_index);
48 sa->seq = seq_num & 0xffffffff;
49 sa->seq_hi = seq_num >> 32;
51 ipsec_sa_unlock (sa_index);
55 return clib_error_return (0, "unknown SA `%U'",
56 format_unformat_error, input);
63 VLIB_CLI_COMMAND (test_ipsec_command, static) =
66 .short_help = "test ipsec sa <ID> seq-num <VALUE>",
67 .function = test_ipsec_command_fn,
72 * fd.io coding-style-patch-verification: ON
75 * eval: (c-set-style "gnu")