Skip to content

Commit

Permalink
*: Rename ZEBRA_FLAG_INTERNAL -> ZEBRA_FLAG_ALLOW_RECURSION
Browse files Browse the repository at this point in the history
The ZEBRA_FLAG_INTERNAL flag is used to signal to zebra that
the route being added, the nexthops for it can be recursively
resolved.  This name keeps throwing me off when I read it
so let's rename to something that allows the developer to
understand what is going on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  • Loading branch information
donaldsharp committed Feb 27, 2018
1 parent 3eef1b2 commit 4e8b02f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions bgpd/bgp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,14 +1026,14 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
if (peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED
|| info->sub_type == BGP_ROUTE_AGGREGATE) {
SET_FLAG(api.flags, ZEBRA_FLAG_IBGP);
SET_FLAG(api.flags, ZEBRA_FLAG_INTERNAL);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
}

if ((peer->sort == BGP_PEER_EBGP && peer->ttl != 1)
|| CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
|| bgp_flag_check(bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))

SET_FLAG(api.flags, ZEBRA_FLAG_INTERNAL);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);

/* Metric is currently based on the best-path only */
metric = info->attr->med;
Expand Down Expand Up @@ -1265,14 +1265,14 @@ void bgp_zebra_withdraw(struct prefix *p, struct bgp_info *info, safi_t safi)
SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE);

if (peer->sort == BGP_PEER_IBGP) {
SET_FLAG(api.flags, ZEBRA_FLAG_INTERNAL);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
SET_FLAG(api.flags, ZEBRA_FLAG_IBGP);
}

if ((peer->sort == BGP_PEER_EBGP && peer->ttl != 1)
|| CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
|| bgp_flag_check(peer->bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
SET_FLAG(api.flags, ZEBRA_FLAG_INTERNAL);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);

if (bgp_debug_zebra(p)) {
char buf[PREFIX_STRLEN];
Expand Down
2 changes: 1 addition & 1 deletion lib/zebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ extern const char *zserv_command_string(unsigned int command);
#define strmatch(a,b) (!strcmp((a), (b)))

/* Zebra message flags */
#define ZEBRA_FLAG_INTERNAL 0x01
#define ZEBRA_FLAG_ALLOW_RECURSION 0x01
#define ZEBRA_FLAG_SELFROUTE 0x02
#define ZEBRA_FLAG_IBGP 0x08
#define ZEBRA_FLAG_SELECTED 0x10
Expand Down
2 changes: 1 addition & 1 deletion nhrpd/nhrp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix
SET_FLAG(api.flags, ZEBRA_FLAG_FIB_OVERRIDE);
break;
}
SET_FLAG(api.flags, ZEBRA_FLAG_INTERNAL);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);

SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
api.nexthop_num = 1;
Expand Down
4 changes: 2 additions & 2 deletions pimd/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ T26 DONE Zebra daemon is marking recursive static route as inactive.
pointing to kernel routes as inactive:
zebra/zebra_rib.c nexthop_active_ipv4:
-- Original:
else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL))
else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_ALLOW_RECURSION))
-- Fixed:
else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL) ||
else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_ALLOW_RECURSION) ||
match->type == ZEBRA_ROUTE_KERNEL)

Old problem description:
Expand Down
2 changes: 1 addition & 1 deletion zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
nexthop->ifindex = newhop->ifindex;
}
return 1;
} else if (CHECK_FLAG(re->flags, ZEBRA_FLAG_INTERNAL)) {
} else if (CHECK_FLAG(re->flags, ZEBRA_FLAG_ALLOW_RECURSION)) {
resolved = 0;
for (ALL_NEXTHOPS(match->nexthop, newhop)) {
if (!CHECK_FLAG(newhop->flags,
Expand Down

0 comments on commit 4e8b02f

Please sign in to comment.