summaryrefslogtreecommitdiffstats
path: root/ldpd/ldp_zebra.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-11-11 20:14:37 +0100
committerDonald Sharp <sharpd@nvidia.com>2020-11-15 21:04:52 +0100
commit7cfdb48554329b1fb7d0469d0ebf2bfa816c5eea (patch)
tree50d3a706d34cd135865356c0d95f04511497510b /ldpd/ldp_zebra.c
parentbgpd, lib, sharpd: Add enum for zclient_send_message return (diff)
downloadfrr-7cfdb48554329b1fb7d0469d0ebf2bfa816c5eea.tar.xz
frr-7cfdb48554329b1fb7d0469d0ebf2bfa816c5eea.zip
*: Convert all usage of zclient_send_message to new enum
The `enum zclient_send_status` enum needs to be extended throughout the code base to use the new states and to fix up places where we tested against the return value being non zero. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ldpd/ldp_zebra.c')
-rw-r--r--ldpd/ldp_zebra.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index 3852d8d23..df9832a28 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -127,8 +127,12 @@ ldp_zebra_opaque_unregister(void)
int
ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *state)
{
- return zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE,
- (const uint8_t *) state, sizeof(*state));
+ if (zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE,
+ (const uint8_t *)state, sizeof(*state))
+ == ZCLIENT_SEND_FAILURE)
+ return -1;
+ else
+ return 0;
}
static int
@@ -137,8 +141,12 @@ ldp_sync_zebra_send_announce(void)
struct ldp_igp_sync_announce announce;
announce.proto = ZEBRA_ROUTE_LDP;
- return zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
- (const uint8_t *) &announce, sizeof(announce));
+ if (zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
+ (const uint8_t *)&announce, sizeof(announce))
+ == ZCLIENT_SEND_FAILURE)
+ return -1;
+ else
+ return 0;
}
static int
@@ -272,7 +280,10 @@ ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr)
znh->label_num = 1;
znh->labels[0] = kr->remote_label;
- return zebra_send_mpls_labels(zclient, cmd, &zl);
+ if (zebra_send_mpls_labels(zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE)
+ return -1;
+
+ return 0;
}
int
@@ -293,7 +304,8 @@ kmpw_add(struct zapi_pw *zpw)
debug_zebra_out("pseudowire %s nexthop %s (add)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
- return (zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
int
@@ -302,7 +314,8 @@ kmpw_del(struct zapi_pw *zpw)
debug_zebra_out("pseudowire %s nexthop %s (del)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
- return (zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
int
@@ -312,7 +325,8 @@ kmpw_set(struct zapi_pw *zpw)
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop),
zpw->local_label, zpw->remote_label);
- return (zebra_send_pw(zclient, ZEBRA_PW_SET, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_SET, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
int
@@ -321,7 +335,8 @@ kmpw_unset(struct zapi_pw *zpw)
debug_zebra_out("pseudowire %s nexthop %s (unset)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
- return (zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
void