struct bfd_control_msg *bcm);
static void control_handle_notify_del(struct bfd_control_socket *bcs,
struct bfd_control_msg *bcm);
-static void _control_handle_notify(struct hash_backet *hb, void *arg);
+static void _control_handle_notify(struct hash_bucket *hb, void *arg);
static void control_handle_notify(struct bfd_control_socket *bcs,
struct bfd_control_msg *bcm);
static void control_response(struct bfd_control_socket *bcs, uint16_t id,
struct bfd_control_socket *bcs;
bcs = XCALLOC(MTYPE_BFDD_CONTROL, sizeof(*bcs));
- if (bcs == NULL)
- return NULL;
/* Disable notifications by default. */
bcs->bcs_notify = 0;
return bnp;
bnp = XCALLOC(MTYPE_BFDD_CONTROL, sizeof(*bnp));
- if (bnp == NULL) {
- log_warning("%s: calloc: %s", __func__, strerror(errno));
- return NULL;
- }
TAILQ_INSERT_TAIL(&bcs->bcs_bnplist, bnp, bnp_entry);
bnp->bnp_bs = bs;
struct bfd_control_queue *bcq;
bcq = XCALLOC(MTYPE_BFDD_NOTIFICATION, sizeof(*bcq));
- if (bcq == NULL) {
- log_warning("%s: calloc: %s", __func__, strerror(errno));
- return NULL;
- }
control_reset_buf(&bcq->bcq_bcb);
TAILQ_INSERT_TAIL(&bcs->bcs_bcqueue, bcq, bcq_entry);
if (bcb->bcb_left > 0)
goto schedule_next_read;
- switch (bcm.bcm_type) {
+ switch (bcb->bcb_bcm->bcm_type) {
case BMT_REQUEST_ADD:
control_handle_request_add(bcs, bcb->bcb_bcm);
break;
default:
log_debug("%s: unhandled message type: %d", __func__,
- bcm.bcm_type);
- control_response(bcs, bcm.bcm_id, BCM_RESPONSE_ERROR,
+ bcb->bcb_bcm->bcm_type);
+ control_response(bcs, bcb->bcb_bcm->bcm_id, BCM_RESPONSE_ERROR,
"invalid message type");
break;
}
return bs_peer_find(bpc);
}
-static void _control_handle_notify(struct hash_backet *hb, void *arg)
+static void _control_handle_notify(struct hash_bucket *hb, void *arg)
{
struct bfd_control_socket *bcs = arg;
struct bfd_session *bs = hb->data;
jsonstrlen = strlen(jsonstr);
bcm = XMALLOC(MTYPE_BFDD_NOTIFICATION,
sizeof(struct bfd_control_msg) + jsonstrlen);
- if (bcm == NULL) {
- log_warning("%s: malloc: %s", __func__, strerror(errno));
- XFREE(MTYPE_BFDD_NOTIFICATION, jsonstr);
- return;
- }
bcm->bcm_length = htonl(jsonstrlen);
bcm->bcm_ver = BMV_VERSION_1;
jsonstrlen = strlen(jsonstr);
bcm = XMALLOC(MTYPE_BFDD_NOTIFICATION,
sizeof(struct bfd_control_msg) + jsonstrlen);
- if (bcm == NULL) {
- log_warning("%s: malloc: %s", __func__, strerror(errno));
- XFREE(MTYPE_BFDD_NOTIFICATION, jsonstr);
- return;
- }
bcm->bcm_length = htonl(jsonstrlen);
bcm->bcm_ver = BMV_VERSION_1;
control_queue_enqueue(bcs, bcm);
}
-int control_notify(struct bfd_session *bs)
+int control_notify(struct bfd_session *bs, uint8_t notify_state)
{
struct bfd_control_socket *bcs;
struct bfd_notify_peer *bnp;
/* Notify zebra listeners as well. */
- ptm_bfd_notify(bs);
+ ptm_bfd_notify(bs, notify_state);
/*
* PERFORMANCE: reuse the bfd_control_msg allocated data for
jsonstrlen = strlen(jsonstr);
bcm = XMALLOC(MTYPE_BFDD_NOTIFICATION,
sizeof(struct bfd_control_msg) + jsonstrlen);
- if (bcm == NULL) {
- log_warning("%s: malloc: %s", __func__, strerror(errno));
- XFREE(MTYPE_BFDD_NOTIFICATION, jsonstr);
- return;
- }
bcm->bcm_length = htonl(jsonstrlen);
bcm->bcm_ver = BMV_VERSION_1;