summaryrefslogtreecommitdiffstats
path: root/src/vnet/l2
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2021-02-08 23:48:30 -0800
committerDave Wallace <dwallacelf@gmail.com>2021-02-09 22:40:34 +0000
commit16f08657758db0f32b60cc88644b3a1c8fc28cbc (patch)
treec382af5be9c7a2598f7bc96efd92ee22698edf82 /src/vnet/l2
parent4b47ee26cba610b26bbfc088736846541bee7be3 (diff)
l2: crash on l2_input_is_xconnect
Running vpp without any interface configured and then invoking the binary-api l2_xconnect_dump causes vpp to crash in l2_input_is_xconnect due to l2input_main.configs has no memory allocated to it, not even for the local interface which exists all the times. The reason that l2input_main.configs has no memory allocated to it was due to gerrit patch 29232 which took out a line in l2input_init /* Create the config vector */ vec_validate (mp->configs, 100); The fix is to iterate through l2input_main.configs for each interface in l2 to call l2_input_is_xconnect when dumping l2_xconnect interfaces. Type: fix Fixes: gerrit 29232 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I8d9cba4b7eba4c2e0c60887c4fd57d5ec3b06d3b
Diffstat (limited to 'src/vnet/l2')
-rw-r--r--src/vnet/l2/l2_api.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index 85e9c31e2fb..70d6eeff424 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -103,10 +103,8 @@ static void
vl_api_l2_xconnect_dump_t_handler (vl_api_l2_xconnect_dump_t * mp)
{
vl_api_registration_t *reg;
- vnet_main_t *vnm = vnet_get_main ();
- vnet_interface_main_t *im = &vnm->interface_main;
l2input_main_t *l2im = &l2input_main;
- vnet_sw_interface_t *swif;
+ u32 sw_if_index;
l2_input_config_t *config;
reg = vl_api_client_index_to_registration (mp->client_index);
@@ -114,13 +112,13 @@ vl_api_l2_xconnect_dump_t_handler (vl_api_l2_xconnect_dump_t * mp)
return;
/* *INDENT-OFF* */
- pool_foreach (swif, im->sw_interfaces)
- {
- config = vec_elt_at_index (l2im->configs, swif->sw_if_index);
- if (l2_input_is_xconnect(config))
- send_l2_xconnect_details (reg, mp->context, swif->sw_if_index,
- config->output_sw_if_index);
- }
+ vec_foreach_index (sw_if_index, l2im->configs)
+ {
+ config = vec_elt_at_index (l2im->configs, sw_if_index);
+ if (l2_input_is_xconnect (config))
+ send_l2_xconnect_details (reg, mp->context, sw_if_index,
+ config->output_sw_if_index);
+ }
/* *INDENT-ON* */
}
id='n67' href='#n67'>67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
# Copyright (c) 2023 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.

# Idea of this file is motivated by OpenDylight,
# especially its Integration/Test sub-project.

# This file requires active virtualenv with tox package installed,
# or python-tox system package installed.

# Usage:
# cd to CSIT root (other directories might use different tox.ini)
#   $ tox
# will execute all default checkers.
#  $ tox -e pylint
# will execute only checkers (or fixers) defined in "pylint" tox environment.

[tox]
# Fast and brief checkers to front, slow or verbose checkers to back.
envlist = job_spec, copyright_year, gpl_license,
    new_line_length, line_length, autogen, pylint, doc_verify

# The following is needed as tox requires setup.py by default.
skipsdist = true
# Just a shorthand to avoid long lines.
script_dir = ./resources/libraries/bash/entry/tox

# TODO: Tox prints various warnings. Figure them out and fix them.

# Recommended ordering withinn testenv definition:
# + General comments.
# + ignore_outcome for non-voting checkers,
# + setenv (PYTHONPATH) for Python-using checkers and fixers.
# + Other Python stuff (e.g. basepython and deps for pylint).
# + whitelist_externals to enable bash.
# + Commands with a single bash to launch the corresponding script.

# Keep testenvs sorted alphabetically, please.

[testenv:autogen]
setenv = PYTHONPATH = {toxinidir}
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/autogen.sh

[testenv:copyright_year]
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/copyright_year.sh

[testenv:doc_verify]
# Fix all documentation error before enabling voting.
ignore_outcome = true
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/doc_verify.sh

[testenv:gpl_license]
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/gpl_license.sh

[testenv:line_length]
# Fix all transgressions and remove the ignore_outcome flag.
ignore_outcome = true
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/line.sh

[testenv:new_line_length]
# Adding .svg, big .rst tables, .yaml and similar still requires long lines.
# As current implementation is too dumb to filter those out,
# the checker has to remain non-voting.
ignore_outcome = true
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/new_line.sh

[testenv:pylint]
# Run pylint, but hide its return value until python warnings are cleared.
ignore_outcome = true
setenv = PYTHONPATH = {toxinidir}
basepython = python3
deps =
    pylint==2.4.3
    -r ./requirements.txt
whitelist_externals = /bin/bash
commands = bash {[tox]script_dir}/pylint.sh

# Keep testenvs sorted alphabetically, please.

# TODO: Add a checker against unresolved merge conflicts.
#       See: https://gerrit.fd.io/r/c/vpp/+/26956
# TODO: Create voting "pylint violations should not increase" checker.
# TODO: Create voting checker to reject suites with Force Tags of other suite.
# TODO: Create voting checker against tags not in tag_documentation.rst file.
# TODO: Create Robot suite Documentation checker (backslash if not next mark).
# TODO: Create .yaml specific checker, so people can override long line check.
# TODO: Create .rst specific checker, if there is one allowing
#       to override line check.
# TODO: You get the idea, replace line checker with something smarter
#       wherever possible.