aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip4_mtrie.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c
index adc95125ed3..e1987d56782 100644
--- a/src/vnet/ip/ip4_mtrie.c
+++ b/src/vnet/ip/ip4_mtrie.c
@@ -271,7 +271,7 @@ set_leaf (ip4_fib_mtrie_t * m,
old_ply = pool_elt_at_index (ip4_ply_pool, old_ply_index);
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
ASSERT (dst_address_byte_index < ARRAY_LEN (a->dst_address.as_u8));
/* how many bits of the destination address are in the next PLY */
@@ -284,7 +284,8 @@ set_leaf (ip4_fib_mtrie_t * m,
if (n_dst_bits_next_plies <= 0)
{
/* The mask length of the address to insert maps to this ply */
- uword i, n_dst_bits_this_ply, old_leaf_is_terminal;
+ uword i, old_leaf_is_terminal;
+ u32 n_dst_bits_this_ply;
/* The number of bits, and hence slots/buckets, we will fill */
n_dst_bits_this_ply = clib_min (8, -n_dst_bits_next_plies);
@@ -401,7 +402,7 @@ set_root_leaf (ip4_fib_mtrie_t * m,
old_ply = &m->root_ply;
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
/* how many bits of the destination address are in the next PLY */
n_dst_bits_next_plies = a->dst_address_length - BITS (u16);
@@ -412,7 +413,8 @@ set_root_leaf (ip4_fib_mtrie_t * m,
if (n_dst_bits_next_plies <= 0)
{
/* The mask length of the address to insert maps to this ply */
- uword i, n_dst_bits_this_ply, old_leaf_is_terminal;
+ uword i, old_leaf_is_terminal;
+ u32 n_dst_bits_this_ply;
/* The number of bits, and hence slots/buckets, we will fill */
n_dst_bits_this_ply = 16 - a->dst_address_length;
@@ -515,7 +517,7 @@ unset_leaf (ip4_fib_mtrie_t * m,
i32 i, n_dst_bits_this_ply, old_leaf_is_terminal;
u8 dst_byte;
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
ASSERT (dst_address_byte_index < ARRAY_LEN (a->dst_address.as_u8));
n_dst_bits_next_plies =
@@ -588,7 +590,7 @@ unset_root_leaf (ip4_fib_mtrie_t * m,
u16 dst_byte;
ip4_fib_mtrie_16_ply_t *old_ply;
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
old_ply = &m->root_ply;
n_dst_bits_next_plies = a->dst_address_length - BITS (u16);
} /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.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) 2016 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.

;;; cli-cmd-skel.el - cli command skeleton

(require 'skeleton)

(define-skeleton skel-cli-cmd
"Insert a CLI command "
nil
'(setq cmd-name (skeleton-read "Command Name: "))
'(setq path (skeleton-read "Path: "))

"
static clib_error_t *
" cmd-name "_command_fn (vlib_main_t * vm,
		 unformat_input_t * input,
		 vlib_cli_command_t * cmd)
{
    while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
	if (unformat (input, \"whatever %d\", &whatever))
	    ;
	else
	    return clib_error_return (0, \"unknown input `%U'\",
				      format_unformat_error, input);
    }
    return 0;
}

VLIB_CLI_COMMAND (" cmd-name "_command, static) = {
    .path = \"" path "\",
    .short_help = \"" path "\",
    .function = " cmd-name "_command_fn,
};
")