bgpd: fun with whitespace conventions

Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
Lou Berger 2017-11-03 17:36:06 -04:00
parent 714e4cfa06
commit e1541bf66e
5 changed files with 34 additions and 20 deletions

View file

@ -1638,7 +1638,10 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
case BGP_ATTR_NHLEN_VPNV4: case BGP_ATTR_NHLEN_VPNV4:
stream_getl(s); /* RD high */ stream_getl(s); /* RD high */
stream_getl(s); /* RD low */ stream_getl(s); /* RD low */
/* NOTE: intentional fall through - for consistency in rx processing */ /*
* NOTE: intentional fall through
* - for consistency in rx processing
*/
case BGP_ATTR_NHLEN_IPV4: case BGP_ATTR_NHLEN_IPV4:
stream_get(&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN); stream_get(&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
/* Probably needed for RFC 2283 */ /* Probably needed for RFC 2283 */

View file

@ -2788,7 +2788,7 @@ int bgp_update(struct peer *peer, struct prefix *p, u_int32_t addpath_id,
} }
/* next hop check. */ /* next hop check. */
if (!CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD) && /* allow vpn->vrf import */ if (!CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD) &&
bgp_update_martian_nexthop(bgp, afi, safi, &new_attr)) { bgp_update_martian_nexthop(bgp, afi, safi, &new_attr)) {
reason = "martian or self next-hop;"; reason = "martian or self next-hop;";
bgp_attr_flush(&new_attr); bgp_attr_flush(&new_attr);

View file

@ -1752,7 +1752,7 @@ DEFUN (vnc_nve_group_export_no_routemap,
is_bgp = 0; is_bgp = 0;
/* fall thru */ /* fall thru */
case 'b': case 'b':
idx +=2; idx += 2;
break; break;
default: /* route-map */ default: /* route-map */
idx++; idx++;

View file

@ -4634,10 +4634,10 @@ notcfg:
************************************************************************/ ************************************************************************/
void vnc_add_vrf_opener(struct bgp *bgp, struct rfapi_nve_group_cfg *rfg) void vnc_add_vrf_opener(struct bgp *bgp, struct rfapi_nve_group_cfg *rfg)
{ {
if (rfg->rfd == NULL) /* need new rfapi_handle */ if (rfg->rfd == NULL) { /* need new rfapi_handle */
{
/* based on rfapi_open */ /* based on rfapi_open */
struct rfapi_descriptor *rfd; struct rfapi_descriptor *rfd;
rfd = XCALLOC(MTYPE_RFAPI_DESC, rfd = XCALLOC(MTYPE_RFAPI_DESC,
sizeof(struct rfapi_descriptor)); sizeof(struct rfapi_descriptor));
rfd->bgp = bgp; rfd->bgp = bgp;

View file

@ -779,7 +779,11 @@ void vnc_direct_bgp_add_prefix(struct bgp *bgp,
if (rfgn->rfg->type == RFAPI_GROUP_CFG_VRF) { if (rfgn->rfg->type == RFAPI_GROUP_CFG_VRF) {
vnc_direct_add_rn_group_rd(bgp, rfgn->rfg, rn, &attr, vnc_direct_add_rn_group_rd(bgp, rfgn->rfg, rn, &attr,
afi, rfgn->rfg->rfd); afi, rfgn->rfg->rfd);
continue; /* yuck! - but consistent with rest of function */ /*
* yuck!
* - but consistent with rest of function
*/
continue;
} }
/* /*
* For each NVE that is assigned to the export nve group, * For each NVE that is assigned to the export nve group,
@ -880,7 +884,11 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
BGP_ROUTE_REDISTRIBUTE, BGP_ROUTE_REDISTRIBUTE,
NULL, /* RD not used for unicast */ NULL, /* RD not used for unicast */
NULL, NULL); /* tag not used for unicast */ NULL, NULL); /* tag not used for unicast */
continue; /* yuck! - but consistent with rest of function */ /*
* yuck!
* - but consistent with rest of function
*/
continue;
} }
/* /*
* For each NVE that is assigned to the export nve group, * For each NVE that is assigned to the export nve group,
@ -1161,7 +1169,7 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
if (irfd == NULL && rfg->type != RFAPI_GROUP_CFG_VRF) { if (irfd == NULL && rfg->type != RFAPI_GROUP_CFG_VRF) {
/* need new rfapi_handle, for peer strcture /* need new rfapi_handle, for peer strcture
* -- based on vnc_add_vrf_prefi */ * -- based on vnc_add_vrf_prefi */
assert (rfg->rfd == NULL); assert(rfg->rfd == NULL);
if (!rfg->rt_export_list || !rfg->rfapi_import_table) { if (!rfg->rt_export_list || !rfg->rfapi_import_table) {
vnc_zlog_debug_verbose("%s: VRF \"%s\" is missing RT import/export configuration.\n", vnc_zlog_debug_verbose("%s: VRF \"%s\" is missing RT import/export configuration.\n",
@ -1183,8 +1191,10 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
sizeof(struct rfapi_descriptor)); sizeof(struct rfapi_descriptor));
irfd->bgp = bgp; irfd->bgp = bgp;
rfg->rfd = irfd; rfg->rfd = irfd;
/* leave most fields empty as will get from (dynamic) config /*
* when needed */ * leave most fields empty as will get from (dynamic) config
* when needed
*/
irfd->default_tunneltype_option.type = BGP_ENCAP_TYPE_MPLS; irfd->default_tunneltype_option.type = BGP_ENCAP_TYPE_MPLS;
irfd->cookie = rfg; irfd->cookie = rfg;
if (rfg->vn_prefix.family if (rfg->vn_prefix.family
@ -1224,23 +1234,21 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
if (rfg->routemap_export_bgp) { if (rfg->routemap_export_bgp) {
route_map_result_t ret; route_map_result_t ret;
info.peer = irfd->peer; info.peer = irfd->peer;
info.attr = &hattr; info.attr = &hattr;
ret = route_map_apply( ret = route_map_apply(rfg->routemap_export_bgp,
rfg->routemap_export_bgp,
&rn->p, RMAP_BGP, &info); &rn->p, RMAP_BGP, &info);
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose("%s: route map says DENY, so not calling bgp_update",
"%s: route map says DENY, so not calling bgp_update",
__func__); __func__);
return; return;
} }
} }
if (VNC_DEBUG(EXPORT_BGP_DIRECT_ADD)) { if (VNC_DEBUG(EXPORT_BGP_DIRECT_ADD)) {
vnc_zlog_debug_any( vnc_zlog_debug_any("%s: hattr after route_map_apply:",
"%s: hattr after route_map_apply:",
__func__); __func__);
rfapiPrintAttrPtrs(NULL, &hattr); rfapiPrintAttrPtrs(NULL, &hattr);
} }
@ -1321,7 +1329,11 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
if (rfg->type == RFAPI_GROUP_CFG_VRF) { if (rfg->type == RFAPI_GROUP_CFG_VRF) {
vnc_direct_add_rn_group_rd(bgp, rfg, rn, &attr, vnc_direct_add_rn_group_rd(bgp, rfg, rn, &attr,
afi, rfg->rfd); afi, rfg->rfd);
continue; /* yuck! - but consistent with rest of function */ /*
* yuck!
* - but consistent with rest of function
*/
continue;
} }
/* /*
* For each NVE that is assigned to the export nve * For each NVE that is assigned to the export nve
@ -1331,7 +1343,7 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
for (ln = listhead(rfg->nves); ln; for (ln = listhead(rfg->nves); ln;
ln = listnextnode(ln)) { ln = listnextnode(ln)) {
vnc_direct_add_rn_group_rd(bgp, rfg, rn, &attr, vnc_direct_add_rn_group_rd(bgp, rfg, rn, &attr,
afi, listgetdata(ln)); afi, listgetdata(ln));
} }
} }
} }
@ -1418,12 +1430,11 @@ static void vnc_direct_bgp_del_group_afi(struct bgp *bgp,
for (ln = listhead(rfg->nves); ln; for (ln = listhead(rfg->nves); ln;
ln = listnextnode(ln)) ln = listnextnode(ln))
vnc_direct_del_rn_group_rd(bgp, rfg, rn, vnc_direct_del_rn_group_rd(bgp, rfg, rn,
afi, listgetdata(ln)); afi, listgetdata(ln));
} }
} }
} }
/* /*
* Caller is responsible for ensuring that the specified nve-group * Caller is responsible for ensuring that the specified nve-group
* was actually part of the list of exported nve groups. * was actually part of the list of exported nve groups.