zebra: Attempt to clarify variable names as they are used

Cleanup the poorly implemented variable names so that we can
understand what is going on a bit better.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-09-24 16:13:04 -04:00
parent 93f533c308
commit 6cd9a93ddd
3 changed files with 13 additions and 12 deletions

View file

@ -765,7 +765,7 @@ static int zclient_connect(struct thread *t)
enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command,
const struct prefix *p,
bool exact_match,
bool connected,
bool resolve_via_def, vrf_id_t vrf_id)
{
struct stream *s;
@ -773,7 +773,7 @@ enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command,
s = zclient->obuf;
stream_reset(s);
zclient_create_header(s, command, vrf_id);
stream_putc(s, (exact_match) ? 1 : 0);
stream_putc(s, (connected) ? 1 : 0);
stream_putc(s, (resolve_via_def) ? 1 : 0);
stream_putw(s, PREFIX_FAMILY(p));
stream_putc(s, p->prefixlen);

View file

@ -1103,7 +1103,7 @@ extern enum zclient_send_status zclient_route_send(uint8_t, struct zclient *,
struct zapi_route *);
extern enum zclient_send_status
zclient_send_rnh(struct zclient *zclient, int command, const struct prefix *p,
bool exact_match, bool resolve_via_default, vrf_id_t vrf_id);
bool connected, bool resolve_via_default, vrf_id_t vrf_id);
int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh,
uint32_t api_flags, uint32_t api_message);
extern int zapi_route_encode(uint8_t, struct stream *, struct zapi_route *);

View file

@ -1171,7 +1171,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
struct stream *s;
struct prefix p;
unsigned short l = 0;
uint8_t flags = 0;
uint8_t connected = 0;
uint8_t resolve_via_default;
bool exist;
bool flag_changed = false;
@ -1189,7 +1189,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
client->nh_reg_time = monotime(NULL);
while (l < hdr->length) {
STREAM_GETC(s, flags);
STREAM_GETC(s, connected);
STREAM_GETC(s, resolve_via_default);
STREAM_GETW(s, p.family);
STREAM_GETC(s, p.prefixlen);
@ -1226,9 +1226,10 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
return;
orig_flags = rnh->flags;
if (flags && !CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
if (connected && !CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
SET_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED);
else if (!flags && CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
else if (!connected
&& CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
UNSET_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED);
if (resolve_via_default)
@ -1265,13 +1266,13 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS)
s = msg;
while (l < hdr->length) {
uint8_t flags;
uint8_t ignore;
STREAM_GETC(s, flags);
if (flags != 0)
STREAM_GETC(s, ignore);
if (ignore != 0)
goto stream_failure;
STREAM_GETC(s, flags);
if (flags != 0)
STREAM_GETC(s, ignore);
if (ignore != 0)
goto stream_failure;
STREAM_GETW(s, p.family);