summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2024-06-05 11:27:15 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-06-05 13:11:22 +0200
commitae54c9e455ec7a4fb5289a6c3a28626227e83e68 (patch)
treee12d62d54aa764f4f3186f1e4ed7f8992dc17ef1 /bgpd
parentbgpd: add bgp_path_info_num_labels() (diff)
downloadfrr-ae54c9e455ec7a4fb5289a6c3a28626227e83e68.tar.xz
frr-ae54c9e455ec7a4fb5289a6c3a28626227e83e68.zip
bgpd: fix too leading tabs in vnc_import_bgp
Small rework to fix the following checkpatch warning: > < WARNING: Too many leading tabs - consider code refactoring > < #2142: FILE: /tmp/f1-1616988/vnc_import_bgp.c:2142: Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c129
1 files changed, 73 insertions, 56 deletions
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index fbc025612..255e87b09 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -414,7 +414,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
uint32_t lifetime;
uint32_t *plifetime;
struct bgp_attr_encap_subtlv *encaptlvs;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
struct rfapi_un_option optary[3];
struct rfapi_un_option *opt = NULL;
@@ -472,6 +472,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
if (bgp_path_info_num_labels(bpi))
label = decode_label(&bpi->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
add_vnc_route(&vncHDResolveNve, bgp, SAFI_MPLS_VPN,
prefix, /* unicast route prefix */
@@ -1679,7 +1681,7 @@ static void vnc_import_bgp_exterior_add_route_it(
bpi_interior = bpi_interior->next) {
struct prefix_rd *prd;
struct attr new_attr;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
if (!is_usable_interior_route(bpi_interior))
continue;
@@ -1696,17 +1698,18 @@ static void vnc_import_bgp_exterior_add_route_it(
*/
have_usable_route = 1;
- if (bpi_interior->extra) {
+ if (bpi_interior->extra)
prd = &bpi_interior->extra->vnc->vnc
.import.rd;
- if (bgp_path_info_num_labels(
- bpi_interior))
- label = decode_label(
- &bpi_interior->extra
- ->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi_interior))
+ label = decode_label(
+ &bpi_interior->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(new_attr));
new_attr = *bpi_interior->attr;
@@ -1855,7 +1858,7 @@ void vnc_import_bgp_exterior_del_route(
for (bpi_interior = rn->info; bpi_interior;
bpi_interior = bpi_interior->next) {
struct prefix_rd *prd;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
if (!is_usable_interior_route(bpi_interior))
continue;
@@ -1868,17 +1871,18 @@ void vnc_import_bgp_exterior_del_route(
*/
have_usable_route = 1;
- if (bpi_interior->extra) {
+ if (bpi_interior->extra)
prd = &bpi_interior->extra->vnc->vnc
.import.rd;
- if (bgp_path_info_num_labels(
- bpi_interior))
- label = decode_label(
- &bpi_interior->extra
- ->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi_interior))
+ label = decode_label(
+ &bpi_interior->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_KILL, bpi_interior->peer,
NULL, /* rfd */
@@ -2014,19 +2018,22 @@ void vnc_import_bgp_exterior_add_route_interior(
struct prefix_rd *prd;
struct attr new_attr;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
assert(bpi_exterior);
assert(pfx_exterior);
- if (bpi_interior->extra) {
+ if (bpi_interior->extra)
prd = &bpi_interior->extra->vnc->vnc.import.rd;
- if (bgp_path_info_num_labels(bpi_interior))
- label = decode_label(
- &bpi_interior->extra->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi_interior))
+ label = decode_label(
+ &bpi_interior->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
new_attr = *bpi_interior->attr;
@@ -2105,7 +2112,7 @@ void vnc_import_bgp_exterior_add_route_interior(
struct bgp_path_info *bpi;
struct prefix_rd *prd;
struct attr new_attr;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
/* do pull-down */
@@ -2132,17 +2139,18 @@ void vnc_import_bgp_exterior_add_route_interior(
* parent routes.
*/
for (bpi = par->info; bpi; bpi = bpi->next) {
-
- if (bpi->extra) {
+ if (bpi->extra)
prd = &bpi->extra->vnc->vnc
.import.rd;
- if (bgp_path_info_num_labels(bpi))
- label = decode_label(
- &bpi->extra->label
- [0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi))
+ label = decode_label(
+ &bpi->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_KILL, bpi->peer,
NULL, /* rfd */
@@ -2157,17 +2165,18 @@ void vnc_import_bgp_exterior_add_route_interior(
* Add constructed exterior routes based on
* the new interior route at longer prefix.
*/
- if (bpi_interior->extra) {
+ if (bpi_interior->extra)
prd = &bpi_interior->extra->vnc->vnc
.import.rd;
- if (bgp_path_info_num_labels(
- bpi_interior))
- label = decode_label(
- &bpi_interior->extra
- ->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi_interior))
+ label = decode_label(
+ &bpi_interior->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
new_attr = *bpi_interior->attr;
@@ -2250,7 +2259,7 @@ void vnc_import_bgp_exterior_add_route_interior(
struct prefix_rd *prd;
struct attr new_attr;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
/* do pull-down */
@@ -2279,14 +2288,17 @@ void vnc_import_bgp_exterior_add_route_interior(
* Add constructed exterior routes based on the
* new interior route at the longer prefix.
*/
- if (bpi_interior->extra) {
+ if (bpi_interior->extra)
prd = &bpi_interior->extra->vnc->vnc.import.rd;
- if (bgp_path_info_num_labels(bpi_interior))
- label = decode_label(
- &bpi_interior->extra->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi_interior))
+ label = decode_label(
+ &bpi_interior->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
new_attr = *bpi_interior->attr;
@@ -2386,16 +2398,18 @@ void vnc_import_bgp_exterior_del_route_interior(
&cursor)) {
struct prefix_rd *prd;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
- if (bpi_interior->extra) {
+ if (bpi_interior->extra)
prd = &bpi_interior->extra->vnc->vnc.import.rd;
- if (bgp_path_info_num_labels(bpi_interior))
- label = decode_label(
- &bpi_interior->extra->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi_interior))
+ label = decode_label(&bpi_interior->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_KILL, bpi_interior->peer, NULL, /* rfd */
pfx_exterior, NULL, afi, prd, bpi_interior->attr,
@@ -2462,19 +2476,22 @@ void vnc_import_bgp_exterior_del_route_interior(
struct prefix_rd *prd;
struct attr new_attr;
- uint32_t label = MPLS_INVALID_LABEL;
+ uint32_t label;
if (bpi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
continue;
- if (bpi->extra) {
+ if (bpi->extra)
prd = &bpi->extra->vnc->vnc.import.rd;
- if (bgp_path_info_num_labels(bpi))
- label = decode_label(
- &bpi->extra->label[0]);
- } else
+ else
prd = NULL;
+ if (bgp_path_info_num_labels(bpi))
+ label = decode_label(
+ &bpi->extra->label[0]);
+ else
+ label = MPLS_INVALID_LABEL;
+
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(new_attr));
new_attr = *bpi->attr;