*: Change thread->func to return void instead of int

The int return value is never used.  Modify the code
base to just return a void instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-02-22 19:04:25 -05:00
parent eaba619fc1
commit cc9f21da22
207 changed files with 1108 additions and 1833 deletions

View File

@ -49,11 +49,11 @@ THE SOFTWARE.
DEFINE_MGROUP(BABELD, "babeld"); DEFINE_MGROUP(BABELD, "babeld");
DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure"); DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure");
static int babel_init_routing_process(struct thread *thread); static void babel_init_routing_process(struct thread *thread);
static void babel_get_myid(void); static void babel_get_myid(void);
static void babel_initial_noise(void); static void babel_initial_noise(void);
static int babel_read_protocol (struct thread *thread); static void babel_read_protocol(struct thread *thread);
static int babel_main_loop(struct thread *thread); static void babel_main_loop(struct thread *thread);
static void babel_set_timer(struct timeval *timeout); static void babel_set_timer(struct timeval *timeout);
static void babel_fill_with_next_timeout(struct timeval *tv); static void babel_fill_with_next_timeout(struct timeval *tv);
static void static void
@ -175,8 +175,7 @@ fail:
} }
/* thread reading entries form others babel daemons */ /* thread reading entries form others babel daemons */
static int static void babel_read_protocol(struct thread *thread)
babel_read_protocol (struct thread *thread)
{ {
int rc; int rc;
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
@ -207,14 +206,12 @@ babel_read_protocol (struct thread *thread)
/* re-add thread */ /* re-add thread */
thread_add_read(master, &babel_read_protocol, NULL, protocol_socket, &babel_routing_process->t_read); thread_add_read(master, &babel_read_protocol, NULL, protocol_socket, &babel_routing_process->t_read);
return 0;
} }
/* Zebra will give some information, especially about interfaces. This function /* Zebra will give some information, especially about interfaces. This function
must be call with a litte timeout wich may give zebra the time to do his job, must be call with a litte timeout wich may give zebra the time to do his job,
making these inits have sense. */ making these inits have sense. */
static int static void babel_init_routing_process(struct thread *thread)
babel_init_routing_process(struct thread *thread)
{ {
myseqno = (frr_weak_random() & 0xFFFF); myseqno = (frr_weak_random() & 0xFFFF);
babel_get_myid(); babel_get_myid();
@ -222,7 +219,6 @@ babel_init_routing_process(struct thread *thread)
debugf(BABEL_DEBUG_COMMON, "My ID is : %s.", format_eui64(myid)); debugf(BABEL_DEBUG_COMMON, "My ID is : %s.", format_eui64(myid));
babel_initial_noise(); babel_initial_noise();
babel_main_loop(thread);/* this function self-add to the t_update thread */ babel_main_loop(thread);/* this function self-add to the t_update thread */
return 0;
} }
/* fill "myid" with an unique id (only if myid != {0}). */ /* fill "myid" with an unique id (only if myid != {0}). */
@ -327,8 +323,7 @@ babel_clean_routing_process(void)
} }
/* Function used with timeout. */ /* Function used with timeout. */
static int static void babel_main_loop(struct thread *thread)
babel_main_loop(struct thread *thread)
{ {
struct timeval tv; struct timeval tv;
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
@ -348,8 +343,8 @@ babel_main_loop(struct thread *thread)
/* it happens often to have less than 1 ms, it's bad. */ /* it happens often to have less than 1 ms, it's bad. */
timeval_add_msec(&tv, &tv, 300); timeval_add_msec(&tv, &tv, 300);
babel_set_timer(&tv); babel_set_timer(&tv);
return 0; return;
} }
gettime(&babel_now); gettime(&babel_now);
@ -410,7 +405,6 @@ babel_main_loop(struct thread *thread)
} }
assert(0); /* this line should never be reach */ assert(0); /* this line should never be reach */
return 0;
} }
static void static void

View File

@ -609,27 +609,23 @@ struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp,
return bfd_key_lookup(key); return bfd_key_lookup(key);
} }
int bfd_xmt_cb(struct thread *t) void bfd_xmt_cb(struct thread *t)
{ {
struct bfd_session *bs = THREAD_ARG(t); struct bfd_session *bs = THREAD_ARG(t);
ptm_bfd_xmt_TO(bs, 0); ptm_bfd_xmt_TO(bs, 0);
return 0;
} }
int bfd_echo_xmt_cb(struct thread *t) void bfd_echo_xmt_cb(struct thread *t)
{ {
struct bfd_session *bs = THREAD_ARG(t); struct bfd_session *bs = THREAD_ARG(t);
if (bs->echo_xmt_TO > 0) if (bs->echo_xmt_TO > 0)
ptm_bfd_echo_xmt_TO(bs); ptm_bfd_echo_xmt_TO(bs);
return 0;
} }
/* Was ptm_bfd_detect_TO() */ /* Was ptm_bfd_detect_TO() */
int bfd_recvtimer_cb(struct thread *t) void bfd_recvtimer_cb(struct thread *t)
{ {
struct bfd_session *bs = THREAD_ARG(t); struct bfd_session *bs = THREAD_ARG(t);
@ -639,12 +635,10 @@ int bfd_recvtimer_cb(struct thread *t)
ptm_bfd_sess_dn(bs, BD_CONTROL_EXPIRED); ptm_bfd_sess_dn(bs, BD_CONTROL_EXPIRED);
break; break;
} }
return 0;
} }
/* Was ptm_bfd_echo_detect_TO() */ /* Was ptm_bfd_echo_detect_TO() */
int bfd_echo_recvtimer_cb(struct thread *t) void bfd_echo_recvtimer_cb(struct thread *t)
{ {
struct bfd_session *bs = THREAD_ARG(t); struct bfd_session *bs = THREAD_ARG(t);
@ -654,8 +648,6 @@ int bfd_echo_recvtimer_cb(struct thread *t)
ptm_bfd_sess_dn(bs, BD_ECHO_FAILED); ptm_bfd_sess_dn(bs, BD_ECHO_FAILED);
break; break;
} }
return 0;
} }
struct bfd_session *bfd_session_new(void) struct bfd_session *bfd_session_new(void)

View File

@ -426,7 +426,7 @@ int control_init(const char *path);
void control_shutdown(void); void control_shutdown(void);
int control_notify(struct bfd_session *bs, uint8_t notify_state); int control_notify(struct bfd_session *bs, uint8_t notify_state);
int control_notify_config(const char *op, struct bfd_session *bs); int control_notify_config(const char *op, struct bfd_session *bs);
int control_accept(struct thread *t); void control_accept(struct thread *t);
/* /*
@ -556,7 +556,7 @@ int bp_echov6_socket(const struct vrf *vrf);
void ptm_bfd_snd(struct bfd_session *bfd, int fbit); void ptm_bfd_snd(struct bfd_session *bfd, int fbit);
void ptm_bfd_echo_snd(struct bfd_session *bfd); void ptm_bfd_echo_snd(struct bfd_session *bfd);
int bfd_recv_cb(struct thread *t); void bfd_recv_cb(struct thread *t);
/* /*
@ -690,10 +690,10 @@ unsigned long bfd_get_session_count(void);
/* Export callback functions for `event.c`. */ /* Export callback functions for `event.c`. */
extern struct thread_master *master; extern struct thread_master *master;
int bfd_recvtimer_cb(struct thread *t); void bfd_recvtimer_cb(struct thread *t);
int bfd_echo_recvtimer_cb(struct thread *t); void bfd_echo_recvtimer_cb(struct thread *t);
int bfd_xmt_cb(struct thread *t); void bfd_xmt_cb(struct thread *t);
int bfd_echo_xmt_cb(struct thread *t); void bfd_echo_xmt_cb(struct thread *t);
extern struct in6_addr zero_addr; extern struct in6_addr zero_addr;

View File

@ -531,7 +531,7 @@ static void cp_debug(bool mhop, struct sockaddr_any *peer,
mhop ? "yes" : "no", peerstr, localstr, portstr, vrfstr); mhop ? "yes" : "no", peerstr, localstr, portstr, vrfstr);
} }
int bfd_recv_cb(struct thread *t) void bfd_recv_cb(struct thread *t)
{ {
int sd = THREAD_FD(t); int sd = THREAD_FD(t);
struct bfd_session *bfd; struct bfd_session *bfd;
@ -552,7 +552,7 @@ int bfd_recv_cb(struct thread *t)
/* Handle echo packets. */ /* Handle echo packets. */
if (sd == bvrf->bg_echo || sd == bvrf->bg_echov6) { if (sd == bvrf->bg_echo || sd == bvrf->bg_echov6) {
ptm_bfd_process_echo_pkt(bvrf, sd); ptm_bfd_process_echo_pkt(bvrf, sd);
return 0; return;
} }
/* Sanitize input/output. */ /* Sanitize input/output. */
@ -590,14 +590,14 @@ int bfd_recv_cb(struct thread *t)
if (mlen < BFD_PKT_LEN) { if (mlen < BFD_PKT_LEN) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"too small (%ld bytes)", mlen); "too small (%ld bytes)", mlen);
return 0; return;
} }
/* Validate single hop packet TTL. */ /* Validate single hop packet TTL. */
if ((!is_mhop) && (ttl != BFD_TTL_VAL)) { if ((!is_mhop) && (ttl != BFD_TTL_VAL)) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"invalid TTL: %d expected %d", ttl, BFD_TTL_VAL); "invalid TTL: %d expected %d", ttl, BFD_TTL_VAL);
return 0; return;
} }
/* /*
@ -611,24 +611,24 @@ int bfd_recv_cb(struct thread *t)
if (BFD_GETVER(cp->diag) != BFD_VERSION) { if (BFD_GETVER(cp->diag) != BFD_VERSION) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"bad version %d", BFD_GETVER(cp->diag)); "bad version %d", BFD_GETVER(cp->diag));
return 0; return;
} }
if (cp->detect_mult == 0) { if (cp->detect_mult == 0) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"detect multiplier set to zero"); "detect multiplier set to zero");
return 0; return;
} }
if ((cp->len < BFD_PKT_LEN) || (cp->len > mlen)) { if ((cp->len < BFD_PKT_LEN) || (cp->len > mlen)) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "too small"); cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "too small");
return 0; return;
} }
if (cp->discrs.my_discr == 0) { if (cp->discrs.my_discr == 0) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"'my discriminator' is zero"); "'my discriminator' is zero");
return 0; return;
} }
/* Find the session that this packet belongs. */ /* Find the session that this packet belongs. */
@ -636,7 +636,7 @@ int bfd_recv_cb(struct thread *t)
if (bfd == NULL) { if (bfd == NULL) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"no session found"); "no session found");
return 0; return;
} }
/* /*
@ -648,7 +648,7 @@ int bfd_recv_cb(struct thread *t)
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"exceeded max hop count (expected %d, got %d)", "exceeded max hop count (expected %d, got %d)",
bfd->mh_ttl, ttl); bfd->mh_ttl, ttl);
return 0; return;
} }
} else if (bfd->local_address.sa_sin.sin_family == AF_UNSPEC) { } else if (bfd->local_address.sa_sin.sin_family == AF_UNSPEC) {
bfd->local_address = local; bfd->local_address = local;
@ -733,8 +733,6 @@ int bfd_recv_cb(struct thread *t)
/* Send the control packet with the final bit immediately. */ /* Send the control packet with the final bit immediately. */
ptm_bfd_snd(bfd, 1); ptm_bfd_snd(bfd, 1);
} }
return 0;
} }
/* /*

View File

@ -52,8 +52,8 @@ struct bfd_notify_peer *control_notifypeer_find(struct bfd_control_socket *bcs,
struct bfd_control_socket *control_new(int sd); struct bfd_control_socket *control_new(int sd);
static void control_free(struct bfd_control_socket *bcs); static void control_free(struct bfd_control_socket *bcs);
static void control_reset_buf(struct bfd_control_buffer *bcb); static void control_reset_buf(struct bfd_control_buffer *bcb);
static int control_read(struct thread *t); static void control_read(struct thread *t);
static int control_write(struct thread *t); static void control_write(struct thread *t);
static void control_handle_request_add(struct bfd_control_socket *bcs, static void control_handle_request_add(struct bfd_control_socket *bcs,
struct bfd_control_msg *bcm); struct bfd_control_msg *bcm);
@ -155,21 +155,19 @@ void control_shutdown(void)
} }
} }
int control_accept(struct thread *t) void control_accept(struct thread *t)
{ {
int csock, sd = THREAD_FD(t); int csock, sd = THREAD_FD(t);
csock = accept(sd, NULL, 0); csock = accept(sd, NULL, 0);
if (csock == -1) { if (csock == -1) {
zlog_warn("%s: accept: %s", __func__, strerror(errno)); zlog_warn("%s: accept: %s", __func__, strerror(errno));
return 0; return;
} }
control_new(csock); control_new(csock);
thread_add_read(master, control_accept, NULL, sd, &bglobal.bg_csockev); thread_add_read(master, control_accept, NULL, sd, &bglobal.bg_csockev);
return 0;
} }
@ -394,7 +392,7 @@ static void control_reset_buf(struct bfd_control_buffer *bcb)
bcb->bcb_left = 0; bcb->bcb_left = 0;
} }
static int control_read(struct thread *t) static void control_read(struct thread *t)
{ {
struct bfd_control_socket *bcs = THREAD_ARG(t); struct bfd_control_socket *bcs = THREAD_ARG(t);
struct bfd_control_buffer *bcb = &bcs->bcs_bin; struct bfd_control_buffer *bcb = &bcs->bcs_bin;
@ -417,7 +415,7 @@ static int control_read(struct thread *t)
bread = read(sd, &bcm, sizeof(bcm)); bread = read(sd, &bcm, sizeof(bcm));
if (bread == 0) { if (bread == 0) {
control_free(bcs); control_free(bcs);
return 0; return;
} }
if (bread < 0) { if (bread < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
@ -425,7 +423,7 @@ static int control_read(struct thread *t)
zlog_warn("%s: read: %s", __func__, strerror(errno)); zlog_warn("%s: read: %s", __func__, strerror(errno));
control_free(bcs); control_free(bcs);
return 0; return;
} }
/* Validate header fields. */ /* Validate header fields. */
@ -434,14 +432,14 @@ static int control_read(struct thread *t)
zlog_debug("%s: client closed due small message length: %d", zlog_debug("%s: client closed due small message length: %d",
__func__, bcm.bcm_length); __func__, bcm.bcm_length);
control_free(bcs); control_free(bcs);
return 0; return;
} }
if (bcm.bcm_ver != BMV_VERSION_1) { if (bcm.bcm_ver != BMV_VERSION_1) {
zlog_debug("%s: client closed due bad version: %d", __func__, zlog_debug("%s: client closed due bad version: %d", __func__,
bcm.bcm_ver); bcm.bcm_ver);
control_free(bcs); control_free(bcs);
return 0; return;
} }
/* Prepare the buffer to load the message. */ /* Prepare the buffer to load the message. */
@ -456,7 +454,7 @@ static int control_read(struct thread *t)
zlog_warn("%s: not enough memory for message size: %zu", zlog_warn("%s: not enough memory for message size: %zu",
__func__, bcb->bcb_left); __func__, bcb->bcb_left);
control_free(bcs); control_free(bcs);
return 0; return;
} }
memcpy(bcb->bcb_buf, &bcm, sizeof(bcm)); memcpy(bcb->bcb_buf, &bcm, sizeof(bcm));
@ -469,7 +467,7 @@ skip_header:
bread = read(sd, &bcb->bcb_buf[bcb->bcb_pos], bcb->bcb_left); bread = read(sd, &bcb->bcb_buf[bcb->bcb_pos], bcb->bcb_left);
if (bread == 0) { if (bread == 0) {
control_free(bcs); control_free(bcs);
return 0; return;
} }
if (bread < 0) { if (bread < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
@ -477,7 +475,7 @@ skip_header:
zlog_warn("%s: read: %s", __func__, strerror(errno)); zlog_warn("%s: read: %s", __func__, strerror(errno));
control_free(bcs); control_free(bcs);
return 0; return;
} }
bcb->bcb_pos += bread; bcb->bcb_pos += bread;
@ -518,11 +516,9 @@ skip_header:
schedule_next_read: schedule_next_read:
bcs->bcs_ev = NULL; bcs->bcs_ev = NULL;
thread_add_read(master, control_read, bcs, sd, &bcs->bcs_ev); thread_add_read(master, control_read, bcs, sd, &bcs->bcs_ev);
return 0;
} }
static int control_write(struct thread *t) static void control_write(struct thread *t)
{ {
struct bfd_control_socket *bcs = THREAD_ARG(t); struct bfd_control_socket *bcs = THREAD_ARG(t);
struct bfd_control_buffer *bcb = bcs->bcs_bout; struct bfd_control_buffer *bcb = bcs->bcs_bout;
@ -532,19 +528,19 @@ static int control_write(struct thread *t)
bwrite = write(sd, &bcb->bcb_buf[bcb->bcb_pos], bcb->bcb_left); bwrite = write(sd, &bcb->bcb_buf[bcb->bcb_pos], bcb->bcb_left);
if (bwrite == 0) { if (bwrite == 0) {
control_free(bcs); control_free(bcs);
return 0; return;
} }
if (bwrite < 0) { if (bwrite < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
bcs->bcs_outev = NULL; bcs->bcs_outev = NULL;
thread_add_write(master, control_write, bcs, thread_add_write(master, control_write, bcs,
bcs->bcs_sd, &bcs->bcs_outev); bcs->bcs_sd, &bcs->bcs_outev);
return 0; return;
} }
zlog_warn("%s: write: %s", __func__, strerror(errno)); zlog_warn("%s: write: %s", __func__, strerror(errno));
control_free(bcs); control_free(bcs);
return 0; return;
} }
bcb->bcb_pos += bwrite; bcb->bcb_pos += bwrite;
@ -553,12 +549,10 @@ static int control_write(struct thread *t)
bcs->bcs_outev = NULL; bcs->bcs_outev = NULL;
thread_add_write(master, control_write, bcs, bcs->bcs_sd, thread_add_write(master, control_write, bcs, bcs->bcs_sd,
&bcs->bcs_outev); &bcs->bcs_outev);
return 0; return;
} }
control_queue_dequeue(bcs); control_queue_dequeue(bcs);
return 0;
} }

View File

@ -107,7 +107,7 @@ struct bfd_dplane_ctx {
*/ */
typedef void (*bfd_dplane_expect_cb)(struct bfddp_message *msg, void *arg); typedef void (*bfd_dplane_expect_cb)(struct bfddp_message *msg, void *arg);
static int bfd_dplane_client_connect(struct thread *t); static void bfd_dplane_client_connect(struct thread *t);
static bool bfd_dplane_client_connecting(struct bfd_dplane_ctx *bdc); static bool bfd_dplane_client_connecting(struct bfd_dplane_ctx *bdc);
static void bfd_dplane_ctx_free(struct bfd_dplane_ctx *bdc); static void bfd_dplane_ctx_free(struct bfd_dplane_ctx *bdc);
static int _bfd_dplane_add_session(struct bfd_dplane_ctx *bdc, static int _bfd_dplane_add_session(struct bfd_dplane_ctx *bdc,
@ -325,17 +325,15 @@ static ssize_t bfd_dplane_flush(struct bfd_dplane_ctx *bdc)
return total; return total;
} }
static int bfd_dplane_write(struct thread *t) static void bfd_dplane_write(struct thread *t)
{ {
struct bfd_dplane_ctx *bdc = THREAD_ARG(t); struct bfd_dplane_ctx *bdc = THREAD_ARG(t);
/* Handle connection stage. */ /* Handle connection stage. */
if (bdc->connecting && bfd_dplane_client_connecting(bdc)) if (bdc->connecting && bfd_dplane_client_connecting(bdc))
return 0; return;
bfd_dplane_flush(bdc); bfd_dplane_flush(bdc);
return 0;
} }
static void static void
@ -614,18 +612,17 @@ skip_read:
return 0; return 0;
} }
static int bfd_dplane_read(struct thread *t) static void bfd_dplane_read(struct thread *t)
{ {
struct bfd_dplane_ctx *bdc = THREAD_ARG(t); struct bfd_dplane_ctx *bdc = THREAD_ARG(t);
int rv; int rv;
rv = bfd_dplane_expect(bdc, 0, bfd_dplane_handle_message, NULL); rv = bfd_dplane_expect(bdc, 0, bfd_dplane_handle_message, NULL);
if (rv == -1) if (rv == -1)
return 0; return;
stream_pulldown(bdc->inbuf); stream_pulldown(bdc->inbuf);
thread_add_read(master, bfd_dplane_read, bdc, bdc->sock, &bdc->inbufev); thread_add_read(master, bfd_dplane_read, bdc, bdc->sock, &bdc->inbufev);
return 0;
} }
static void _bfd_session_register_dplane(struct hash_bucket *hb, void *arg) static void _bfd_session_register_dplane(struct hash_bucket *hb, void *arg)
@ -835,7 +832,7 @@ static uint16_t bfd_dplane_request_counters(const struct bfd_session *bs)
/* /*
* Data plane listening socket. * Data plane listening socket.
*/ */
static int bfd_dplane_accept(struct thread *t) static void bfd_dplane_accept(struct thread *t)
{ {
struct bfd_global *bg = THREAD_ARG(t); struct bfd_global *bg = THREAD_ARG(t);
struct bfd_dplane_ctx *bdc; struct bfd_dplane_ctx *bdc;
@ -858,7 +855,6 @@ static int bfd_dplane_accept(struct thread *t)
reschedule_and_return: reschedule_and_return:
thread_add_read(master, bfd_dplane_accept, bg, bg->bg_dplane_sock, thread_add_read(master, bfd_dplane_accept, bg, bg->bg_dplane_sock,
&bglobal.bg_dplane_sockev); &bglobal.bg_dplane_sockev);
return 0;
} }
/* /*
@ -916,7 +912,7 @@ static bool bfd_dplane_client_connecting(struct bfd_dplane_ctx *bdc)
} }
} }
static int bfd_dplane_client_connect(struct thread *t) static void bfd_dplane_client_connect(struct thread *t)
{ {
struct bfd_dplane_ctx *bdc = THREAD_ARG(t); struct bfd_dplane_ctx *bdc = THREAD_ARG(t);
int rv, sock; int rv, sock;
@ -965,15 +961,12 @@ static int bfd_dplane_client_connect(struct thread *t)
_bfd_dplane_client_bootstrap(bdc); _bfd_dplane_client_bootstrap(bdc);
} }
return 0;
reschedule_connect: reschedule_connect:
THREAD_OFF(bdc->inbufev); THREAD_OFF(bdc->inbufev);
THREAD_OFF(bdc->outbufev); THREAD_OFF(bdc->outbufev);
socket_close(&sock); socket_close(&sock);
thread_add_timer(master, bfd_dplane_client_connect, bdc, 3, thread_add_timer(master, bfd_dplane_client_connect, bdc, 3,
&bdc->connectev); &bdc->connectev);
return 0;
} }
static void bfd_dplane_client_init(const struct sockaddr *sa, socklen_t salen) static void bfd_dplane_client_init(const struct sockaddr *sa, socklen_t salen)

View File

@ -1315,7 +1315,7 @@ static void bmp_stat_put_u32(struct stream *s, size_t *cnt, uint16_t type,
(*cnt)++; (*cnt)++;
} }
static int bmp_stats(struct thread *thread) static void bmp_stats(struct thread *thread)
{ {
struct bmp_targets *bt = THREAD_ARG(thread); struct bmp_targets *bt = THREAD_ARG(thread);
struct stream *s; struct stream *s;
@ -1365,11 +1365,10 @@ static int bmp_stats(struct thread *thread)
bmp_send_all(bt->bmpbgp, s); bmp_send_all(bt->bmpbgp, s);
} }
return 0;
} }
/* read from the BMP socket to detect session termination */ /* read from the BMP socket to detect session termination */
static int bmp_read(struct thread *t) static void bmp_read(struct thread *t)
{ {
struct bmp *bmp = THREAD_ARG(t); struct bmp *bmp = THREAD_ARG(t);
char buf[1024]; char buf[1024];
@ -1383,16 +1382,14 @@ static int bmp_read(struct thread *t)
} else if (n == 0) { } else if (n == 0) {
/* the TCP session was terminated by the far end */ /* the TCP session was terminated by the far end */
bmp_wrerr(bmp, NULL, true); bmp_wrerr(bmp, NULL, true);
return 0; return;
} else if (!(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) { } else if (!(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) {
/* the TCP session experienced a fatal error, likely a timeout */ /* the TCP session experienced a fatal error, likely a timeout */
bmp_wrerr(bmp, NULL, false); bmp_wrerr(bmp, NULL, false);
return -1; return;
} }
thread_add_read(bm->master, bmp_read, bmp, bmp->socket, &bmp->t_read); thread_add_read(bm->master, bmp_read, bmp, bmp->socket, &bmp->t_read);
return 0;
} }
static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock)
@ -1475,7 +1472,7 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock)
} }
/* Accept BMP connection. */ /* Accept BMP connection. */
static int bmp_accept(struct thread *thread) static void bmp_accept(struct thread *thread)
{ {
union sockunion su; union sockunion su;
struct bmp_listener *bl = THREAD_ARG(thread); struct bmp_listener *bl = THREAD_ARG(thread);
@ -1490,10 +1487,9 @@ static int bmp_accept(struct thread *thread)
bmp_sock = sockunion_accept(bl->sock, &su); bmp_sock = sockunion_accept(bl->sock, &su);
if (bmp_sock < 0) { if (bmp_sock < 0) {
zlog_info("bmp: accept_sock failed: %s", safe_strerror(errno)); zlog_info("bmp: accept_sock failed: %s", safe_strerror(errno));
return -1; return;
} }
bmp_open(bl->targets, bmp_sock); bmp_open(bl->targets, bmp_sock);
return 0;
} }
static void bmp_close(struct bmp *bmp) static void bmp_close(struct bmp *bmp)
@ -1837,7 +1833,7 @@ static void bmp_active_resolved(struct resolver_query *resq, const char *errstr,
bmp_active_connect(ba); bmp_active_connect(ba);
} }
static int bmp_active_thread(struct thread *t) static void bmp_active_thread(struct thread *t)
{ {
struct bmp_active *ba = THREAD_ARG(t); struct bmp_active *ba = THREAD_ARG(t);
socklen_t slen; socklen_t slen;
@ -1861,7 +1857,7 @@ static int bmp_active_thread(struct thread *t)
vrf_id = ba->targets->bgp->vrf_id; vrf_id = ba->targets->bgp->vrf_id;
resolver_resolve(&ba->resq, AF_UNSPEC, vrf_id, ba->hostname, resolver_resolve(&ba->resq, AF_UNSPEC, vrf_id, ba->hostname,
bmp_active_resolved); bmp_active_resolved);
return 0; return;
} }
slen = sizeof(status); slen = sizeof(status);
@ -1886,14 +1882,13 @@ static int bmp_active_thread(struct thread *t)
ba->bmp->active = ba; ba->bmp->active = ba;
ba->socket = -1; ba->socket = -1;
ba->curretry = ba->minretry; ba->curretry = ba->minretry;
return 0; return;
out_next: out_next:
close(ba->socket); close(ba->socket);
ba->socket = -1; ba->socket = -1;
ba->addrpos++; ba->addrpos++;
bmp_active_connect(ba); bmp_active_connect(ba);
return 0;
} }
static void bmp_active_disconnected(struct bmp_active *ba) static void bmp_active_disconnected(struct bmp_active *ba)

View File

@ -165,7 +165,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
/* Handler of conditional advertisement timer event. /* Handler of conditional advertisement timer event.
* Each route in the condition-map is evaluated. * Each route in the condition-map is evaluated.
*/ */
static int bgp_conditional_adv_timer(struct thread *t) static void bgp_conditional_adv_timer(struct thread *t)
{ {
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -286,7 +286,6 @@ static int bgp_conditional_adv_timer(struct thread *t)
} }
peer->advmap_table_change = false; peer->advmap_table_change = false;
} }
return 0;
} }
void bgp_conditional_adv_enable(struct peer *peer, afi_t afi, safi_t safi) void bgp_conditional_adv_enable(struct peer *peer, afi_t afi, safi_t safi)

View File

@ -113,7 +113,7 @@ int bgp_damp_decay(time_t tdiff, int penalty, struct bgp_damp_config *bdc)
/* Handler of reuse timer event. Each route in the current reuse-list /* Handler of reuse timer event. Each route in the current reuse-list
is evaluated. RFC2439 Section 4.8.7. */ is evaluated. RFC2439 Section 4.8.7. */
static int bgp_reuse_timer(struct thread *t) static void bgp_reuse_timer(struct thread *t)
{ {
struct bgp_damp_info *bdi; struct bgp_damp_info *bdi;
struct bgp_damp_info *next; struct bgp_damp_info *next;
@ -178,8 +178,6 @@ static int bgp_reuse_timer(struct thread *t)
* 4.8.6). */ * 4.8.6). */
bgp_reuse_list_add(bdi, bdc); bgp_reuse_list_add(bdi, bdc);
} }
return 0;
} }
/* A route becomes unreachable (RFC2439 Section 4.8.2). */ /* A route becomes unreachable (RFC2439 Section 4.8.2). */

View File

@ -88,7 +88,7 @@ struct bgp_dump {
}; };
static int bgp_dump_unset(struct bgp_dump *bgp_dump); static int bgp_dump_unset(struct bgp_dump *bgp_dump);
static int bgp_dump_interval_func(struct thread *); static void bgp_dump_interval_func(struct thread *);
/* BGP packet dump output buffer. */ /* BGP packet dump output buffer. */
struct stream *bgp_dump_obuf; struct stream *bgp_dump_obuf;
@ -439,7 +439,7 @@ static unsigned int bgp_dump_routes_func(int afi, int first_run,
return seq; return seq;
} }
static int bgp_dump_interval_func(struct thread *t) static void bgp_dump_interval_func(struct thread *t)
{ {
struct bgp_dump *bgp_dump; struct bgp_dump *bgp_dump;
bgp_dump = THREAD_ARG(t); bgp_dump = THREAD_ARG(t);
@ -462,8 +462,6 @@ static int bgp_dump_interval_func(struct thread *t)
/* if interval is set reschedule */ /* if interval is set reschedule */
if (bgp_dump->interval > 0) if (bgp_dump->interval > 0)
bgp_dump_interval_add(bgp_dump, bgp_dump->interval); bgp_dump_interval_add(bgp_dump, bgp_dump->interval);
return 0;
} }
/* Dump common information. */ /* Dump common information. */

View File

@ -76,7 +76,7 @@ static void bgp_evpn_mac_update_on_es_local_chg(struct bgp_evpn_es *es,
bool is_local); bool is_local);
esi_t zero_esi_buf, *zero_esi = &zero_esi_buf; esi_t zero_esi_buf, *zero_esi = &zero_esi_buf;
static int bgp_evpn_run_consistency_checks(struct thread *t); static void bgp_evpn_run_consistency_checks(struct thread *t);
static void bgp_evpn_path_nh_info_free(struct bgp_path_evpn_nh_info *nh_info); static void bgp_evpn_path_nh_info_free(struct bgp_path_evpn_nh_info *nh_info);
static void bgp_evpn_path_nh_unlink(struct bgp_path_evpn_nh_info *nh_info); static void bgp_evpn_path_nh_unlink(struct bgp_path_evpn_nh_info *nh_info);
@ -4122,7 +4122,7 @@ static uint32_t bgp_evpn_es_run_consistency_checks(struct bgp_evpn_es *es)
return proc_cnt; return proc_cnt;
} }
static int bgp_evpn_run_consistency_checks(struct thread *t) static void bgp_evpn_run_consistency_checks(struct thread *t)
{ {
int proc_cnt = 0; int proc_cnt = 0;
int es_cnt = 0; int es_cnt = 0;
@ -4147,8 +4147,6 @@ static int bgp_evpn_run_consistency_checks(struct thread *t)
thread_add_timer(bm->master, bgp_evpn_run_consistency_checks, NULL, thread_add_timer(bm->master, bgp_evpn_run_consistency_checks, NULL,
BGP_EVPN_CONS_CHECK_INTERVAL, BGP_EVPN_CONS_CHECK_INTERVAL,
&bgp_mh_info->t_cons_check); &bgp_mh_info->t_cons_check);
return 0;
} }
/***************************************************************************** /*****************************************************************************

View File

@ -90,13 +90,13 @@ static const char *const bgp_event_str[] = {
function. */ function. */
/* BGP event function. */ /* BGP event function. */
int bgp_event(struct thread *); void bgp_event(struct thread *);
/* BGP thread functions. */ /* BGP thread functions. */
static int bgp_start_timer(struct thread *); static void bgp_start_timer(struct thread *);
static int bgp_connect_timer(struct thread *); static void bgp_connect_timer(struct thread *);
static int bgp_holdtime_timer(struct thread *); static void bgp_holdtime_timer(struct thread *);
static int bgp_delayopen_timer(struct thread *); static void bgp_delayopen_timer(struct thread *);
/* BGP FSM functions. */ /* BGP FSM functions. */
static int bgp_start(struct peer *); static int bgp_start(struct peer *);
@ -494,7 +494,7 @@ void bgp_timer_set(struct peer *peer)
/* BGP start timer. This function set BGP_Start event to thread value /* BGP start timer. This function set BGP_Start event to thread value
and process event. */ and process event. */
static int bgp_start_timer(struct thread *thread) static void bgp_start_timer(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
@ -505,15 +505,12 @@ static int bgp_start_timer(struct thread *thread)
THREAD_VAL(thread) = BGP_Start; THREAD_VAL(thread) = BGP_Start;
bgp_event(thread); /* bgp_event unlocks peer */ bgp_event(thread); /* bgp_event unlocks peer */
return 0;
} }
/* BGP connect retry timer. */ /* BGP connect retry timer. */
static int bgp_connect_timer(struct thread *thread) static void bgp_connect_timer(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
int ret;
peer = THREAD_ARG(thread); peer = THREAD_ARG(thread);
@ -526,20 +523,16 @@ static int bgp_connect_timer(struct thread *thread)
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug("%s [FSM] Timer (connect timer expire)", peer->host); zlog_debug("%s [FSM] Timer (connect timer expire)", peer->host);
if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) { if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER))
bgp_stop(peer); bgp_stop(peer);
ret = -1; else {
} else {
THREAD_VAL(thread) = ConnectRetry_timer_expired; THREAD_VAL(thread) = ConnectRetry_timer_expired;
bgp_event(thread); /* bgp_event unlocks peer */ bgp_event(thread); /* bgp_event unlocks peer */
ret = 0;
} }
return ret;
} }
/* BGP holdtime timer. */ /* BGP holdtime timer. */
static int bgp_holdtime_timer(struct thread *thread) static void bgp_holdtime_timer(struct thread *thread)
{ {
atomic_size_t inq_count; atomic_size_t inq_count;
struct peer *peer; struct peer *peer;
@ -562,20 +555,15 @@ static int bgp_holdtime_timer(struct thread *thread)
*/ */
inq_count = atomic_load_explicit(&peer->ibuf->count, inq_count = atomic_load_explicit(&peer->ibuf->count,
memory_order_relaxed); memory_order_relaxed);
if (inq_count) { if (inq_count)
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime); peer->v_holdtime);
return 0;
}
THREAD_VAL(thread) = Hold_Timer_expired; THREAD_VAL(thread) = Hold_Timer_expired;
bgp_event(thread); /* bgp_event unlocks peer */ bgp_event(thread); /* bgp_event unlocks peer */
return 0;
} }
int bgp_routeadv_timer(struct thread *thread) void bgp_routeadv_timer(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
@ -593,11 +581,10 @@ int bgp_routeadv_timer(struct thread *thread)
/* MRAI timer will be started again when FIFO is built, no need to /* MRAI timer will be started again when FIFO is built, no need to
* do it here. * do it here.
*/ */
return 0;
} }
/* RFC 4271 DelayOpenTimer */ /* RFC 4271 DelayOpenTimer */
int bgp_delayopen_timer(struct thread *thread) void bgp_delayopen_timer(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
@ -609,8 +596,6 @@ int bgp_delayopen_timer(struct thread *thread)
THREAD_VAL(thread) = DelayOpen_timer_expired; THREAD_VAL(thread) = DelayOpen_timer_expired;
bgp_event(thread); /* bgp_event unlocks peer */ bgp_event(thread); /* bgp_event unlocks peer */
return 0;
} }
/* BGP Peer Down Cause */ /* BGP Peer Down Cause */
@ -674,7 +659,7 @@ static void bgp_graceful_restart_timer_off(struct peer *peer)
bgp_timer_set(peer); bgp_timer_set(peer);
} }
static int bgp_llgr_stale_timer_expire(struct thread *thread) static void bgp_llgr_stale_timer_expire(struct thread *thread)
{ {
struct peer_af *paf; struct peer_af *paf;
struct peer *peer; struct peer *peer;
@ -700,8 +685,6 @@ static int bgp_llgr_stale_timer_expire(struct thread *thread)
bgp_clear_stale_route(peer, afi, safi); bgp_clear_stale_route(peer, afi, safi);
bgp_graceful_restart_timer_off(peer); bgp_graceful_restart_timer_off(peer);
return 0;
} }
static void bgp_set_llgr_stale(struct peer *peer, afi_t afi, safi_t safi) static void bgp_set_llgr_stale(struct peer *peer, afi_t afi, safi_t safi)
@ -776,7 +759,7 @@ static void bgp_set_llgr_stale(struct peer *peer, afi_t afi, safi_t safi)
} }
} }
static int bgp_graceful_restart_timer_expire(struct thread *thread) static void bgp_graceful_restart_timer_expire(struct thread *thread)
{ {
struct peer *peer, *tmp_peer; struct peer *peer, *tmp_peer;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -840,11 +823,9 @@ static int bgp_graceful_restart_timer_expire(struct thread *thread)
} }
bgp_graceful_restart_timer_off(peer); bgp_graceful_restart_timer_off(peer);
return 0;
} }
static int bgp_graceful_stale_timer_expire(struct thread *thread) static void bgp_graceful_stale_timer_expire(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
afi_t afi; afi_t afi;
@ -860,12 +841,10 @@ static int bgp_graceful_stale_timer_expire(struct thread *thread)
FOREACH_AFI_SAFI_NSF (afi, safi) FOREACH_AFI_SAFI_NSF (afi, safi)
if (peer->nsf[afi][safi]) if (peer->nsf[afi][safi])
bgp_clear_stale_route(peer, afi, safi); bgp_clear_stale_route(peer, afi, safi);
return 0;
} }
/* Selection deferral timer processing function */ /* Selection deferral timer processing function */
static int bgp_graceful_deferral_timer_expire(struct thread *thread) static void bgp_graceful_deferral_timer_expire(struct thread *thread)
{ {
struct afi_safi_info *info; struct afi_safi_info *info;
afi_t afi; afi_t afi;
@ -887,7 +866,7 @@ static int bgp_graceful_deferral_timer_expire(struct thread *thread)
XFREE(MTYPE_TMP, info); XFREE(MTYPE_TMP, info);
/* Best path selection */ /* Best path selection */
return bgp_best_path_select_defer(bgp, afi, safi); bgp_best_path_select_defer(bgp, afi, safi);
} }
static bool bgp_update_delay_applicable(struct bgp *bgp) static bool bgp_update_delay_applicable(struct bgp *bgp)
@ -1135,7 +1114,7 @@ int bgp_fsm_error_subcode(int status)
} }
/* The maxmed onstartup timer expiry callback. */ /* The maxmed onstartup timer expiry callback. */
static int bgp_maxmed_onstartup_timer(struct thread *thread) static void bgp_maxmed_onstartup_timer(struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
@ -1146,8 +1125,6 @@ static int bgp_maxmed_onstartup_timer(struct thread *thread)
bgp->maxmed_onstartup_over = 1; bgp->maxmed_onstartup_over = 1;
bgp_maxmed_update(bgp); bgp_maxmed_update(bgp);
return 0;
} }
static void bgp_maxmed_onstartup_begin(struct bgp *bgp) static void bgp_maxmed_onstartup_begin(struct bgp *bgp)
@ -1179,7 +1156,7 @@ static void bgp_maxmed_onstartup_process_status_change(struct peer *peer)
} }
/* The update delay timer expiry callback. */ /* The update delay timer expiry callback. */
static int bgp_update_delay_timer(struct thread *thread) static void bgp_update_delay_timer(struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
@ -1188,12 +1165,10 @@ static int bgp_update_delay_timer(struct thread *thread)
bgp = THREAD_ARG(thread); bgp = THREAD_ARG(thread);
THREAD_OFF(bgp->t_update_delay); THREAD_OFF(bgp->t_update_delay);
bgp_update_delay_end(bgp); bgp_update_delay_end(bgp);
return 0;
} }
/* The establish wait timer expiry callback. */ /* The establish wait timer expiry callback. */
static int bgp_establish_wait_timer(struct thread *thread) static void bgp_establish_wait_timer(struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
@ -1202,8 +1177,6 @@ static int bgp_establish_wait_timer(struct thread *thread)
bgp = THREAD_ARG(thread); bgp = THREAD_ARG(thread);
THREAD_OFF(bgp->t_establish_wait); THREAD_OFF(bgp->t_establish_wait);
bgp_check_update_delay(bgp); bgp_check_update_delay(bgp);
return 0;
} }
/* Steps to begin the update delay: /* Steps to begin the update delay:
@ -1660,7 +1633,7 @@ static int bgp_stop_with_notify(struct peer *peer, uint8_t code,
* when the connection is established. A read event is triggered when the * when the connection is established. A read event is triggered when the
* connection is closed. Thus we need to cancel whichever one did not occur. * connection is closed. Thus we need to cancel whichever one did not occur.
*/ */
static int bgp_connect_check(struct thread *thread) static void bgp_connect_check(struct thread *thread)
{ {
int status; int status;
socklen_t slen; socklen_t slen;
@ -1686,7 +1659,7 @@ static int bgp_connect_check(struct thread *thread)
zlog_err("can't get sockopt for nonblocking connect: %d(%s)", zlog_err("can't get sockopt for nonblocking connect: %d(%s)",
errno, safe_strerror(errno)); errno, safe_strerror(errno));
BGP_EVENT_ADD(peer, TCP_fatal_error); BGP_EVENT_ADD(peer, TCP_fatal_error);
return -1; return;
} }
/* When status is 0 then TCP connection is established. */ /* When status is 0 then TCP connection is established. */
@ -1695,13 +1668,13 @@ static int bgp_connect_check(struct thread *thread)
BGP_EVENT_ADD(peer, TCP_connection_open_w_delay); BGP_EVENT_ADD(peer, TCP_connection_open_w_delay);
else else
BGP_EVENT_ADD(peer, TCP_connection_open); BGP_EVENT_ADD(peer, TCP_connection_open);
return 1; return;
} else { } else {
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug("%s [Event] Connect failed %d(%s)", zlog_debug("%s [Event] Connect failed %d(%s)",
peer->host, status, safe_strerror(status)); peer->host, status, safe_strerror(status));
BGP_EVENT_ADD(peer, TCP_connection_open_failed); BGP_EVENT_ADD(peer, TCP_connection_open_failed);
return 0; return;
} }
} }
@ -2542,18 +2515,15 @@ static const struct {
}; };
/* Execute event process. */ /* Execute event process. */
int bgp_event(struct thread *thread) void bgp_event(struct thread *thread)
{ {
enum bgp_fsm_events event; enum bgp_fsm_events event;
struct peer *peer; struct peer *peer;
int ret;
peer = THREAD_ARG(thread); peer = THREAD_ARG(thread);
event = THREAD_VAL(thread); event = THREAD_VAL(thread);
ret = bgp_event_update(peer, event); bgp_event_update(peer, event);
return (ret);
} }
int bgp_event_update(struct peer *peer, enum bgp_fsm_events event) int bgp_event_update(struct peer *peer, enum bgp_fsm_events event)

View File

@ -125,11 +125,11 @@
* Update FSM for peer based on whether we have valid nexthops or not. * Update FSM for peer based on whether we have valid nexthops or not.
*/ */
extern void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops); extern void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops);
extern int bgp_event(struct thread *); extern void bgp_event(struct thread *);
extern int bgp_event_update(struct peer *, enum bgp_fsm_events event); extern int bgp_event_update(struct peer *, enum bgp_fsm_events event);
extern int bgp_stop(struct peer *peer); extern int bgp_stop(struct peer *peer);
extern void bgp_timer_set(struct peer *); extern void bgp_timer_set(struct peer *);
extern int bgp_routeadv_timer(struct thread *); extern void bgp_routeadv_timer(struct thread *);
extern void bgp_fsm_change_status(struct peer *peer, int status); extern void bgp_fsm_change_status(struct peer *peer, int status);
extern const char *const peer_down_str[]; extern const char *const peer_down_str[];
extern void bgp_update_delay_end(struct bgp *); extern void bgp_update_delay_end(struct bgp *);

View File

@ -45,8 +45,8 @@
/* forward declarations */ /* forward declarations */
static uint16_t bgp_write(struct peer *); static uint16_t bgp_write(struct peer *);
static uint16_t bgp_read(struct peer *peer, int *code_p); static uint16_t bgp_read(struct peer *peer, int *code_p);
static int bgp_process_writes(struct thread *); static void bgp_process_writes(struct thread *);
static int bgp_process_reads(struct thread *); static void bgp_process_reads(struct thread *);
static bool validate_header(struct peer *); static bool validate_header(struct peer *);
/* generic i/o status codes */ /* generic i/o status codes */
@ -121,7 +121,7 @@ void bgp_reads_off(struct peer *peer)
/* /*
* Called from I/O pthread when a file descriptor has become ready for writing. * Called from I/O pthread when a file descriptor has become ready for writing.
*/ */
static int bgp_process_writes(struct thread *thread) static void bgp_process_writes(struct thread *thread)
{ {
static struct peer *peer; static struct peer *peer;
peer = THREAD_ARG(thread); peer = THREAD_ARG(thread);
@ -130,7 +130,7 @@ static int bgp_process_writes(struct thread *thread)
bool fatal = false; bool fatal = false;
if (peer->fd < 0) if (peer->fd < 0)
return -1; return;
struct frr_pthread *fpt = bgp_pth_io; struct frr_pthread *fpt = bgp_pth_io;
@ -161,8 +161,6 @@ static int bgp_process_writes(struct thread *thread)
BGP_UPDATE_GROUP_TIMER_ON(&peer->t_generate_updgrp_packets, BGP_UPDATE_GROUP_TIMER_ON(&peer->t_generate_updgrp_packets,
bgp_generate_updgrp_packets); bgp_generate_updgrp_packets);
} }
return 0;
} }
/* /*
@ -172,7 +170,7 @@ static int bgp_process_writes(struct thread *thread)
* We read as much data as possible, process as many packets as we can and * We read as much data as possible, process as many packets as we can and
* place them on peer->ibuf for secondary processing by the main thread. * place them on peer->ibuf for secondary processing by the main thread.
*/ */
static int bgp_process_reads(struct thread *thread) static void bgp_process_reads(struct thread *thread)
{ {
/* clang-format off */ /* clang-format off */
static struct peer *peer; // peer to read from static struct peer *peer; // peer to read from
@ -186,7 +184,7 @@ static int bgp_process_reads(struct thread *thread)
peer = THREAD_ARG(thread); peer = THREAD_ARG(thread);
if (peer->fd < 0 || bm->terminating) if (peer->fd < 0 || bm->terminating)
return -1; return;
struct frr_pthread *fpt = bgp_pth_io; struct frr_pthread *fpt = bgp_pth_io;
@ -271,8 +269,6 @@ static int bgp_process_reads(struct thread *thread)
thread_add_event(bm->master, bgp_process_packet, thread_add_event(bm->master, bgp_process_packet,
peer, 0, &peer->t_process_packet); peer, 0, &peer->t_process_packet);
} }
return 0;
} }
/* /*

View File

@ -342,7 +342,7 @@ static void bgp_socket_set_buffer_size(const int fd)
} }
/* Accept bgp connection. */ /* Accept bgp connection. */
static int bgp_accept(struct thread *thread) static void bgp_accept(struct thread *thread)
{ {
int bgp_sock; int bgp_sock;
int accept_sock; int accept_sock;
@ -363,7 +363,7 @@ static int bgp_accept(struct thread *thread)
flog_err_sys(EC_LIB_SOCKET, flog_err_sys(EC_LIB_SOCKET,
"[Error] BGP accept socket fd is negative: %d", "[Error] BGP accept socket fd is negative: %d",
accept_sock); accept_sock);
return -1; return;
} }
thread_add_read(bm->master, bgp_accept, listener, accept_sock, thread_add_read(bm->master, bgp_accept, listener, accept_sock,
@ -402,7 +402,7 @@ static int bgp_accept(struct thread *thread)
"[Error] BGP socket accept failed (%s); retrying", "[Error] BGP socket accept failed (%s); retrying",
safe_strerror(save_errno)); safe_strerror(save_errno));
} }
return -1; return;
} }
set_nonblocking(bgp_sock); set_nonblocking(bgp_sock);
@ -418,7 +418,7 @@ static int bgp_accept(struct thread *thread)
"[Event] Could not get instance for incoming conn from %s", "[Event] Could not get instance for incoming conn from %s",
inet_sutop(&su, buf)); inet_sutop(&su, buf));
close(bgp_sock); close(bgp_sock);
return -1; return;
} }
bgp_socket_set_buffer_size(bgp_sock); bgp_socket_set_buffer_size(bgp_sock);
@ -451,7 +451,7 @@ static int bgp_accept(struct thread *thread)
TCP_connection_open); TCP_connection_open);
} }
return 0; return;
} }
} }
@ -463,7 +463,7 @@ static int bgp_accept(struct thread *thread)
VRF_LOGNAME(vrf_lookup_by_id(bgp->vrf_id))); VRF_LOGNAME(vrf_lookup_by_id(bgp->vrf_id)));
} }
close(bgp_sock); close(bgp_sock);
return -1; return;
} }
if (CHECK_FLAG(peer1->flags, PEER_FLAG_SHUTDOWN) if (CHECK_FLAG(peer1->flags, PEER_FLAG_SHUTDOWN)
@ -474,7 +474,7 @@ static int bgp_accept(struct thread *thread)
inet_sutop(&su, buf), bgp->name_pretty, bgp->as, inet_sutop(&su, buf), bgp->name_pretty, bgp->as,
VRF_LOGNAME(vrf_lookup_by_id(bgp->vrf_id))); VRF_LOGNAME(vrf_lookup_by_id(bgp->vrf_id)));
close(bgp_sock); close(bgp_sock);
return -1; return;
} }
/* /*
@ -489,7 +489,7 @@ static int bgp_accept(struct thread *thread)
"[Event] Closing incoming conn for %s (%p) state %d", "[Event] Closing incoming conn for %s (%p) state %d",
peer1->host, peer1, peer1->status); peer1->host, peer1, peer1->status);
close(bgp_sock); close(bgp_sock);
return -1; return;
} }
/* Check that at least one AF is activated for the peer. */ /* Check that at least one AF is activated for the peer. */
@ -499,7 +499,7 @@ static int bgp_accept(struct thread *thread)
"%s - incoming conn rejected - no AF activated for peer", "%s - incoming conn rejected - no AF activated for peer",
peer1->host); peer1->host);
close(bgp_sock); close(bgp_sock);
return -1; return;
} }
/* Do not try to reconnect if the peer reached maximum /* Do not try to reconnect if the peer reached maximum
@ -512,7 +512,7 @@ static int bgp_accept(struct thread *thread)
"[Event] Incoming BGP connection rejected from %s due to maximum-prefix or shutdown", "[Event] Incoming BGP connection rejected from %s due to maximum-prefix or shutdown",
peer1->host); peer1->host);
close(bgp_sock); close(bgp_sock);
return -1; return;
} }
if (bgp_debug_neighbor_events(peer1)) if (bgp_debug_neighbor_events(peer1))
@ -600,8 +600,6 @@ static int bgp_accept(struct thread *thread)
* massage the event system to make things happy * massage the event system to make things happy
*/ */
bgp_nht_interface_events(peer); bgp_nht_interface_events(peer);
return 0;
} }
/* BGP socket bind. */ /* BGP socket bind. */

View File

@ -54,7 +54,7 @@ static void register_zebra_rnh(struct bgp_nexthop_cache *bnc,
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc, static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc,
int is_bgp_static_route); int is_bgp_static_route);
static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p); static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p);
static int bgp_nht_ifp_initial(struct thread *thread); static void bgp_nht_ifp_initial(struct thread *thread);
static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc) static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc)
{ {
@ -608,14 +608,14 @@ void bgp_nht_ifp_down(struct interface *ifp)
bgp_nht_ifp_handle(ifp, false); bgp_nht_ifp_handle(ifp, false);
} }
static int bgp_nht_ifp_initial(struct thread *thread) static void bgp_nht_ifp_initial(struct thread *thread)
{ {
ifindex_t ifindex = THREAD_VAL(thread); ifindex_t ifindex = THREAD_VAL(thread);
struct bgp *bgp = THREAD_ARG(thread); struct bgp *bgp = THREAD_ARG(thread);
struct interface *ifp = if_lookup_by_index(ifindex, bgp->vrf_id); struct interface *ifp = if_lookup_by_index(ifindex, bgp->vrf_id);
if (!ifp) if (!ifp)
return 0; return;
if (BGP_DEBUG(nht, NHT)) if (BGP_DEBUG(nht, NHT))
zlog_debug( zlog_debug(
@ -626,8 +626,6 @@ static int bgp_nht_ifp_initial(struct thread *thread)
bgp_nht_ifp_up(ifp); bgp_nht_ifp_up(ifp);
else else
bgp_nht_ifp_down(ifp); bgp_nht_ifp_down(ifp);
return 0;
} }
/* /*

View File

@ -386,7 +386,7 @@ static void bgp_write_proceed_actions(struct peer *peer)
* update group a peer belongs to, encode this information into packets, and * update group a peer belongs to, encode this information into packets, and
* enqueue the packets onto the peer's output buffer. * enqueue the packets onto the peer's output buffer.
*/ */
int bgp_generate_updgrp_packets(struct thread *thread) void bgp_generate_updgrp_packets(struct thread *thread)
{ {
struct peer *peer = THREAD_ARG(thread); struct peer *peer = THREAD_ARG(thread);
@ -407,14 +407,14 @@ int bgp_generate_updgrp_packets(struct thread *thread)
* update-delay processing). * update-delay processing).
*/ */
if (!peer_established(peer)) if (!peer_established(peer))
return 0; return;
if ((peer->bgp->main_peers_update_hold) if ((peer->bgp->main_peers_update_hold)
|| bgp_update_delay_active(peer->bgp)) || bgp_update_delay_active(peer->bgp))
return 0; return;
if (peer->t_routeadv) if (peer->t_routeadv)
return 0; return;
do { do {
enum bgp_af_index index; enum bgp_af_index index;
@ -541,8 +541,6 @@ int bgp_generate_updgrp_packets(struct thread *thread)
bgp_writes_on(peer); bgp_writes_on(peer);
bgp_write_proceed_actions(peer); bgp_write_proceed_actions(peer);
return 0;
} }
/* /*
@ -1540,7 +1538,7 @@ static int bgp_keepalive_receive(struct peer *peer, bgp_size_t size)
return Receive_KEEPALIVE_message; return Receive_KEEPALIVE_message;
} }
static int bgp_refresh_stalepath_timer_expire(struct thread *thread) static void bgp_refresh_stalepath_timer_expire(struct thread *thread)
{ {
struct peer_af *paf; struct peer_af *paf;
@ -1560,8 +1558,6 @@ static int bgp_refresh_stalepath_timer_expire(struct thread *thread)
peer->host, afi2str(afi), safi2str(safi)); peer->host, afi2str(afi), safi2str(safi));
bgp_timer_set(peer); bgp_timer_set(peer);
return 0;
} }
/** /**
@ -2573,7 +2569,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size)
* @param thread * @param thread
* @return 0 * @return 0
*/ */
int bgp_process_packet(struct thread *thread) void bgp_process_packet(struct thread *thread)
{ {
/* Yes first of all get peer pointer. */ /* Yes first of all get peer pointer. */
struct peer *peer; // peer struct peer *peer; // peer
@ -2588,7 +2584,7 @@ int bgp_process_packet(struct thread *thread)
/* Guard against scheduled events that occur after peer deletion. */ /* Guard against scheduled events that occur after peer deletion. */
if (peer->status == Deleted || peer->status == Clearing) if (peer->status == Deleted || peer->status == Clearing)
return 0; return;
unsigned int processed = 0; unsigned int processed = 0;
@ -2602,7 +2598,7 @@ int bgp_process_packet(struct thread *thread)
} }
if (peer->curr == NULL) // no packets to process, hmm... if (peer->curr == NULL) // no packets to process, hmm...
return 0; return;
/* skip the marker and copy the packet length */ /* skip the marker and copy the packet length */
stream_forward_getp(peer->curr, BGP_MARKER_SIZE); stream_forward_getp(peer->curr, BGP_MARKER_SIZE);
@ -2732,8 +2728,6 @@ int bgp_process_packet(struct thread *thread)
&peer->t_process_packet); &peer->t_process_packet);
} }
} }
return 0;
} }
/* Send EOR when routes are processed by selection deferral timer */ /* Send EOR when routes are processed by selection deferral timer */
@ -2752,7 +2746,7 @@ void bgp_send_delayed_eor(struct bgp *bgp)
* having the io pthread try to enqueue fsm events or mess with the peer * having the io pthread try to enqueue fsm events or mess with the peer
* struct. * struct.
*/ */
int bgp_packet_process_error(struct thread *thread) void bgp_packet_process_error(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
int code; int code;
@ -2777,6 +2771,4 @@ int bgp_packet_process_error(struct thread *thread)
} }
bgp_event_update(peer, code); bgp_event_update(peer, code);
return 0;
} }

View File

@ -79,12 +79,12 @@ extern void bgp_check_update_delay(struct bgp *);
extern int bgp_packet_set_marker(struct stream *s, uint8_t type); extern int bgp_packet_set_marker(struct stream *s, uint8_t type);
extern void bgp_packet_set_size(struct stream *s); extern void bgp_packet_set_size(struct stream *s);
extern int bgp_generate_updgrp_packets(struct thread *); extern void bgp_generate_updgrp_packets(struct thread *);
extern int bgp_process_packet(struct thread *); extern void bgp_process_packet(struct thread *);
extern void bgp_send_delayed_eor(struct bgp *bgp); extern void bgp_send_delayed_eor(struct bgp *bgp);
/* Task callback to handle socket error encountered in the io pthread */ /* Task callback to handle socket error encountered in the io pthread */
int bgp_packet_process_error(struct thread *thread); void bgp_packet_process_error(struct thread *thread);
#endif /* _QUAGGA_BGP_PACKET_H */ #endif /* _QUAGGA_BGP_PACKET_H */

View File

@ -2402,7 +2402,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
return true; return true;
} }
static int bgp_route_select_timer_expire(struct thread *thread) static void bgp_route_select_timer_expire(struct thread *thread)
{ {
struct afi_safi_info *info; struct afi_safi_info *info;
afi_t afi; afi_t afi;
@ -2423,7 +2423,7 @@ static int bgp_route_select_timer_expire(struct thread *thread)
XFREE(MTYPE_TMP, info); XFREE(MTYPE_TMP, info);
/* Best path selection */ /* Best path selection */
return bgp_best_path_select_defer(bgp, afi, safi); bgp_best_path_select_defer(bgp, afi, safi);
} }
void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest, void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
@ -3354,7 +3354,7 @@ void bgp_add_eoiu_mark(struct bgp *bgp)
work_queue_add(bgp->process_queue, pqnode); work_queue_add(bgp->process_queue, pqnode);
} }
static int bgp_maximum_prefix_restart_timer(struct thread *thread) static void bgp_maximum_prefix_restart_timer(struct thread *thread)
{ {
struct peer *peer; struct peer *peer;
@ -3368,8 +3368,6 @@ static int bgp_maximum_prefix_restart_timer(struct thread *thread)
if ((peer_clear(peer, NULL) < 0) && bgp_debug_neighbor_events(peer)) if ((peer_clear(peer, NULL) < 0) && bgp_debug_neighbor_events(peer))
zlog_debug("%s: %s peer_clear failed", __func__, peer->host); zlog_debug("%s: %s peer_clear failed", __func__, peer->host);
return 0;
} }
static uint32_t bgp_filtered_routes_count(struct peer *peer, afi_t afi, static uint32_t bgp_filtered_routes_count(struct peer *peer, afi_t afi,
@ -4710,7 +4708,7 @@ void bgp_stop_announce_route_timer(struct peer_af *paf)
* Callback that is invoked when the route announcement timer for a * Callback that is invoked when the route announcement timer for a
* peer_af expires. * peer_af expires.
*/ */
static int bgp_announce_route_timer_expired(struct thread *t) static void bgp_announce_route_timer_expired(struct thread *t)
{ {
struct peer_af *paf; struct peer_af *paf;
struct peer *peer; struct peer *peer;
@ -4719,17 +4717,15 @@ static int bgp_announce_route_timer_expired(struct thread *t)
peer = paf->peer; peer = paf->peer;
if (!peer_established(peer)) if (!peer_established(peer))
return 0; return;
if (!peer->afc_nego[paf->afi][paf->safi]) if (!peer->afc_nego[paf->afi][paf->safi])
return 0; return;
peer_af_announce_route(paf, 1); peer_af_announce_route(paf, 1);
/* Notify BGP conditional advertisement scanner percess */ /* Notify BGP conditional advertisement scanner percess */
peer->advmap_config_change[paf->afi][paf->safi] = true; peer->advmap_config_change[paf->afi][paf->safi] = true;
return 0;
} }
/* /*
@ -4879,7 +4875,7 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi,
* Without splitting the full job into several part, * Without splitting the full job into several part,
* vtysh waits for the job to finish before responding to a BGP command * vtysh waits for the job to finish before responding to a BGP command
*/ */
static int bgp_soft_reconfig_table_task(struct thread *thread) static void bgp_soft_reconfig_table_task(struct thread *thread)
{ {
uint32_t iter, max_iter; uint32_t iter, max_iter;
int ret; int ret;
@ -4933,7 +4929,7 @@ static int bgp_soft_reconfig_table_task(struct thread *thread)
&table->soft_reconfig_peers); &table->soft_reconfig_peers);
bgp_soft_reconfig_table_flag( bgp_soft_reconfig_table_flag(
table, false); table, false);
return 0; return;
} }
} }
} }
@ -4947,7 +4943,7 @@ static int bgp_soft_reconfig_table_task(struct thread *thread)
table->soft_reconfig_init = false; table->soft_reconfig_init = false;
thread_add_event(bm->master, bgp_soft_reconfig_table_task, thread_add_event(bm->master, bgp_soft_reconfig_table_task,
table, 0, &table->soft_reconfig_thread); table, 0, &table->soft_reconfig_thread);
return 0; return;
} }
/* we're done, clean up the background iteration context info and /* we're done, clean up the background iteration context info and
schedule route annoucement schedule route annoucement
@ -4958,8 +4954,6 @@ static int bgp_soft_reconfig_table_task(struct thread *thread)
} }
list_delete(&table->soft_reconfig_peers); list_delete(&table->soft_reconfig_peers);
return 0;
} }
@ -12854,7 +12848,7 @@ static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
} }
} }
static int bgp_table_stats_walker(struct thread *t) static void bgp_table_stats_walker(struct thread *t)
{ {
struct bgp_dest *dest, *ndest; struct bgp_dest *dest, *ndest;
struct bgp_dest *top; struct bgp_dest *top;
@ -12862,7 +12856,7 @@ static int bgp_table_stats_walker(struct thread *t)
unsigned int space = 0; unsigned int space = 0;
if (!(top = bgp_table_top(ts->table))) if (!(top = bgp_table_top(ts->table)))
return 0; return;
switch (ts->table->afi) { switch (ts->table->afi) {
case AFI_IP: case AFI_IP:
@ -12875,7 +12869,7 @@ static int bgp_table_stats_walker(struct thread *t)
space = EVPN_ROUTE_PREFIXLEN; space = EVPN_ROUTE_PREFIXLEN;
break; break;
default: default:
return 0; return;
} }
ts->counts[BGP_STATS_MAXBITLEN] = space; ts->counts[BGP_STATS_MAXBITLEN] = space;
@ -12898,8 +12892,6 @@ static int bgp_table_stats_walker(struct thread *t)
bgp_table_stats_rn(dest, top, ts, space); bgp_table_stats_rn(dest, top, ts, space);
} }
} }
return 0;
} }
static void bgp_table_stats_all(struct vty *vty, afi_t afi, safi_t safi, static void bgp_table_stats_all(struct vty *vty, afi_t afi, safi_t safi,
@ -13217,7 +13209,7 @@ static void bgp_peer_count_proc(struct bgp_dest *rn, struct peer_pcounts *pc)
} }
} }
static int bgp_peer_count_walker(struct thread *t) static void bgp_peer_count_walker(struct thread *t)
{ {
struct bgp_dest *rn, *rm; struct bgp_dest *rn, *rm;
const struct bgp_table *table; const struct bgp_table *table;
@ -13237,8 +13229,6 @@ static int bgp_peer_count_walker(struct thread *t)
} else } else
for (rn = bgp_table_top(pc->table); rn; rn = bgp_route_next(rn)) for (rn = bgp_table_top(pc->table); rn; rn = bgp_route_next(rn))
bgp_peer_count_proc(rn, pc); bgp_peer_count_proc(rn, pc);
return 0;
} }
static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi, static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi,

View File

@ -4042,13 +4042,11 @@ static void bgp_route_map_process_update_cb(char *rmap_name)
vpn_policy_routemap_event(rmap_name); vpn_policy_routemap_event(rmap_name);
} }
int bgp_route_map_update_timer(struct thread *thread) void bgp_route_map_update_timer(struct thread *thread)
{ {
bm->t_rmap_update = NULL; bm->t_rmap_update = NULL;
route_map_walk_update_list(bgp_route_map_process_update_cb); route_map_walk_update_list(bgp_route_map_process_update_cb);
return 0;
} }
static void bgp_route_map_mark_update(const char *rmap_name) static void bgp_route_map_mark_update(const char *rmap_name)

View File

@ -357,7 +357,7 @@ static struct prefix *pfx_record_to_prefix(struct pfx_record *record)
return prefix; return prefix;
} }
static int bgpd_sync_callback(struct thread *thread) static void bgpd_sync_callback(struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
struct listnode *node; struct listnode *node;
@ -375,13 +375,13 @@ static int bgpd_sync_callback(struct thread *thread)
atomic_store_explicit(&rtr_update_overflow, 0, atomic_store_explicit(&rtr_update_overflow, 0,
memory_order_seq_cst); memory_order_seq_cst);
revalidate_all_routes(); revalidate_all_routes();
return 0; return;
} }
retval = read(socket, &rec, sizeof(struct pfx_record)); retval = read(socket, &rec, sizeof(struct pfx_record));
if (retval != sizeof(struct pfx_record)) { if (retval != sizeof(struct pfx_record)) {
RPKI_DEBUG("Could not read from socket"); RPKI_DEBUG("Could not read from socket");
return retval; return;
} }
/* RTR-Server crashed/terminated, let's handle and switch /* RTR-Server crashed/terminated, let's handle and switch
@ -389,7 +389,7 @@ static int bgpd_sync_callback(struct thread *thread)
*/ */
if (rec.socket && rec.socket->state == RTR_ERROR_FATAL) { if (rec.socket && rec.socket->state == RTR_ERROR_FATAL) {
reset(true); reset(true);
return 0; return;
} }
prefix = pfx_record_to_prefix(&rec); prefix = pfx_record_to_prefix(&rec);
@ -421,7 +421,6 @@ static int bgpd_sync_callback(struct thread *thread)
} }
prefix_free(&prefix); prefix_free(&prefix);
return 0;
} }
static void revalidate_bgp_node(struct bgp_dest *bgp_dest, afi_t afi, static void revalidate_bgp_node(struct bgp_dest *bgp_dest, afi_t afi,

View File

@ -1157,7 +1157,7 @@ bool update_subgroup_check_merge(struct update_subgroup *subgrp,
/* /*
* update_subgroup_merge_check_thread_cb * update_subgroup_merge_check_thread_cb
*/ */
static int update_subgroup_merge_check_thread_cb(struct thread *thread) static void update_subgroup_merge_check_thread_cb(struct thread *thread)
{ {
struct update_subgroup *subgrp; struct update_subgroup *subgrp;
@ -1166,7 +1166,6 @@ static int update_subgroup_merge_check_thread_cb(struct thread *thread)
subgrp->t_merge_check = NULL; subgrp->t_merge_check = NULL;
update_subgroup_check_merge(subgrp, "triggered merge check"); update_subgroup_check_merge(subgrp, "triggered merge check");
return 0;
} }
/* /*
@ -1803,7 +1802,7 @@ update_group_default_originate_route_map_walkcb(struct update_group *updgrp,
return UPDWALK_CONTINUE; return UPDWALK_CONTINUE;
} }
int update_group_refresh_default_originate_route_map(struct thread *thread) void update_group_refresh_default_originate_route_map(struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
char reason[] = "refresh default-originate route-map"; char reason[] = "refresh default-originate route-map";
@ -1813,8 +1812,6 @@ int update_group_refresh_default_originate_route_map(struct thread *thread)
reason); reason);
thread_cancel(&bgp->t_rmap_def_originate_eval); thread_cancel(&bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp); bgp_unlock(bgp);
return 0;
} }
/* /*

View File

@ -375,7 +375,7 @@ extern void update_group_af_walk(struct bgp *bgp, afi_t afi, safi_t safi,
updgrp_walkcb cb, void *ctx); updgrp_walkcb cb, void *ctx);
extern void update_group_walk(struct bgp *bgp, updgrp_walkcb cb, void *ctx); extern void update_group_walk(struct bgp *bgp, updgrp_walkcb cb, void *ctx);
extern void update_group_periodic_merge(struct bgp *bgp); extern void update_group_periodic_merge(struct bgp *bgp);
extern int extern void
update_group_refresh_default_originate_route_map(struct thread *thread); update_group_refresh_default_originate_route_map(struct thread *thread);
extern void update_group_start_advtimer(struct bgp *bgp); extern void update_group_start_advtimer(struct bgp *bgp);

View File

@ -316,7 +316,7 @@ static void updgrp_show_adj(struct bgp *bgp, afi_t afi, safi_t safi,
update_group_af_walk(bgp, afi, safi, updgrp_show_adj_walkcb, &ctx); update_group_af_walk(bgp, afi, safi, updgrp_show_adj_walkcb, &ctx);
} }
static int subgroup_coalesce_timer(struct thread *thread) static void subgroup_coalesce_timer(struct thread *thread)
{ {
struct update_subgroup *subgrp; struct update_subgroup *subgrp;
struct bgp *bgp; struct bgp *bgp;
@ -351,8 +351,6 @@ static int subgroup_coalesce_timer(struct thread *thread)
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
} }
} }
return 0;
} }
static int update_group_announce_walkcb(struct update_group *updgrp, void *arg) static int update_group_announce_walkcb(struct update_group *updgrp, void *arg)

View File

@ -1019,7 +1019,7 @@ static bool bgp_tm_chunk_obtained;
static uint32_t bgp_tm_min, bgp_tm_max, bgp_tm_chunk_size; static uint32_t bgp_tm_min, bgp_tm_max, bgp_tm_chunk_size;
struct bgp *bgp_tm_bgp; struct bgp *bgp_tm_bgp;
static int bgp_zebra_tm_connect(struct thread *t) static void bgp_zebra_tm_connect(struct thread *t)
{ {
struct zclient *zclient; struct zclient *zclient;
int delay = 10, ret = 0; int delay = 10, ret = 0;
@ -1050,7 +1050,6 @@ static int bgp_zebra_tm_connect(struct thread *t)
} }
thread_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay, thread_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay,
&bgp_tm_thread_connect); &bgp_tm_thread_connect);
return 0;
} }
bool bgp_zebra_tm_chunk_obtained(void) bool bgp_zebra_tm_chunk_obtained(void)

View File

@ -3044,14 +3044,12 @@ int peer_group_bind(struct bgp *bgp, union sockunion *su, struct peer *peer,
return 0; return 0;
} }
static int bgp_startup_timer_expire(struct thread *thread) static void bgp_startup_timer_expire(struct thread *thread)
{ {
struct bgp *bgp; struct bgp *bgp;
bgp = THREAD_ARG(thread); bgp = THREAD_ARG(thread);
bgp->t_startup = NULL; bgp->t_startup = NULL;
return 0;
} }
/* /*

View File

@ -2226,7 +2226,7 @@ extern int peer_ttl_security_hops_unset(struct peer *);
extern void peer_tx_shutdown_message_set(struct peer *, const char *msg); extern void peer_tx_shutdown_message_set(struct peer *, const char *msg);
extern void peer_tx_shutdown_message_unset(struct peer *); extern void peer_tx_shutdown_message_unset(struct peer *);
extern int bgp_route_map_update_timer(struct thread *thread); extern void bgp_route_map_update_timer(struct thread *thread);
extern void bgp_route_map_terminate(void); extern void bgp_route_map_terminate(void);
extern int peer_cmp(struct peer *p1, struct peer *p2); extern int peer_cmp(struct peer *p1, struct peer *p2);

View File

@ -2372,7 +2372,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
* quagga lib/thread.h says this must return int even though * quagga lib/thread.h says this must return int even though
* it doesn't do anything with the return value * it doesn't do anything with the return value
*/ */
static int rfapiWithdrawTimerVPN(struct thread *t) static void rfapiWithdrawTimerVPN(struct thread *t)
{ {
struct rfapi_withdraw *wcb = t->arg; struct rfapi_withdraw *wcb = t->arg;
struct bgp_path_info *bpi = wcb->info; struct bgp_path_info *bpi = wcb->info;
@ -2385,13 +2385,13 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: NULL BGP pointer, assume shutdown race condition!!!", "%s: NULL BGP pointer, assume shutdown race condition!!!",
__func__); __func__);
return 0; return;
} }
if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) {
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: BGP delete in progress, assume shutdown race condition!!!", "%s: BGP delete in progress, assume shutdown race condition!!!",
__func__); __func__);
return 0; return;
} }
assert(wcb->node); assert(wcb->node);
assert(bpi); assert(bpi);
@ -2503,7 +2503,6 @@ done:
RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, 1 + wcb->lockoffset); RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, 1 + wcb->lockoffset);
agg_unlock_node(wcb->node); /* decr ref count */ agg_unlock_node(wcb->node); /* decr ref count */
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
return 0;
} }
/* /*
@ -2674,7 +2673,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
return 0; return 0;
} }
static int rfapiWithdrawTimerEncap(struct thread *t) static void rfapiWithdrawTimerEncap(struct thread *t)
{ {
struct rfapi_withdraw *wcb = t->arg; struct rfapi_withdraw *wcb = t->arg;
struct bgp_path_info *bpi = wcb->info; struct bgp_path_info *bpi = wcb->info;
@ -2748,7 +2747,6 @@ done:
agg_unlock_node(wcb->node); /* decr ref count */ agg_unlock_node(wcb->node); /* decr ref count */
XFREE(MTYPE_RFAPI_WITHDRAW, wcb); XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
skiplist_free(vpn_node_sl); skiplist_free(vpn_node_sl);
return 0;
} }
@ -2760,7 +2758,7 @@ static void
rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
struct agg_node *rn, struct bgp_path_info *bpi, struct agg_node *rn, struct bgp_path_info *bpi,
afi_t afi, safi_t safi, afi_t afi, safi_t safi,
int (*timer_service_func)(struct thread *)) void (*timer_service_func)(struct thread *))
{ {
uint32_t lifetime; uint32_t lifetime;
struct rfapi_withdraw *wcb; struct rfapi_withdraw *wcb;
@ -4062,7 +4060,7 @@ static void rfapiProcessPeerDownRt(struct peer *peer,
struct agg_node *rn; struct agg_node *rn;
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
struct agg_table *rt; struct agg_table *rt;
int (*timer_service_func)(struct thread *); void (*timer_service_func)(struct thread *);
assert(afi == AFI_IP || afi == AFI_IP6); assert(afi == AFI_IP || afi == AFI_IP6);

View File

@ -126,8 +126,6 @@ extern void rfapiCheckRefcount(struct agg_node *rn, safi_t safi,
extern int rfapiHasNonRemovedRoutes(struct agg_node *rn); extern int rfapiHasNonRemovedRoutes(struct agg_node *rn);
extern int rfapiProcessDeferredClose(struct thread *t);
extern int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p); extern int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p);
extern void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p); extern void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p);

View File

@ -731,7 +731,7 @@ void rfapiMonitorResponseRemovalOn(struct bgp *bgp)
bgp->rfapi_cfg->flags &= ~BGP_VNC_CONFIG_RESPONSE_REMOVAL_DISABLE; bgp->rfapi_cfg->flags &= ~BGP_VNC_CONFIG_RESPONSE_REMOVAL_DISABLE;
} }
static int rfapiMonitorTimerExpire(struct thread *t) static void rfapiMonitorTimerExpire(struct thread *t)
{ {
struct rfapi_monitor_vpn *m = t->arg; struct rfapi_monitor_vpn *m = t->arg;
@ -740,8 +740,6 @@ static int rfapiMonitorTimerExpire(struct thread *t)
/* delete the monitor */ /* delete the monitor */
rfapiMonitorDel(bgp_get_default(), m->rfd, &m->p); rfapiMonitorDel(bgp_get_default(), m->rfd, &m->p);
return 0;
} }
static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m) static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m)
@ -1041,7 +1039,7 @@ void rfapiMonitorMovedUp(struct rfapi_import_table *import_table,
} }
} }
static int rfapiMonitorEthTimerExpire(struct thread *t) static void rfapiMonitorEthTimerExpire(struct thread *t)
{ {
struct rfapi_monitor_eth *m = t->arg; struct rfapi_monitor_eth *m = t->arg;
@ -1052,7 +1050,6 @@ static int rfapiMonitorEthTimerExpire(struct thread *t)
rfapiMonitorEthDel(bgp_get_default(), m->rfd, &m->macaddr, rfapiMonitorEthDel(bgp_get_default(), m->rfd, &m->macaddr,
m->logical_net_id); m->logical_net_id);
return 0;
} }
static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m) static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m)

View File

@ -291,7 +291,7 @@ struct rfapi_rib_tcb {
/* /*
* remove route from rib * remove route from rib
*/ */
static int rfapiRibExpireTimer(struct thread *t) static void rfapiRibExpireTimer(struct thread *t)
{ {
struct rfapi_rib_tcb *tcb = t->arg; struct rfapi_rib_tcb *tcb = t->arg;
@ -328,8 +328,6 @@ static int rfapiRibExpireTimer(struct thread *t)
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
RFAPI_RIB_CHECK_COUNTS(1, 0); RFAPI_RIB_CHECK_COUNTS(1, 0);
return 0;
} }
static void rfapiRibStartTimer(struct rfapi_descriptor *rfd, static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,

View File

@ -1728,7 +1728,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
bgp_attr_unintern(&iattr); bgp_attr_unintern(&iattr);
} }
static int vncExportWithdrawTimer(struct thread *t) static void vncExportWithdrawTimer(struct thread *t)
{ {
struct vnc_export_info *eti = t->arg; struct vnc_export_info *eti = t->arg;
const struct prefix *p = agg_node_get_prefix(eti->node); const struct prefix *p = agg_node_get_prefix(eti->node);
@ -1747,8 +1747,6 @@ static int vncExportWithdrawTimer(struct thread *t)
* Free the eti * Free the eti
*/ */
vnc_eti_delete(eti); vnc_eti_delete(eti);
return 0;
} }
/* /*

View File

@ -251,13 +251,13 @@ void eigrp_distribute_update_all_wrapper(struct access_list *notused)
* *
* @param[in] thread current execution thread timer is associated with * @param[in] thread current execution thread timer is associated with
* *
* @return int always returns 0 * @return void
* *
* @par * @par
* Called when 10sec waiting time expire and * Called when 10sec waiting time expire and
* executes Graceful restart for whole process * executes Graceful restart for whole process
*/ */
int eigrp_distribute_timer_process(struct thread *thread) void eigrp_distribute_timer_process(struct thread *thread)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
@ -265,8 +265,6 @@ int eigrp_distribute_timer_process(struct thread *thread)
/* execute GR for whole process */ /* execute GR for whole process */
eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL); eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL);
return 0;
} }
/* /*
@ -274,13 +272,13 @@ int eigrp_distribute_timer_process(struct thread *thread)
* *
* @param[in] thread current execution thread timer is associated with * @param[in] thread current execution thread timer is associated with
* *
* @return int always returns 0 * @return void
* *
* @par * @par
* Called when 10sec waiting time expire and * Called when 10sec waiting time expire and
* executes Graceful restart for interface * executes Graceful restart for interface
*/ */
int eigrp_distribute_timer_interface(struct thread *thread) void eigrp_distribute_timer_interface(struct thread *thread)
{ {
struct eigrp_interface *ei; struct eigrp_interface *ei;
@ -289,6 +287,4 @@ int eigrp_distribute_timer_interface(struct thread *thread)
/* execute GR for interface */ /* execute GR for interface */
eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL); eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL);
return 0;
} }

View File

@ -38,7 +38,7 @@ extern void eigrp_distribute_update(struct distribute_ctx *ctx,
extern void eigrp_distribute_update_interface(struct interface *ifp); extern void eigrp_distribute_update_interface(struct interface *ifp);
extern void eigrp_distribute_update_all(struct prefix_list *plist); extern void eigrp_distribute_update_all(struct prefix_list *plist);
extern void eigrp_distribute_update_all_wrapper(struct access_list *alist); extern void eigrp_distribute_update_all_wrapper(struct access_list *alist);
extern int eigrp_distribute_timer_process(struct thread *thread); extern void eigrp_distribute_timer_process(struct thread *thread);
extern int eigrp_distribute_timer_interface(struct thread *thread); extern void eigrp_distribute_timer_interface(struct thread *thread);
#endif /* EIGRPD_EIGRP_FILTER_H_ */ #endif /* EIGRPD_EIGRP_FILTER_H_ */

View File

@ -74,14 +74,14 @@ static const struct message eigrp_general_tlv_type_str[] = {
* *
* @param[in] thread current execution thread timer is associated with * @param[in] thread current execution thread timer is associated with
* *
* @return int always returns 0 * @return void
* *
* @par * @par
* Called once per "hello" time interval, default 5 seconds * Called once per "hello" time interval, default 5 seconds
* Sends hello packet via multicast for all interfaces eigrp * Sends hello packet via multicast for all interfaces eigrp
* is configured for * is configured for
*/ */
int eigrp_hello_timer(struct thread *thread) void eigrp_hello_timer(struct thread *thread)
{ {
struct eigrp_interface *ei; struct eigrp_interface *ei;
@ -97,8 +97,6 @@ int eigrp_hello_timer(struct thread *thread)
/* Hello timer set. */ /* Hello timer set. */
thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello, thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello,
&ei->t_hello); &ei->t_hello);
return 0;
} }
/** /**

View File

@ -189,7 +189,7 @@ void eigrp_nbr_delete(struct eigrp_neighbor *nbr)
XFREE(MTYPE_EIGRP_NEIGHBOR, nbr); XFREE(MTYPE_EIGRP_NEIGHBOR, nbr);
} }
int holddown_timer_expired(struct thread *thread) void holddown_timer_expired(struct thread *thread)
{ {
struct eigrp_neighbor *nbr = THREAD_ARG(thread); struct eigrp_neighbor *nbr = THREAD_ARG(thread);
struct eigrp *eigrp = nbr->ei->eigrp; struct eigrp *eigrp = nbr->ei->eigrp;
@ -198,8 +198,6 @@ int holddown_timer_expired(struct thread *thread)
ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id));
nbr->state = EIGRP_NEIGHBOR_DOWN; nbr->state = EIGRP_NEIGHBOR_DOWN;
eigrp_nbr_delete(nbr); eigrp_nbr_delete(nbr);
return 0;
} }
uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *nbr) uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *nbr)

View File

@ -39,7 +39,7 @@ extern struct eigrp_neighbor *eigrp_nbr_get(struct eigrp_interface *ei,
extern struct eigrp_neighbor *eigrp_nbr_new(struct eigrp_interface *ei); extern struct eigrp_neighbor *eigrp_nbr_new(struct eigrp_interface *ei);
extern void eigrp_nbr_delete(struct eigrp_neighbor *neigh); extern void eigrp_nbr_delete(struct eigrp_neighbor *neigh);
extern int holddown_timer_expired(struct thread *thread); extern void holddown_timer_expired(struct thread *thread);
extern int eigrp_neighborship_check(struct eigrp_neighbor *neigh, extern int eigrp_neighborship_check(struct eigrp_neighbor *neigh,
struct TLV_Parameter_Type *tlv); struct TLV_Parameter_Type *tlv);

View File

@ -35,7 +35,7 @@ extern int eigrp_if_ipmulticast(struct eigrp *, struct prefix *, unsigned int);
extern int eigrp_network_set(struct eigrp *eigrp, struct prefix *p); extern int eigrp_network_set(struct eigrp *eigrp, struct prefix *p);
extern int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p); extern int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p);
extern int eigrp_hello_timer(struct thread *); extern void eigrp_hello_timer(struct thread *thread);
extern void eigrp_if_update(struct interface *); extern void eigrp_if_update(struct interface *);
extern int eigrp_if_add_allspfrouters(struct eigrp *, struct prefix *, extern int eigrp_if_add_allspfrouters(struct eigrp *, struct prefix *,
unsigned int); unsigned int);

View File

@ -320,7 +320,7 @@ int eigrp_check_sha256_digest(struct stream *s,
return 1; return 1;
} }
int eigrp_write(struct thread *thread) void eigrp_write(struct thread *thread)
{ {
struct eigrp *eigrp = THREAD_ARG(thread); struct eigrp *eigrp = THREAD_ARG(thread);
struct eigrp_header *eigrph; struct eigrp_header *eigrph;
@ -471,12 +471,10 @@ out:
thread_add_write(master, eigrp_write, eigrp, eigrp->fd, thread_add_write(master, eigrp_write, eigrp, eigrp->fd,
&eigrp->t_write); &eigrp->t_write);
} }
return 0;
} }
/* Starting point of packet process function. */ /* Starting point of packet process function. */
int eigrp_read(struct thread *thread) void eigrp_read(struct thread *thread)
{ {
int ret; int ret;
struct stream *ibuf; struct stream *ibuf;
@ -500,7 +498,7 @@ int eigrp_read(struct thread *thread)
if (!(ibuf = eigrp_recv_packet(eigrp, eigrp->fd, &ifp, eigrp->ibuf))) { if (!(ibuf = eigrp_recv_packet(eigrp, eigrp->fd, &ifp, eigrp->ibuf))) {
/* This raw packet is known to be at least as big as its IP /* This raw packet is known to be at least as big as its IP
* header. */ * header. */
return -1; return;
} }
/* Note that there should not be alignment problems with this assignment /* Note that there should not be alignment problems with this assignment
@ -531,7 +529,7 @@ int eigrp_read(struct thread *thread)
eigrp->vrf_id); eigrp->vrf_id);
if (c == NULL) if (c == NULL)
return 0; return;
ifp = c->ifp; ifp = c->ifp;
} }
@ -546,7 +544,7 @@ int eigrp_read(struct thread *thread)
must remain very accurate in doing this. must remain very accurate in doing this.
*/ */
if (!ei) if (!ei)
return 0; return;
/* Self-originated packet should be discarded silently. */ /* Self-originated packet should be discarded silently. */
if (eigrp_if_lookup_by_local_addr(eigrp, NULL, iph->ip_src) if (eigrp_if_lookup_by_local_addr(eigrp, NULL, iph->ip_src)
@ -555,7 +553,7 @@ int eigrp_read(struct thread *thread)
zlog_debug( zlog_debug(
"eigrp_read[%pI4]: Dropping self-originated packet", "eigrp_read[%pI4]: Dropping self-originated packet",
&srcaddr); &srcaddr);
return 0; return;
} }
/* Advance from IP header to EIGRP header (iph->ip_hl has been verified /* Advance from IP header to EIGRP header (iph->ip_hl has been verified
@ -574,7 +572,7 @@ int eigrp_read(struct thread *thread)
"ignoring packet from router %u sent to %pI4, wrong AS Number received: %u", "ignoring packet from router %u sent to %pI4, wrong AS Number received: %u",
ntohs(eigrph->vrid), &iph->ip_dst, ntohs(eigrph->vrid), &iph->ip_dst,
ntohs(eigrph->ASNumber)); ntohs(eigrph->ASNumber));
return 0; return;
} }
/* If incoming interface is passive one, ignore it. */ /* If incoming interface is passive one, ignore it. */
@ -588,7 +586,7 @@ int eigrp_read(struct thread *thread)
if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS)) { if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS)) {
eigrp_if_set_multicast(ei); eigrp_if_set_multicast(ei);
} }
return 0; return;
} }
/* else it must be a local eigrp interface, check it was received on /* else it must be a local eigrp interface, check it was received on
@ -599,7 +597,7 @@ int eigrp_read(struct thread *thread)
zlog_warn( zlog_warn(
"Packet from [%pI4] received on wrong link %s", "Packet from [%pI4] received on wrong link %s",
&iph->ip_src, ifp->name); &iph->ip_src, ifp->name);
return 0; return;
} }
/* Verify more EIGRP header fields. */ /* Verify more EIGRP header fields. */
@ -609,7 +607,7 @@ int eigrp_read(struct thread *thread)
zlog_debug( zlog_debug(
"eigrp_read[%pI4]: Header check failed, dropping.", "eigrp_read[%pI4]: Header check failed, dropping.",
&iph->ip_src); &iph->ip_src);
return ret; return;
} }
/* calcualte the eigrp packet length, and move the pounter to the /* calcualte the eigrp packet length, and move the pounter to the
@ -700,8 +698,6 @@ int eigrp_read(struct thread *thread)
IF_NAME(ei), opcode); IF_NAME(ei), opcode);
break; break;
} }
return 0;
} }
static struct stream *eigrp_recv_packet(struct eigrp *eigrp, static struct stream *eigrp_recv_packet(struct eigrp *eigrp,
@ -989,7 +985,7 @@ static int eigrp_check_network_mask(struct eigrp_interface *ei,
return 0; return 0;
} }
int eigrp_unack_packet_retrans(struct thread *thread) void eigrp_unack_packet_retrans(struct thread *thread)
{ {
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
nbr = (struct eigrp_neighbor *)THREAD_ARG(thread); nbr = (struct eigrp_neighbor *)THREAD_ARG(thread);
@ -1005,8 +1001,10 @@ int eigrp_unack_packet_retrans(struct thread *thread)
eigrp_fifo_push(nbr->ei->obuf, duplicate); eigrp_fifo_push(nbr->ei->obuf, duplicate);
ep->retrans_counter++; ep->retrans_counter++;
if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) {
return eigrp_retrans_count_exceeded(ep, nbr); eigrp_retrans_count_exceeded(ep, nbr);
return;
}
/*Start retransmission timer*/ /*Start retransmission timer*/
thread_add_timer(master, eigrp_unack_packet_retrans, nbr, thread_add_timer(master, eigrp_unack_packet_retrans, nbr,
@ -1021,11 +1019,9 @@ int eigrp_unack_packet_retrans(struct thread *thread)
thread_add_write(master, eigrp_write, nbr->ei->eigrp, thread_add_write(master, eigrp_write, nbr->ei->eigrp,
nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write);
} }
return 0;
} }
int eigrp_unack_multicast_packet_retrans(struct thread *thread) void eigrp_unack_multicast_packet_retrans(struct thread *thread)
{ {
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
nbr = (struct eigrp_neighbor *)THREAD_ARG(thread); nbr = (struct eigrp_neighbor *)THREAD_ARG(thread);
@ -1040,8 +1036,10 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
eigrp_fifo_push(nbr->ei->obuf, duplicate); eigrp_fifo_push(nbr->ei->obuf, duplicate);
ep->retrans_counter++; ep->retrans_counter++;
if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) {
return eigrp_retrans_count_exceeded(ep, nbr); eigrp_retrans_count_exceeded(ep, nbr);
return;
}
/*Start retransmission timer*/ /*Start retransmission timer*/
thread_add_timer(master, eigrp_unack_multicast_packet_retrans, thread_add_timer(master, eigrp_unack_multicast_packet_retrans,
@ -1056,8 +1054,6 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
thread_add_write(master, eigrp_write, nbr->ei->eigrp, thread_add_write(master, eigrp_write, nbr->ei->eigrp,
nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write);
} }
return 0;
} }
/* Get packet from tail of fifo. */ /* Get packet from tail of fifo. */

View File

@ -33,8 +33,8 @@
#define _ZEBRA_EIGRP_PACKET_H #define _ZEBRA_EIGRP_PACKET_H
/*Prototypes*/ /*Prototypes*/
extern int eigrp_read(struct thread *); extern void eigrp_read(struct thread *thread);
extern int eigrp_write(struct thread *); extern void eigrp_write(struct thread *thread);
extern struct eigrp_packet *eigrp_packet_new(size_t size, extern struct eigrp_packet *eigrp_packet_new(size_t size,
struct eigrp_neighbor *nbr); struct eigrp_neighbor *nbr);
@ -66,8 +66,8 @@ extern uint16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s,
extern uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s, extern uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s,
struct eigrp_interface *ei); struct eigrp_interface *ei);
extern int eigrp_unack_packet_retrans(struct thread *thread); extern void eigrp_unack_packet_retrans(struct thread *thread);
extern int eigrp_unack_multicast_packet_retrans(struct thread *thread); extern void eigrp_unack_multicast_packet_retrans(struct thread *thread);
/* /*
* untill there is reason to have their own header, these externs are found in * untill there is reason to have their own header, these externs are found in
@ -80,7 +80,7 @@ extern void eigrp_hello_send_ack(struct eigrp_neighbor *nbr);
extern void eigrp_hello_receive(struct eigrp *eigrp, struct ip *iph, extern void eigrp_hello_receive(struct eigrp *eigrp, struct ip *iph,
struct eigrp_header *eigrph, struct stream *s, struct eigrp_header *eigrph, struct stream *s,
struct eigrp_interface *ei, int size); struct eigrp_interface *ei, int size);
extern int eigrp_hello_timer(struct thread *thread); extern void eigrp_hello_timer(struct thread *thread);
/* /*
* These externs are found in eigrp_update.c * These externs are found in eigrp_update.c
@ -96,7 +96,7 @@ extern void eigrp_update_send_all(struct eigrp *eigrp,
struct eigrp_interface *exception); struct eigrp_interface *exception);
extern void eigrp_update_send_init(struct eigrp_neighbor *nbr); extern void eigrp_update_send_init(struct eigrp_neighbor *nbr);
extern void eigrp_update_send_EOT(struct eigrp_neighbor *nbr); extern void eigrp_update_send_EOT(struct eigrp_neighbor *nbr);
extern int eigrp_update_send_GR_thread(struct thread *thread); extern void eigrp_update_send_GR_thread(struct thread *thread);
extern void eigrp_update_send_GR(struct eigrp_neighbor *nbr, extern void eigrp_update_send_GR(struct eigrp_neighbor *nbr,
enum GR_type gr_type, struct vty *vty); enum GR_type gr_type, struct vty *vty);
extern void eigrp_update_send_interface_GR(struct eigrp_interface *ei, extern void eigrp_update_send_interface_GR(struct eigrp_interface *ei,

View File

@ -910,7 +910,7 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
* *
* Uses nbr_gr_packet_type and t_nbr_send_gr from neighbor. * Uses nbr_gr_packet_type and t_nbr_send_gr from neighbor.
*/ */
int eigrp_update_send_GR_thread(struct thread *thread) void eigrp_update_send_GR_thread(struct thread *thread)
{ {
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
@ -923,7 +923,7 @@ int eigrp_update_send_GR_thread(struct thread *thread)
if (nbr->retrans_queue->count > 0) { if (nbr->retrans_queue->count > 0) {
thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr,
10, &nbr->t_nbr_send_gr); 10, &nbr->t_nbr_send_gr);
return 0; return;
} }
/* send GR EIGRP packet chunk */ /* send GR EIGRP packet chunk */
@ -933,8 +933,6 @@ int eigrp_update_send_GR_thread(struct thread *thread)
if (nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) { if (nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) {
thread_execute(master, eigrp_update_send_GR_thread, nbr, 0); thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
} }
return 0;
} }
/** /**

View File

@ -250,7 +250,7 @@ void fabricd_finish(struct fabricd *f)
hash_free(f->neighbors_neighbors); hash_free(f->neighbors_neighbors);
} }
static int fabricd_initial_sync_timeout(struct thread *thread) static void fabricd_initial_sync_timeout(struct thread *thread)
{ {
struct fabricd *f = THREAD_ARG(thread); struct fabricd *f = THREAD_ARG(thread);
@ -258,7 +258,6 @@ static int fabricd_initial_sync_timeout(struct thread *thread)
f->initial_sync_circuit->interface->name); f->initial_sync_circuit->interface->name);
f->initial_sync_state = FABRICD_SYNC_PENDING; f->initial_sync_state = FABRICD_SYNC_PENDING;
f->initial_sync_circuit = NULL; f->initial_sync_circuit = NULL;
return 0;
} }
void fabricd_initial_sync_hello(struct isis_circuit *circuit) void fabricd_initial_sync_hello(struct isis_circuit *circuit)
@ -399,22 +398,21 @@ static uint8_t fabricd_calculate_fabric_tier(struct isis_area *area)
return tier; return tier;
} }
static int fabricd_tier_set_timer(struct thread *thread) static void fabricd_tier_set_timer(struct thread *thread)
{ {
struct fabricd *f = THREAD_ARG(thread); struct fabricd *f = THREAD_ARG(thread);
fabricd_set_tier(f, f->tier_pending); fabricd_set_tier(f, f->tier_pending);
return 0;
} }
static int fabricd_tier_calculation_cb(struct thread *thread) static void fabricd_tier_calculation_cb(struct thread *thread)
{ {
struct fabricd *f = THREAD_ARG(thread); struct fabricd *f = THREAD_ARG(thread);
uint8_t tier = ISIS_TIER_UNDEFINED; uint8_t tier = ISIS_TIER_UNDEFINED;
tier = fabricd_calculate_fabric_tier(f->area); tier = fabricd_calculate_fabric_tier(f->area);
if (tier == ISIS_TIER_UNDEFINED) if (tier == ISIS_TIER_UNDEFINED)
return 0; return;
zlog_info("OpenFabric: Got tier %hhu from algorithm. Arming timer.", zlog_info("OpenFabric: Got tier %hhu from algorithm. Arming timer.",
tier); tier);
@ -423,7 +421,6 @@ static int fabricd_tier_calculation_cb(struct thread *thread)
f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], f->area->lsp_gen_interval[ISIS_LEVEL2 - 1],
&f->tier_set_timer); &f->tier_set_timer);
return 0;
} }
static void fabricd_bump_tier_calculation_timer(struct fabricd *f) static void fabricd_bump_tier_calculation_timer(struct fabricd *f)

View File

@ -448,7 +448,7 @@ const char *isis_adj_yang_state(enum isis_adj_state state)
} }
} }
int isis_adj_expire(struct thread *thread) void isis_adj_expire(struct thread *thread)
{ {
struct isis_adjacency *adj; struct isis_adjacency *adj;
@ -461,8 +461,6 @@ int isis_adj_expire(struct thread *thread)
/* trigger the adj expire event */ /* trigger the adj expire event */
isis_adj_state_change(&adj, ISIS_ADJ_DOWN, "holding time expired"); isis_adj_state_change(&adj, ISIS_ADJ_DOWN, "holding time expired");
return 0;
} }
/* /*

View File

@ -141,13 +141,13 @@ void isis_adj_state_change(struct isis_adjacency **adj,
enum isis_adj_state state, const char *reason); enum isis_adj_state state, const char *reason);
void isis_adj_print(struct isis_adjacency *adj); void isis_adj_print(struct isis_adjacency *adj);
const char *isis_adj_yang_state(enum isis_adj_state state); const char *isis_adj_yang_state(enum isis_adj_state state);
int isis_adj_expire(struct thread *thread); void isis_adj_expire(struct thread *thread);
void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty, void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
char detail); char detail);
void isis_adj_build_neigh_list(struct list *adjdb, struct list *list); void isis_adj_build_neigh_list(struct list *adjdb, struct list *list);
void isis_adj_build_up_list(struct list *adjdb, struct list *list); void isis_adj_build_up_list(struct list *adjdb, struct list *list);
int isis_adj_usage2levels(enum isis_adj_usage usage); int isis_adj_usage2levels(enum isis_adj_usage usage);
int isis_bfd_startup_timer(struct thread *thread); void isis_bfd_startup_timer(struct thread *thread);
const char *isis_adj_name(const struct isis_adjacency *adj); const char *isis_adj_name(const struct isis_adjacency *adj);
#endif /* ISIS_ADJACENCY_H */ #endif /* ISIS_ADJACENCY_H */

View File

@ -61,7 +61,7 @@ const char *isis_disflag2string(int disflag)
return NULL; /* not reached */ return NULL; /* not reached */
} }
int isis_run_dr(struct thread *thread) void isis_run_dr(struct thread *thread)
{ {
struct isis_circuit_arg *arg = THREAD_ARG(thread); struct isis_circuit_arg *arg = THREAD_ARG(thread);
@ -76,7 +76,7 @@ int isis_run_dr(struct thread *thread)
zlog_warn("%s: scheduled for non broadcast circuit from %s:%d", zlog_warn("%s: scheduled for non broadcast circuit from %s:%d",
__func__, thread->xref->xref.file, __func__, thread->xref->xref.file,
thread->xref->xref.line); thread->xref->xref.line);
return ISIS_WARNING; return;
} }
if (circuit->u.bc.run_dr_elect[level - 1]) if (circuit->u.bc.run_dr_elect[level - 1])
@ -84,8 +84,6 @@ int isis_run_dr(struct thread *thread)
circuit->u.bc.t_run_dr[level - 1] = NULL; circuit->u.bc.t_run_dr[level - 1] = NULL;
circuit->u.bc.run_dr_elect[level - 1] = 1; circuit->u.bc.run_dr_elect[level - 1] = 1;
return ISIS_OK;
} }
static int isis_check_dr_change(struct isis_adjacency *adj, int level) static int isis_check_dr_change(struct isis_adjacency *adj, int level)

View File

@ -24,7 +24,7 @@
#ifndef _ZEBRA_ISIS_DR_H #ifndef _ZEBRA_ISIS_DR_H
#define _ZEBRA_ISIS_DR_H #define _ZEBRA_ISIS_DR_H
int isis_run_dr(struct thread *thread); void isis_run_dr(struct thread *thread);
int isis_dr_elect(struct isis_circuit *circuit, int level); int isis_dr_elect(struct isis_circuit *circuit, int level);
int isis_dr_resign(struct isis_circuit *circuit, int level); int isis_dr_resign(struct isis_circuit *circuit, int level);
int isis_dr_commence(struct isis_circuit *circuit, int level); int isis_dr_commence(struct isis_circuit *circuit, int level);

View File

@ -42,7 +42,7 @@
DEFINE_MTYPE_STATIC(ISISD, ISIS_DYNHN, "ISIS dyn hostname"); DEFINE_MTYPE_STATIC(ISISD, ISIS_DYNHN, "ISIS dyn hostname");
static int dyn_cache_cleanup(struct thread *); static void dyn_cache_cleanup(struct thread *);
void dyn_cache_init(struct isis *isis) void dyn_cache_init(struct isis *isis)
{ {
@ -67,7 +67,7 @@ void dyn_cache_finish(struct isis *isis)
list_delete(&isis->dyn_cache); list_delete(&isis->dyn_cache);
} }
static int dyn_cache_cleanup(struct thread *thread) static void dyn_cache_cleanup(struct thread *thread)
{ {
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct isis_dynhn *dyn; struct isis_dynhn *dyn;
@ -87,8 +87,6 @@ static int dyn_cache_cleanup(struct thread *thread)
thread_add_timer(master, dyn_cache_cleanup, isis, 120, thread_add_timer(master, dyn_cache_cleanup, isis, 120,
&isis->t_dync_clean); &isis->t_dync_clean);
return ISIS_OK;
} }
struct isis_dynhn *dynhn_find_by_id(struct isis *isis, const uint8_t *id) struct isis_dynhn *dynhn_find_by_id(struct isis *isis, const uint8_t *id)

View File

@ -209,7 +209,7 @@ void isis_circuit_is_type_set(struct isis_circuit *circuit, int newtype)
/* events supporting code */ /* events supporting code */
int isis_event_dis_status_change(struct thread *thread) void isis_event_dis_status_change(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
@ -217,15 +217,13 @@ int isis_event_dis_status_change(struct thread *thread)
/* invalid arguments */ /* invalid arguments */
if (!circuit || !circuit->area) if (!circuit || !circuit->area)
return 0; return;
if (IS_DEBUG_EVENTS) if (IS_DEBUG_EVENTS)
zlog_debug("ISIS-Evt (%s) DIS status change", zlog_debug("ISIS-Evt (%s) DIS status change",
circuit->area->area_tag); circuit->area->area_tag);
/* LSP generation again */ /* LSP generation again */
lsp_regenerate_schedule(circuit->area, IS_LEVEL_1 | IS_LEVEL_2, 0); lsp_regenerate_schedule(circuit->area, IS_LEVEL_1 | IS_LEVEL_2, 0);
return 0;
} }
void isis_event_auth_failure(char *area_tag, const char *error_string, void isis_event_auth_failure(char *area_tag, const char *error_string,

View File

@ -31,7 +31,7 @@ void isis_event_circuit_type_change(struct isis_circuit *circuit, int newtype);
/* /*
* Events related to adjacencies * Events related to adjacencies
*/ */
int isis_event_dis_status_change(struct thread *thread); void isis_event_dis_status_change(struct thread *thread);
/* /*
* Error events * Error events

View File

@ -344,7 +344,7 @@ void isis_ldp_sync_set_if_metric(struct isis_circuit *circuit, bool run_regen)
/* /*
* LDP-SYNC holddown timer routines * LDP-SYNC holddown timer routines
*/ */
static int isis_ldp_sync_holddown_timer(struct thread *thread) static void isis_ldp_sync_holddown_timer(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
struct ldp_sync_info *ldp_sync_info; struct ldp_sync_info *ldp_sync_info;
@ -355,7 +355,7 @@ static int isis_ldp_sync_holddown_timer(struct thread *thread)
*/ */
circuit = THREAD_ARG(thread); circuit = THREAD_ARG(thread);
if (circuit->ldp_sync_info == NULL) if (circuit->ldp_sync_info == NULL)
return 0; return;
ldp_sync_info = circuit->ldp_sync_info; ldp_sync_info = circuit->ldp_sync_info;
@ -366,7 +366,6 @@ static int isis_ldp_sync_holddown_timer(struct thread *thread)
circuit->interface->name); circuit->interface->name);
isis_ldp_sync_set_if_metric(circuit, true); isis_ldp_sync_set_if_metric(circuit, true);
return 0;
} }
void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit) void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit)

View File

@ -1401,7 +1401,7 @@ static struct rlfa *rlfa_lookup(struct isis_spftree *spftree,
return rlfa_tree_find(&spftree->lfa.remote.rlfas, &s); return rlfa_tree_find(&spftree->lfa.remote.rlfas, &s);
} }
static int isis_area_verify_routes_cb(struct thread *thread) static void isis_area_verify_routes_cb(struct thread *thread)
{ {
struct isis_area *area = THREAD_ARG(thread); struct isis_area *area = THREAD_ARG(thread);
@ -1409,8 +1409,6 @@ static int isis_area_verify_routes_cb(struct thread *thread)
zlog_debug("ISIS-LFA: updating RLFAs in the RIB"); zlog_debug("ISIS-LFA: updating RLFAs in the RIB");
isis_area_verify_routes(area); isis_area_verify_routes(area);
return 0;
} }
static mpls_label_t rlfa_nexthop_label(struct isis_spftree *spftree, static mpls_label_t rlfa_nexthop_label(struct isis_spftree *spftree,

View File

@ -62,9 +62,9 @@
DEFINE_MTYPE_STATIC(ISISD, ISIS_LSP, "ISIS LSP"); DEFINE_MTYPE_STATIC(ISISD, ISIS_LSP, "ISIS LSP");
static int lsp_refresh(struct thread *thread); static void lsp_refresh(struct thread *thread);
static int lsp_l1_refresh_pseudo(struct thread *thread); static void lsp_l1_refresh_pseudo(struct thread *thread);
static int lsp_l2_refresh_pseudo(struct thread *thread); static void lsp_l2_refresh_pseudo(struct thread *thread);
static void lsp_destroy(struct isis_lsp *lsp); static void lsp_destroy(struct isis_lsp *lsp);
@ -1447,7 +1447,7 @@ static int lsp_regenerate(struct isis_area *area, int level)
/* /*
* Something has changed or periodic refresh -> regenerate LSP * Something has changed or periodic refresh -> regenerate LSP
*/ */
static int lsp_refresh(struct thread *thread) static void lsp_refresh(struct thread *thread)
{ {
struct lsp_refresh_arg *arg = THREAD_ARG(thread); struct lsp_refresh_arg *arg = THREAD_ARG(thread);
@ -1463,7 +1463,7 @@ static int lsp_refresh(struct thread *thread)
area->lsp_regenerate_pending[level - 1] = 0; area->lsp_regenerate_pending[level - 1] = 0;
if ((area->is_type & level) == 0) if ((area->is_type & level) == 0)
return ISIS_ERROR; return;
/* /*
* Throttle regeneration of LSPs (but not when BFD signalled a 'down' * Throttle regeneration of LSPs (but not when BFD signalled a 'down'
@ -1476,13 +1476,13 @@ static int lsp_refresh(struct thread *thread)
area->area_tag, level); area->area_tag, level);
_lsp_regenerate_schedule(area, level, 0, false, _lsp_regenerate_schedule(area, level, 0, false,
__func__, __FILE__, __LINE__); __func__, __FILE__, __LINE__);
return 0; return;
} }
sched_debug( sched_debug(
"ISIS (%s): LSP L%d refresh timer expired. Refreshing LSP...", "ISIS (%s): LSP L%d refresh timer expired. Refreshing LSP...",
area->area_tag, level); area->area_tag, level);
return lsp_regenerate(area, level); lsp_regenerate(area, level);
} }
int _lsp_regenerate_schedule(struct isis_area *area, int level, int _lsp_regenerate_schedule(struct isis_area *area, int level,
@ -1827,7 +1827,7 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level)
/* /*
* Something has changed or periodic refresh -> regenerate pseudo LSP * Something has changed or periodic refresh -> regenerate pseudo LSP
*/ */
static int lsp_l1_refresh_pseudo(struct thread *thread) static void lsp_l1_refresh_pseudo(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
uint8_t id[ISIS_SYS_ID_LEN + 2]; uint8_t id[ISIS_SYS_ID_LEN + 2];
@ -1843,13 +1843,13 @@ static int lsp_l1_refresh_pseudo(struct thread *thread)
LSP_PSEUDO_ID(id) = circuit->circuit_id; LSP_PSEUDO_ID(id) = circuit->circuit_id;
LSP_FRAGMENT(id) = 0; LSP_FRAGMENT(id) = 0;
lsp_purge_pseudo(id, circuit, IS_LEVEL_1); lsp_purge_pseudo(id, circuit, IS_LEVEL_1);
return ISIS_ERROR; return;
} }
return lsp_regenerate_pseudo(circuit, IS_LEVEL_1); lsp_regenerate_pseudo(circuit, IS_LEVEL_1);
} }
static int lsp_l2_refresh_pseudo(struct thread *thread) static void lsp_l2_refresh_pseudo(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
uint8_t id[ISIS_SYS_ID_LEN + 2]; uint8_t id[ISIS_SYS_ID_LEN + 2];
@ -1865,10 +1865,10 @@ static int lsp_l2_refresh_pseudo(struct thread *thread)
LSP_PSEUDO_ID(id) = circuit->circuit_id; LSP_PSEUDO_ID(id) = circuit->circuit_id;
LSP_FRAGMENT(id) = 0; LSP_FRAGMENT(id) = 0;
lsp_purge_pseudo(id, circuit, IS_LEVEL_2); lsp_purge_pseudo(id, circuit, IS_LEVEL_2);
return ISIS_ERROR; return;
} }
return lsp_regenerate_pseudo(circuit, IS_LEVEL_2); lsp_regenerate_pseudo(circuit, IS_LEVEL_2);
} }
int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level) int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level)
@ -1973,7 +1973,7 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level)
* Walk through LSPs for an area * Walk through LSPs for an area
* - set remaining lifetime * - set remaining lifetime
*/ */
int lsp_tick(struct thread *thread) void lsp_tick(struct thread *thread)
{ {
struct isis_area *area; struct isis_area *area;
struct isis_lsp *lsp; struct isis_lsp *lsp;
@ -2064,8 +2064,6 @@ int lsp_tick(struct thread *thread)
&& !isis_tx_queue_len(fabricd_init_c->tx_queue)) { && !isis_tx_queue_len(fabricd_init_c->tx_queue)) {
fabricd_initial_sync_finish(area); fabricd_initial_sync_finish(area);
} }
return ISIS_OK;
} }
void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level) void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level)

View File

@ -65,7 +65,7 @@ DECLARE_RBTREE_UNIQ(lspdb, struct isis_lsp, dbe, lspdb_compare);
void lsp_db_init(struct lspdb_head *head); void lsp_db_init(struct lspdb_head *head);
void lsp_db_fini(struct lspdb_head *head); void lsp_db_fini(struct lspdb_head *head);
int lsp_tick(struct thread *thread); void lsp_tick(struct thread *thread);
int lsp_generate(struct isis_area *area, int level); int lsp_generate(struct isis_area *area, int level);
#define lsp_regenerate_schedule(area, level, all_pseudo) \ #define lsp_regenerate_schedule(area, level, all_pseudo) \

View File

@ -1793,11 +1793,10 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
return retval; return retval;
} }
int isis_receive(struct thread *thread) void isis_receive(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
uint8_t ssnpa[ETH_ALEN]; uint8_t ssnpa[ETH_ALEN];
int retval;
/* /*
* Get the circuit * Get the circuit
@ -1809,20 +1808,22 @@ int isis_receive(struct thread *thread)
isis_circuit_stream(circuit, &circuit->rcv_stream); isis_circuit_stream(circuit, &circuit->rcv_stream);
#if ISIS_METHOD != ISIS_METHOD_BPF
int retval;
retval = circuit->rx(circuit, ssnpa); retval = circuit->rx(circuit, ssnpa);
#if ISIS_METHOD != ISIS_METHOD_BPF
if (retval == ISIS_OK) if (retval == ISIS_OK)
retval = isis_handle_pdu(circuit, ssnpa); isis_handle_pdu(circuit, ssnpa);
#endif //ISIS_METHOD != ISIS_METHOD_BPF #else // ISIS_METHOD != ISIS_METHOD_BPF
circuit->rx(circuit, ssnpa);
#endif
/* /*
* prepare for next packet. * prepare for next packet.
*/ */
if (!circuit->is_passive) if (!circuit->is_passive)
isis_circuit_prepare(circuit); isis_circuit_prepare(circuit);
return retval;
} }
/* /*
@ -2015,7 +2016,7 @@ int send_hello(struct isis_circuit *circuit, int level)
return retval; return retval;
} }
static int send_hello_cb(struct thread *thread) static void send_hello_cb(struct thread *thread)
{ {
struct isis_circuit_arg *arg = THREAD_ARG(thread); struct isis_circuit_arg *arg = THREAD_ARG(thread);
assert(arg); assert(arg);
@ -2030,30 +2031,29 @@ static int send_hello_cb(struct thread *thread)
send_hello(circuit, 1); send_hello(circuit, 1);
send_hello_sched(circuit, ISIS_LEVEL1, send_hello_sched(circuit, ISIS_LEVEL1,
1000 * circuit->hello_interval[1]); 1000 * circuit->hello_interval[1]);
return ISIS_OK; return;
} }
if (circuit->circ_type != CIRCUIT_T_BROADCAST) { if (circuit->circ_type != CIRCUIT_T_BROADCAST) {
zlog_warn("ISIS-Hello (%s): Trying to send hello on unknown circuit type %d", zlog_warn("ISIS-Hello (%s): Trying to send hello on unknown circuit type %d",
circuit->area->area_tag, circuit->circ_type); circuit->area->area_tag, circuit->circ_type);
return ISIS_WARNING; return;
} }
circuit->u.bc.t_send_lan_hello[level - 1] = NULL; circuit->u.bc.t_send_lan_hello[level - 1] = NULL;
if (!(circuit->is_type & level)) { if (!(circuit->is_type & level)) {
zlog_warn("ISIS-Hello (%s): Trying to send L%d IIH in L%d-only circuit", zlog_warn("ISIS-Hello (%s): Trying to send L%d IIH in L%d-only circuit",
circuit->area->area_tag, level, 3 - level); circuit->area->area_tag, level, 3 - level);
return ISIS_WARNING; return;
} }
if (circuit->u.bc.run_dr_elect[level - 1]) if (circuit->u.bc.run_dr_elect[level - 1])
isis_dr_elect(circuit, level); isis_dr_elect(circuit, level);
int rv = send_hello(circuit, level); send_hello(circuit, level);
/* set next timer thread */ /* set next timer thread */
send_hello_sched(circuit, level, 1000 * circuit->hello_interval[level - 1]); send_hello_sched(circuit, level, 1000 * circuit->hello_interval[level - 1]);
return rv;
} }
static void _send_hello_sched(struct isis_circuit *circuit, static void _send_hello_sched(struct isis_circuit *circuit,
@ -2247,7 +2247,7 @@ int send_csnp(struct isis_circuit *circuit, int level)
return ISIS_OK; return ISIS_OK;
} }
int send_l1_csnp(struct thread *thread) void send_l1_csnp(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
@ -2265,11 +2265,9 @@ int send_l1_csnp(struct thread *thread)
thread_add_timer(master, send_l1_csnp, circuit, thread_add_timer(master, send_l1_csnp, circuit,
isis_jitter(circuit->csnp_interval[0], CSNP_JITTER), isis_jitter(circuit->csnp_interval[0], CSNP_JITTER),
&circuit->t_send_csnp[0]); &circuit->t_send_csnp[0]);
return ISIS_OK;
} }
int send_l2_csnp(struct thread *thread) void send_l2_csnp(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
@ -2287,8 +2285,6 @@ int send_l2_csnp(struct thread *thread)
thread_add_timer(master, send_l2_csnp, circuit, thread_add_timer(master, send_l2_csnp, circuit,
isis_jitter(circuit->csnp_interval[1], CSNP_JITTER), isis_jitter(circuit->csnp_interval[1], CSNP_JITTER),
&circuit->t_send_csnp[1]); &circuit->t_send_csnp[1]);
return ISIS_OK;
} }
/* /*
@ -2405,7 +2401,7 @@ static int send_psnp(int level, struct isis_circuit *circuit)
return ISIS_OK; return ISIS_OK;
} }
int send_l1_psnp(struct thread *thread) void send_l1_psnp(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
@ -2420,15 +2416,13 @@ int send_l1_psnp(struct thread *thread)
thread_add_timer(master, send_l1_psnp, circuit, thread_add_timer(master, send_l1_psnp, circuit,
isis_jitter(circuit->psnp_interval[0], PSNP_JITTER), isis_jitter(circuit->psnp_interval[0], PSNP_JITTER),
&circuit->t_send_psnp[0]); &circuit->t_send_psnp[0]);
return ISIS_OK;
} }
/* /*
* 7.3.15.4 action on expiration of partial SNP interval * 7.3.15.4 action on expiration of partial SNP interval
* level 2 * level 2
*/ */
int send_l2_psnp(struct thread *thread) void send_l2_psnp(struct thread *thread)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
@ -2443,8 +2437,6 @@ int send_l2_psnp(struct thread *thread)
thread_add_timer(master, send_l2_psnp, circuit, thread_add_timer(master, send_l2_psnp, circuit,
isis_jitter(circuit->psnp_interval[1], PSNP_JITTER), isis_jitter(circuit->psnp_interval[1], PSNP_JITTER),
&circuit->t_send_psnp[1]); &circuit->t_send_psnp[1]);
return ISIS_OK;
} }
/* /*

View File

@ -195,7 +195,7 @@ struct isis_partial_seqnum_hdr {
/* /*
* Function for receiving IS-IS PDUs * Function for receiving IS-IS PDUs
*/ */
int isis_receive(struct thread *thread); void isis_receive(struct thread *thread);
/* /*
* calling arguments for snp_process () * calling arguments for snp_process ()
@ -210,10 +210,10 @@ int isis_receive(struct thread *thread);
*/ */
void send_hello_sched(struct isis_circuit *circuit, int level, long delay); void send_hello_sched(struct isis_circuit *circuit, int level, long delay);
int send_csnp(struct isis_circuit *circuit, int level); int send_csnp(struct isis_circuit *circuit, int level);
int send_l1_csnp(struct thread *thread); void send_l1_csnp(struct thread *thread);
int send_l2_csnp(struct thread *thread); void send_l2_csnp(struct thread *thread);
int send_l1_psnp(struct thread *thread); void send_l1_psnp(struct thread *thread);
int send_l2_psnp(struct thread *thread); void send_l2_psnp(struct thread *thread);
void send_lsp(struct isis_circuit *circuit, void send_lsp(struct isis_circuit *circuit,
struct isis_lsp *lsp, enum isis_tx_type tx_type); struct isis_lsp *lsp, enum isis_tx_type tx_type);
void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream); void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream);

View File

@ -1832,7 +1832,7 @@ void isis_spf_invalidate_routes(struct isis_spftree *tree)
tree->route_table_backup->cleanup = isis_route_node_cleanup; tree->route_table_backup->cleanup = isis_route_node_cleanup;
} }
static int isis_run_spf_cb(struct thread *thread) static void isis_run_spf_cb(struct thread *thread)
{ {
struct isis_spf_run *run = THREAD_ARG(thread); struct isis_spf_run *run = THREAD_ARG(thread);
struct isis_area *area = run->area; struct isis_area *area = run->area;
@ -1845,7 +1845,7 @@ static int isis_run_spf_cb(struct thread *thread)
if (IS_DEBUG_SPF_EVENTS) if (IS_DEBUG_SPF_EVENTS)
zlog_warn("ISIS-SPF (%s) area does not share level", zlog_warn("ISIS-SPF (%s) area does not share level",
area->area_tag); area->area_tag);
return ISIS_WARNING; return;
} }
isis_area_delete_backup_adj_sids(area, level); isis_area_delete_backup_adj_sids(area, level);
@ -1883,8 +1883,6 @@ static int isis_run_spf_cb(struct thread *thread)
UNSET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF); UNSET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF);
fabricd_run_spf(area); fabricd_run_spf(area);
return 0;
} }
static struct isis_spf_run *isis_run_spf_arg(struct isis_area *area, int level) static struct isis_spf_run *isis_run_spf_arg(struct isis_area *area, int level)

View File

@ -1090,7 +1090,7 @@ DEFUN(show_sr_node, show_sr_node_cmd,
* *
* @return 1 on success * @return 1 on success
*/ */
static int sr_start_label_manager(struct thread *start) static void sr_start_label_manager(struct thread *start)
{ {
struct isis_area *area; struct isis_area *area;
@ -1098,8 +1098,6 @@ static int sr_start_label_manager(struct thread *start)
/* re-attempt to start SR & Label Manager connection */ /* re-attempt to start SR & Label Manager connection */
isis_sr_start(area); isis_sr_start(area);
return 1;
} }
/** /**

View File

@ -114,7 +114,7 @@ static struct isis_tx_queue_entry *tx_queue_find(struct isis_tx_queue *queue,
return hash_lookup(queue->hash, &e); return hash_lookup(queue->hash, &e);
} }
static int tx_queue_send_event(struct thread *thread) static void tx_queue_send_event(struct thread *thread)
{ {
struct isis_tx_queue_entry *e = THREAD_ARG(thread); struct isis_tx_queue_entry *e = THREAD_ARG(thread);
struct isis_tx_queue *queue = e->queue; struct isis_tx_queue *queue = e->queue;
@ -128,8 +128,6 @@ static int tx_queue_send_event(struct thread *thread)
queue->send_event(queue->circuit, e->lsp, e->type); queue->send_event(queue->circuit, e->lsp, e->type);
/* Don't access e here anymore, send_event might have destroyed it */ /* Don't access e here anymore, send_event might have destroyed it */
return 0;
} }
void _isis_tx_queue_add(struct isis_tx_queue *queue, void _isis_tx_queue_add(struct isis_tx_queue *queue,

View File

@ -25,7 +25,7 @@
struct accept_ev { struct accept_ev {
LIST_ENTRY(accept_ev) entry; LIST_ENTRY(accept_ev) entry;
struct thread *ev; struct thread *ev;
int (*accept_cb)(struct thread *); void (*accept_cb)(struct thread *);
void *arg; void *arg;
int fd; int fd;
}; };
@ -37,8 +37,8 @@ struct {
static void accept_arm(void); static void accept_arm(void);
static void accept_unarm(void); static void accept_unarm(void);
static int accept_cb(struct thread *); static void accept_cb(struct thread *);
static int accept_timeout(struct thread *); static void accept_timeout(struct thread *);
void void
accept_init(void) accept_init(void)
@ -46,8 +46,7 @@ accept_init(void)
LIST_INIT(&accept_queue.queue); LIST_INIT(&accept_queue.queue);
} }
int int accept_add(int fd, void (*cb)(struct thread *), void *arg)
accept_add(int fd, int (*cb)(struct thread *), void *arg)
{ {
struct accept_ev *av; struct accept_ev *av;
@ -115,23 +114,17 @@ accept_unarm(void)
thread_cancel(&av->ev); thread_cancel(&av->ev);
} }
static int static void accept_cb(struct thread *thread)
accept_cb(struct thread *thread)
{ {
struct accept_ev *av = THREAD_ARG(thread); struct accept_ev *av = THREAD_ARG(thread);
thread_add_read(master, accept_cb, av, av->fd, &av->ev); thread_add_read(master, accept_cb, av, av->fd, &av->ev);
av->accept_cb(thread); av->accept_cb(thread);
return (0);
} }
static int static void accept_timeout(struct thread *thread)
accept_timeout(struct thread *thread)
{ {
accept_queue.evt = NULL; accept_queue.evt = NULL;
log_debug(__func__); log_debug(__func__);
accept_arm(); accept_arm();
return (0);
} }

View File

@ -26,12 +26,12 @@
#include "log.h" #include "log.h"
static __inline int adj_compare(const struct adj *, const struct adj *); static __inline int adj_compare(const struct adj *, const struct adj *);
static int adj_itimer(struct thread *); static void adj_itimer(struct thread *);
static __inline int tnbr_compare(const struct tnbr *, const struct tnbr *); static __inline int tnbr_compare(const struct tnbr *, const struct tnbr *);
static void tnbr_del(struct ldpd_conf *, struct tnbr *); static void tnbr_del(struct ldpd_conf *, struct tnbr *);
static void tnbr_start(struct tnbr *); static void tnbr_start(struct tnbr *);
static void tnbr_stop(struct tnbr *); static void tnbr_stop(struct tnbr *);
static int tnbr_hello_timer(struct thread *); static void tnbr_hello_timer(struct thread *);
static void tnbr_start_hello_timer(struct tnbr *); static void tnbr_start_hello_timer(struct tnbr *);
static void tnbr_stop_hello_timer(struct tnbr *); static void tnbr_stop_hello_timer(struct tnbr *);
@ -172,8 +172,7 @@ adj_get_af(const struct adj *adj)
/* adjacency timers */ /* adjacency timers */
/* ARGSUSED */ /* ARGSUSED */
static int static void adj_itimer(struct thread *thread)
adj_itimer(struct thread *thread)
{ {
struct adj *adj = THREAD_ARG(thread); struct adj *adj = THREAD_ARG(thread);
@ -187,13 +186,11 @@ adj_itimer(struct thread *thread)
adj->source.target->rlfa_count == 0) { adj->source.target->rlfa_count == 0) {
/* remove dynamic targeted neighbor */ /* remove dynamic targeted neighbor */
tnbr_del(leconf, adj->source.target); tnbr_del(leconf, adj->source.target);
return (0); return;
} }
} }
adj_del(adj, S_HOLDTIME_EXP); adj_del(adj, S_HOLDTIME_EXP);
return (0);
} }
void void
@ -345,16 +342,13 @@ tnbr_get_hello_interval(struct tnbr *tnbr)
/* target neighbors timers */ /* target neighbors timers */
/* ARGSUSED */ /* ARGSUSED */
static int static void tnbr_hello_timer(struct thread *thread)
tnbr_hello_timer(struct thread *thread)
{ {
struct tnbr *tnbr = THREAD_ARG(thread); struct tnbr *tnbr = THREAD_ARG(thread);
tnbr->hello_timer = NULL; tnbr->hello_timer = NULL;
send_hello(HELLO_TARGETED, NULL, tnbr); send_hello(HELLO_TARGETED, NULL, tnbr);
tnbr_start_hello_timer(tnbr); tnbr_start_hello_timer(tnbr);
return (0);
} }
static void static void

View File

@ -26,11 +26,11 @@
#define CONTROL_BACKLOG 5 #define CONTROL_BACKLOG 5
static int control_accept(struct thread *); static void control_accept(struct thread *);
static struct ctl_conn *control_connbyfd(int); static struct ctl_conn *control_connbyfd(int);
static struct ctl_conn *control_connbypid(pid_t); static struct ctl_conn *control_connbypid(pid_t);
static void control_close(int); static void control_close(int);
static int control_dispatch_imsg(struct thread *); static void control_dispatch_imsg(struct thread *);
struct ctl_conns ctl_conns; struct ctl_conns ctl_conns;
@ -101,8 +101,7 @@ control_cleanup(char *path)
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void control_accept(struct thread *thread)
control_accept(struct thread *thread)
{ {
int connfd; int connfd;
socklen_t len; socklen_t len;
@ -121,14 +120,14 @@ control_accept(struct thread *thread)
else if (errno != EWOULDBLOCK && errno != EINTR && else if (errno != EWOULDBLOCK && errno != EINTR &&
errno != ECONNABORTED) errno != ECONNABORTED)
log_warn("%s: accept", __func__); log_warn("%s: accept", __func__);
return (0); return;
} }
sock_set_nonblock(connfd); sock_set_nonblock(connfd);
if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) { if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) {
log_warn(__func__); log_warn(__func__);
close(connfd); close(connfd);
return (0); return;
} }
imsg_init(&c->iev.ibuf, connfd); imsg_init(&c->iev.ibuf, connfd);
@ -140,8 +139,6 @@ control_accept(struct thread *thread)
c->iev.ev_write = NULL; c->iev.ev_write = NULL;
TAILQ_INSERT_TAIL(&ctl_conns, c, entry); TAILQ_INSERT_TAIL(&ctl_conns, c, entry);
return (0);
} }
static struct ctl_conn * static struct ctl_conn *
@ -191,8 +188,7 @@ control_close(int fd)
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void control_dispatch_imsg(struct thread *thread)
control_dispatch_imsg(struct thread *thread)
{ {
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
struct ctl_conn *c; struct ctl_conn *c;
@ -202,7 +198,7 @@ control_dispatch_imsg(struct thread *thread)
if ((c = control_connbyfd(fd)) == NULL) { if ((c = control_connbyfd(fd)) == NULL) {
log_warnx("%s: fd %d: not found", __func__, fd); log_warnx("%s: fd %d: not found", __func__, fd);
return (0); return;
} }
c->iev.ev_read = NULL; c->iev.ev_read = NULL;
@ -210,13 +206,13 @@ control_dispatch_imsg(struct thread *thread)
if (((n = imsg_read(&c->iev.ibuf)) == -1 && errno != EAGAIN) || if (((n = imsg_read(&c->iev.ibuf)) == -1 && errno != EAGAIN) ||
n == 0) { n == 0) {
control_close(fd); control_close(fd);
return (0); return;
} }
for (;;) { for (;;) {
if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) { if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) {
control_close(fd); control_close(fd);
return (0); return;
} }
if (n == 0) if (n == 0)
@ -278,8 +274,6 @@ control_dispatch_imsg(struct thread *thread)
} }
imsg_event_add(&c->iev); imsg_event_add(&c->iev);
return (0);
} }
int int

View File

@ -33,7 +33,7 @@ static struct if_addr *if_addr_lookup(struct if_addr_head *, struct kaddr *);
static int if_start(struct iface *, int); static int if_start(struct iface *, int);
static int if_reset(struct iface *, int); static int if_reset(struct iface *, int);
static void if_update_af(struct iface_af *); static void if_update_af(struct iface_af *);
static int if_hello_timer(struct thread *); static void if_hello_timer(struct thread *thread);
static void if_start_hello_timer(struct iface_af *); static void if_start_hello_timer(struct iface_af *);
static void if_stop_hello_timer(struct iface_af *); static void if_stop_hello_timer(struct iface_af *);
static int if_join_ipv4_group(struct iface *, struct in_addr *); static int if_join_ipv4_group(struct iface *, struct in_addr *);
@ -43,7 +43,7 @@ static int if_leave_ipv6_group(struct iface *, struct in6_addr *);
static int ldp_sync_fsm_init(struct iface *iface, int state); static int ldp_sync_fsm_init(struct iface *iface, int state);
static int ldp_sync_act_iface_start_sync(struct iface *iface); static int ldp_sync_act_iface_start_sync(struct iface *iface);
static int iface_wait_for_ldp_sync_timer(struct thread *thread); static void iface_wait_for_ldp_sync_timer(struct thread *thread);
static void start_wait_for_ldp_sync_timer(struct iface *iface); static void start_wait_for_ldp_sync_timer(struct iface *iface);
static void stop_wait_for_ldp_sync_timer(struct iface *iface); static void stop_wait_for_ldp_sync_timer(struct iface *iface);
static int ldp_sync_act_ldp_start_sync(struct iface *iface); static int ldp_sync_act_ldp_start_sync(struct iface *iface);
@ -455,16 +455,13 @@ if_get_wait_for_sync_interval(void)
/* timers */ /* timers */
/* ARGSUSED */ /* ARGSUSED */
static int static void if_hello_timer(struct thread *thread)
if_hello_timer(struct thread *thread)
{ {
struct iface_af *ia = THREAD_ARG(thread); struct iface_af *ia = THREAD_ARG(thread);
ia->hello_timer = NULL; ia->hello_timer = NULL;
send_hello(HELLO_LINK, ia, NULL); send_hello(HELLO_LINK, ia, NULL);
if_start_hello_timer(ia); if_start_hello_timer(ia);
return (0);
} }
static void static void
@ -737,14 +734,11 @@ ldp_sync_act_iface_start_sync(struct iface *iface)
return (0); return (0);
} }
static int static void iface_wait_for_ldp_sync_timer(struct thread *thread)
iface_wait_for_ldp_sync_timer(struct thread *thread)
{ {
struct iface *iface = THREAD_ARG(thread); struct iface *iface = THREAD_ARG(thread);
ldp_sync_fsm(iface, LDP_SYNC_EVT_LDP_SYNC_COMPLETE); ldp_sync_fsm(iface, LDP_SYNC_EVT_LDP_SYNC_COMPLETE);
return (0);
} }
static void start_wait_for_ldp_sync_timer(struct iface *iface) static void start_wait_for_ldp_sync_timer(struct iface *iface)

View File

@ -41,8 +41,8 @@
#include "libfrr.h" #include "libfrr.h"
static void lde_shutdown(void); static void lde_shutdown(void);
static int lde_dispatch_imsg(struct thread *); static void lde_dispatch_imsg(struct thread *thread);
static int lde_dispatch_parent(struct thread *); static void lde_dispatch_parent(struct thread *thread);
static __inline int lde_nbr_compare(const struct lde_nbr *, static __inline int lde_nbr_compare(const struct lde_nbr *,
const struct lde_nbr *); const struct lde_nbr *);
static struct lde_nbr *lde_nbr_new(uint32_t, struct lde_nbr *); static struct lde_nbr *lde_nbr_new(uint32_t, struct lde_nbr *);
@ -243,8 +243,7 @@ lde_imsg_compose_ldpe(int type, uint32_t peerid, pid_t pid, void *data,
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void lde_dispatch_imsg(struct thread *thread)
lde_dispatch_imsg(struct thread *thread)
{ {
struct imsgev *iev = THREAD_ARG(thread); struct imsgev *iev = THREAD_ARG(thread);
struct imsgbuf *ibuf = &iev->ibuf; struct imsgbuf *ibuf = &iev->ibuf;
@ -422,13 +421,10 @@ lde_dispatch_imsg(struct thread *thread)
thread_cancel(&iev->ev_write); thread_cancel(&iev->ev_write);
lde_shutdown(); lde_shutdown();
} }
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void lde_dispatch_parent(struct thread *thread)
lde_dispatch_parent(struct thread *thread)
{ {
static struct ldpd_conf *nconf; static struct ldpd_conf *nconf;
struct iface *iface, *niface; struct iface *iface, *niface;
@ -710,8 +706,6 @@ lde_dispatch_parent(struct thread *thread)
thread_cancel(&iev->ev_write); thread_cancel(&iev->ev_write);
lde_shutdown(); lde_shutdown();
} }
return (0);
} }
int int
@ -2173,11 +2167,9 @@ lde_address_list_free(struct lde_nbr *ln)
/* /*
* Event callback used to retry the label-manager sync zapi session. * Event callback used to retry the label-manager sync zapi session.
*/ */
static int zclient_sync_retry(struct thread *thread) static void zclient_sync_retry(struct thread *thread)
{ {
zclient_sync_init(); zclient_sync_init();
return 0;
} }
/* /*

View File

@ -227,7 +227,7 @@ void lde_check_withdraw(struct map *, struct lde_nbr *);
void lde_check_withdraw_wcard(struct map *, struct lde_nbr *); void lde_check_withdraw_wcard(struct map *, struct lde_nbr *);
int lde_wildcard_apply(struct map *, struct fec *, int lde_wildcard_apply(struct map *, struct fec *,
struct lde_map *); struct lde_map *);
int lde_gc_timer(struct thread *); void lde_gc_timer(struct thread *thread);
void lde_gc_start_timer(void); void lde_gc_start_timer(void);
void lde_gc_stop_timer(void); void lde_gc_stop_timer(void);

View File

@ -1037,8 +1037,7 @@ lde_wildcard_apply(struct map *wcard, struct fec *fec, struct lde_map *me)
/* gabage collector timer: timer to remove dead entries from the LIB */ /* gabage collector timer: timer to remove dead entries from the LIB */
/* ARGSUSED */ /* ARGSUSED */
int void lde_gc_timer(struct thread *thread)
lde_gc_timer(struct thread *thread)
{ {
struct fec *fec, *safe; struct fec *fec, *safe;
struct fec_node *fn; struct fec_node *fn;
@ -1064,8 +1063,6 @@ lde_gc_timer(struct thread *thread)
log_debug("%s: %u entries removed", __func__, count); log_debug("%s: %u entries removed", __func__, count);
lde_gc_start_timer(); lde_gc_start_timer();
return (0);
} }
void void

View File

@ -46,8 +46,8 @@
static void ldpd_shutdown(void); static void ldpd_shutdown(void);
static pid_t start_child(enum ldpd_process, char *, int, int); static pid_t start_child(enum ldpd_process, char *, int, int);
static int main_dispatch_ldpe(struct thread *); static void main_dispatch_ldpe(struct thread *thread);
static int main_dispatch_lde(struct thread *); static void main_dispatch_lde(struct thread *thread);
static int main_imsg_send_ipc_sockets(struct imsgbuf *, static int main_imsg_send_ipc_sockets(struct imsgbuf *,
struct imsgbuf *); struct imsgbuf *);
static void main_imsg_send_net_sockets(int); static void main_imsg_send_net_sockets(int);
@ -219,7 +219,7 @@ FRR_DAEMON_INFO(ldpd, LDP,
.n_yang_modules = array_size(ldpd_yang_modules), .n_yang_modules = array_size(ldpd_yang_modules),
); );
static int ldp_config_fork_apply(struct thread *t) static void ldp_config_fork_apply(struct thread *t)
{ {
/* /*
* So the frr_config_fork() function schedules * So the frr_config_fork() function schedules
@ -231,8 +231,6 @@ static int ldp_config_fork_apply(struct thread *t)
* after the read in of the config. * after the read in of the config.
*/ */
ldp_config_apply(NULL, vty_conf); ldp_config_apply(NULL, vty_conf);
return 0;
} }
int int
@ -563,8 +561,7 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync)
/* imsg handling */ /* imsg handling */
/* ARGSUSED */ /* ARGSUSED */
static int static void main_dispatch_ldpe(struct thread *thread)
main_dispatch_ldpe(struct thread *thread)
{ {
struct imsgev *iev = THREAD_ARG(thread); struct imsgev *iev = THREAD_ARG(thread);
struct imsgbuf *ibuf = &iev->ibuf; struct imsgbuf *ibuf = &iev->ibuf;
@ -627,13 +624,10 @@ main_dispatch_ldpe(struct thread *thread)
else else
kill(lde_pid, SIGTERM); kill(lde_pid, SIGTERM);
} }
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void main_dispatch_lde(struct thread *thread)
main_dispatch_lde(struct thread *thread)
{ {
struct imsgev *iev = THREAD_ARG(thread); struct imsgev *iev = THREAD_ARG(thread);
struct imsgbuf *ibuf = &iev->ibuf; struct imsgbuf *ibuf = &iev->ibuf;
@ -735,13 +729,10 @@ main_dispatch_lde(struct thread *thread)
else else
kill(ldpe_pid, SIGTERM); kill(ldpe_pid, SIGTERM);
} }
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int void ldp_write_handler(struct thread *thread)
ldp_write_handler(struct thread *thread)
{ {
struct imsgev *iev = THREAD_ARG(thread); struct imsgev *iev = THREAD_ARG(thread);
struct imsgbuf *ibuf = &iev->ibuf; struct imsgbuf *ibuf = &iev->ibuf;
@ -755,12 +746,10 @@ ldp_write_handler(struct thread *thread)
/* this pipe is dead, so remove the event handlers */ /* this pipe is dead, so remove the event handlers */
thread_cancel(&iev->ev_read); thread_cancel(&iev->ev_read);
thread_cancel(&iev->ev_write); thread_cancel(&iev->ev_write);
return (0); return;
} }
imsg_event_add(iev); imsg_event_add(iev);
return (0);
} }
void void
@ -828,9 +817,8 @@ evbuf_event_add(struct evbuf *eb)
&eb->ev); &eb->ev);
} }
void void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct thread *),
evbuf_init(struct evbuf *eb, int fd, int (*handler)(struct thread *), void *arg)
void *arg)
{ {
msgbuf_init(&eb->wbuf); msgbuf_init(&eb->wbuf);
eb->wbuf.fd = fd; eb->wbuf.fd = fd;

View File

@ -63,15 +63,15 @@
struct evbuf { struct evbuf {
struct msgbuf wbuf; struct msgbuf wbuf;
struct thread *ev; struct thread *ev;
int (*handler)(struct thread *); void (*handler)(struct thread *);
void *arg; void *arg;
}; };
struct imsgev { struct imsgev {
struct imsgbuf ibuf; struct imsgbuf ibuf;
int (*handler_write)(struct thread *); void (*handler_write)(struct thread *);
struct thread *ev_write; struct thread *ev_write;
int (*handler_read)(struct thread *); void (*handler_read)(struct thread *);
struct thread *ev_read; struct thread *ev_read;
}; };
@ -792,7 +792,7 @@ void sa2addr(struct sockaddr *, int *, union ldpd_addr *,
socklen_t sockaddr_len(struct sockaddr *); socklen_t sockaddr_len(struct sockaddr *);
/* ldpd.c */ /* ldpd.c */
int ldp_write_handler(struct thread *); void ldp_write_handler(struct thread *thread);
void main_imsg_compose_ldpe(int, pid_t, void *, uint16_t); void main_imsg_compose_ldpe(int, pid_t, void *, uint16_t);
void main_imsg_compose_lde(int, pid_t, void *, uint16_t); void main_imsg_compose_lde(int, pid_t, void *, uint16_t);
int main_imsg_compose_both(enum imsg_type, void *, int main_imsg_compose_both(enum imsg_type, void *,
@ -802,8 +802,7 @@ int imsg_compose_event(struct imsgev *, uint16_t, uint32_t,
pid_t, int, void *, uint16_t); pid_t, int, void *, uint16_t);
void evbuf_enqueue(struct evbuf *, struct ibuf *); void evbuf_enqueue(struct evbuf *, struct ibuf *);
void evbuf_event_add(struct evbuf *); void evbuf_event_add(struct evbuf *);
void evbuf_init(struct evbuf *, int, void evbuf_init(struct evbuf *, int, void (*)(struct thread *), void *);
int (*)(struct thread *), void *);
void evbuf_clear(struct evbuf *); void evbuf_clear(struct evbuf *);
int ldp_acl_request(struct imsgev *, char *, int, int ldp_acl_request(struct imsgev *, char *, int,
union ldpd_addr *, uint8_t); union ldpd_addr *, uint8_t);

View File

@ -36,10 +36,10 @@
#include "libfrr.h" #include "libfrr.h"
static void ldpe_shutdown(void); static void ldpe_shutdown(void);
static int ldpe_dispatch_main(struct thread *); static void ldpe_dispatch_main(struct thread *thread);
static int ldpe_dispatch_lde(struct thread *); static void ldpe_dispatch_lde(struct thread *thread);
#ifdef __OpenBSD__ #ifdef __OpenBSD__
static int ldpe_dispatch_pfkey(struct thread *); static void ldpe_dispatch_pfkey(struct thread *thread);
#endif #endif
static void ldpe_setup_sockets(int, int, int, int); static void ldpe_setup_sockets(int, int, int, int);
static void ldpe_close_sockets(int); static void ldpe_close_sockets(int);
@ -273,8 +273,7 @@ ldpe_imsg_compose_lde(int type, uint32_t peerid, pid_t pid, void *data,
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void ldpe_dispatch_main(struct thread *thread)
ldpe_dispatch_main(struct thread *thread)
{ {
static struct ldpd_conf *nconf; static struct ldpd_conf *nconf;
struct iface *niface; struct iface *niface;
@ -631,13 +630,10 @@ ldpe_dispatch_main(struct thread *thread)
thread_cancel(&iev->ev_write); thread_cancel(&iev->ev_write);
ldpe_shutdown(); ldpe_shutdown();
} }
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
static int static void ldpe_dispatch_lde(struct thread *thread)
ldpe_dispatch_lde(struct thread *thread)
{ {
struct imsgev *iev = THREAD_ARG(thread); struct imsgev *iev = THREAD_ARG(thread);
struct imsgbuf *ibuf = &iev->ibuf; struct imsgbuf *ibuf = &iev->ibuf;
@ -770,14 +766,11 @@ ldpe_dispatch_lde(struct thread *thread)
thread_cancel(&iev->ev_write); thread_cancel(&iev->ev_write);
ldpe_shutdown(); ldpe_shutdown();
} }
return (0);
} }
#ifdef __OpenBSD__ #ifdef __OpenBSD__
/* ARGSUSED */ /* ARGSUSED */
static int static void ldpe_dispatch_pfkey(struct thread *thread)
ldpe_dispatch_pfkey(struct thread *thread)
{ {
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
@ -786,8 +779,6 @@ ldpe_dispatch_pfkey(struct thread *thread)
if (pfkey_read(fd, NULL) == -1) if (pfkey_read(fd, NULL) == -1)
fatal("pfkey_read failed, exiting..."); fatal("pfkey_read failed, exiting...");
return (0);
} }
#endif /* __OpenBSD__ */ #endif /* __OpenBSD__ */

View File

@ -148,7 +148,7 @@ extern struct nbr_pid_head nbrs_by_pid;
/* accept.c */ /* accept.c */
void accept_init(void); void accept_init(void);
int accept_add(int, int (*)(struct thread *), void *); int accept_add(int, void (*)(struct thread *), void *);
void accept_del(int); void accept_del(int);
void accept_pause(void); void accept_pause(void);
void accept_unpause(void); void accept_unpause(void);
@ -292,8 +292,8 @@ int gen_ldp_hdr(struct ibuf *, uint16_t);
int gen_msg_hdr(struct ibuf *, uint16_t, uint16_t); int gen_msg_hdr(struct ibuf *, uint16_t, uint16_t);
int send_packet(int, int, union ldpd_addr *, int send_packet(int, int, union ldpd_addr *,
struct iface_af *, void *, size_t); struct iface_af *, void *, size_t);
int disc_recv_packet(struct thread *); void disc_recv_packet(struct thread *thread);
int session_accept(struct thread *); void session_accept(struct thread *thread);
void session_accept_nbr(struct nbr *, int); void session_accept_nbr(struct nbr *, int);
void session_shutdown(struct nbr *, uint32_t, uint32_t, void session_shutdown(struct nbr *, uint32_t, uint32_t,
uint32_t); uint32_t);

View File

@ -35,13 +35,13 @@ static __inline int nbr_addr_compare(const struct nbr *,
static __inline int nbr_pid_compare(const struct nbr *, static __inline int nbr_pid_compare(const struct nbr *,
const struct nbr *); const struct nbr *);
static void nbr_update_peerid(struct nbr *); static void nbr_update_peerid(struct nbr *);
static int nbr_ktimer(struct thread *); static void nbr_ktimer(struct thread *thread);
static void nbr_start_ktimer(struct nbr *); static void nbr_start_ktimer(struct nbr *);
static int nbr_ktimeout(struct thread *); static void nbr_ktimeout(struct thread *thread);
static void nbr_start_ktimeout(struct nbr *); static void nbr_start_ktimeout(struct nbr *);
static int nbr_itimeout(struct thread *); static void nbr_itimeout(struct thread *thread);
static void nbr_start_itimeout(struct nbr *); static void nbr_start_itimeout(struct nbr *);
static int nbr_idtimer(struct thread *); static void nbr_idtimer(struct thread *thread);
static int nbr_act_session_operational(struct nbr *); static int nbr_act_session_operational(struct nbr *);
static void nbr_send_labelmappings(struct nbr *); static void nbr_send_labelmappings(struct nbr *);
static __inline int nbr_params_compare(const struct nbr_params *, static __inline int nbr_params_compare(const struct nbr_params *,
@ -419,16 +419,13 @@ nbr_session_active_role(struct nbr *nbr)
/* Keepalive timer: timer to send keepalive message to neighbors */ /* Keepalive timer: timer to send keepalive message to neighbors */
static int static void nbr_ktimer(struct thread *thread)
nbr_ktimer(struct thread *thread)
{ {
struct nbr *nbr = THREAD_ARG(thread); struct nbr *nbr = THREAD_ARG(thread);
nbr->keepalive_timer = NULL; nbr->keepalive_timer = NULL;
send_keepalive(nbr); send_keepalive(nbr);
nbr_start_ktimer(nbr); nbr_start_ktimer(nbr);
return (0);
} }
static void static void
@ -451,8 +448,7 @@ nbr_stop_ktimer(struct nbr *nbr)
/* Keepalive timeout: if the nbr hasn't sent keepalive */ /* Keepalive timeout: if the nbr hasn't sent keepalive */
static int static void nbr_ktimeout(struct thread *thread)
nbr_ktimeout(struct thread *thread)
{ {
struct nbr *nbr = THREAD_ARG(thread); struct nbr *nbr = THREAD_ARG(thread);
@ -461,8 +457,6 @@ nbr_ktimeout(struct thread *thread)
log_debug("%s: lsr-id %pI4", __func__, &nbr->id); log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
session_shutdown(nbr, S_KEEPALIVE_TMR, 0, 0); session_shutdown(nbr, S_KEEPALIVE_TMR, 0, 0);
return (0);
} }
static void static void
@ -482,16 +476,13 @@ nbr_stop_ktimeout(struct nbr *nbr)
/* Session initialization timeout: if nbr got stuck in the initialization FSM */ /* Session initialization timeout: if nbr got stuck in the initialization FSM */
static int static void nbr_itimeout(struct thread *thread)
nbr_itimeout(struct thread *thread)
{ {
struct nbr *nbr = THREAD_ARG(thread); struct nbr *nbr = THREAD_ARG(thread);
log_debug("%s: lsr-id %pI4", __func__, &nbr->id); log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
return (0);
} }
static void static void
@ -513,8 +504,7 @@ nbr_stop_itimeout(struct nbr *nbr)
/* Init delay timer: timer to retry to iniziatize session */ /* Init delay timer: timer to retry to iniziatize session */
static int static void nbr_idtimer(struct thread *thread)
nbr_idtimer(struct thread *thread)
{ {
struct nbr *nbr = THREAD_ARG(thread); struct nbr *nbr = THREAD_ARG(thread);
@ -523,8 +513,6 @@ nbr_idtimer(struct thread *thread)
log_debug("%s: lsr-id %pI4", __func__, &nbr->id); log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
nbr_establish_connection(nbr); nbr_establish_connection(nbr);
return (0);
} }
void void
@ -573,8 +561,7 @@ nbr_pending_connect(struct nbr *nbr)
return (nbr->ev_connect != NULL); return (nbr->ev_connect != NULL);
} }
static int static void nbr_connect_cb(struct thread *thread)
nbr_connect_cb(struct thread *thread)
{ {
struct nbr *nbr = THREAD_ARG(thread); struct nbr *nbr = THREAD_ARG(thread);
int error; int error;
@ -585,7 +572,7 @@ nbr_connect_cb(struct thread *thread)
len = sizeof(error); len = sizeof(error);
if (getsockopt(nbr->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { if (getsockopt(nbr->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
log_warn("%s: getsockopt SOL_SOCKET SO_ERROR", __func__); log_warn("%s: getsockopt SOL_SOCKET SO_ERROR", __func__);
return (0); return;
} }
if (error) { if (error) {
@ -593,12 +580,10 @@ nbr_connect_cb(struct thread *thread)
errno = error; errno = error;
log_debug("%s: error while connecting to %s: %s", __func__, log_debug("%s: error while connecting to %s: %s", __func__,
log_addr(nbr->af, &nbr->raddr), strerror(errno)); log_addr(nbr->af, &nbr->raddr), strerror(errno));
return (0); return;
} }
nbr_fsm(nbr, NBR_EVT_CONNECT_UP); nbr_fsm(nbr, NBR_EVT_CONNECT_UP);
return (0);
} }
int int

View File

@ -28,12 +28,12 @@
static struct iface *disc_find_iface(unsigned int, int, static struct iface *disc_find_iface(unsigned int, int,
union ldpd_addr *); union ldpd_addr *);
static int session_read(struct thread *); static void session_read(struct thread *thread);
static int session_write(struct thread *); static void session_write(struct thread *thread);
static ssize_t session_get_pdu(struct ibuf_read *, char **); static ssize_t session_get_pdu(struct ibuf_read *, char **);
static void tcp_close(struct tcp_conn *); static void tcp_close(struct tcp_conn *);
static struct pending_conn *pending_conn_new(int, int, union ldpd_addr *); static struct pending_conn *pending_conn_new(int, int, union ldpd_addr *);
static int pending_conn_timeout(struct thread *); static void pending_conn_timeout(struct thread *thread);
int int
gen_ldp_hdr(struct ibuf *buf, uint16_t size) gen_ldp_hdr(struct ibuf *buf, uint16_t size)
@ -106,8 +106,7 @@ send_packet(int fd, int af, union ldpd_addr *dst, struct iface_af *ia,
} }
/* Discovery functions */ /* Discovery functions */
int void disc_recv_packet(struct thread *thread)
disc_recv_packet(struct thread *thread)
{ {
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
struct thread **threadp = THREAD_ARG(thread); struct thread **threadp = THREAD_ARG(thread);
@ -158,7 +157,7 @@ disc_recv_packet(struct thread *thread)
if (errno != EAGAIN && errno != EINTR) if (errno != EAGAIN && errno != EINTR)
log_debug("%s: read error: %s", __func__, log_debug("%s: read error: %s", __func__,
strerror(errno)); strerror(errno));
return (0); return;
} }
sa2addr((struct sockaddr *)&from, &af, &src, NULL); sa2addr((struct sockaddr *)&from, &af, &src, NULL);
@ -205,7 +204,7 @@ disc_recv_packet(struct thread *thread)
if (bad_addr(af, &src)) { if (bad_addr(af, &src)) {
log_debug("%s: invalid source address: %s", __func__, log_debug("%s: invalid source address: %s", __func__,
log_addr(af, &src)); log_addr(af, &src));
return (0); return;
} }
ifindex = getsockopt_ifindex(af, &m); ifindex = getsockopt_ifindex(af, &m);
@ -213,7 +212,7 @@ disc_recv_packet(struct thread *thread)
if (multicast) { if (multicast) {
iface = disc_find_iface(ifindex, af, &src); iface = disc_find_iface(ifindex, af, &src);
if (iface == NULL) if (iface == NULL)
return (0); return;
} }
/* check packet size */ /* check packet size */
@ -221,7 +220,7 @@ disc_recv_packet(struct thread *thread)
if (len < (LDP_HDR_SIZE + LDP_MSG_SIZE) || len > LDP_MAX_LEN) { if (len < (LDP_HDR_SIZE + LDP_MSG_SIZE) || len > LDP_MAX_LEN) {
log_debug("%s: bad packet size, source %s", __func__, log_debug("%s: bad packet size, source %s", __func__,
log_addr(af, &src)); log_addr(af, &src));
return (0); return;
} }
/* LDP header sanity checks */ /* LDP header sanity checks */
@ -229,12 +228,12 @@ disc_recv_packet(struct thread *thread)
if (ntohs(ldp_hdr.version) != LDP_VERSION) { if (ntohs(ldp_hdr.version) != LDP_VERSION) {
log_debug("%s: invalid LDP version %d, source %s", __func__, log_debug("%s: invalid LDP version %d, source %s", __func__,
ntohs(ldp_hdr.version), log_addr(af, &src)); ntohs(ldp_hdr.version), log_addr(af, &src));
return (0); return;
} }
if (ntohs(ldp_hdr.lspace_id) != 0) { if (ntohs(ldp_hdr.lspace_id) != 0) {
log_debug("%s: invalid label space %u, source %s", __func__, log_debug("%s: invalid label space %u, source %s", __func__,
ntohs(ldp_hdr.lspace_id), log_addr(af, &src)); ntohs(ldp_hdr.lspace_id), log_addr(af, &src));
return (0); return;
} }
/* check "PDU Length" field */ /* check "PDU Length" field */
pdu_len = ntohs(ldp_hdr.length); pdu_len = ntohs(ldp_hdr.length);
@ -242,7 +241,7 @@ disc_recv_packet(struct thread *thread)
(pdu_len > (len - LDP_HDR_DEAD_LEN))) { (pdu_len > (len - LDP_HDR_DEAD_LEN))) {
log_debug("%s: invalid LDP packet length %u, source %s", log_debug("%s: invalid LDP packet length %u, source %s",
__func__, ntohs(ldp_hdr.length), log_addr(af, &src)); __func__, ntohs(ldp_hdr.length), log_addr(af, &src));
return (0); return;
} }
buf += LDP_HDR_SIZE; buf += LDP_HDR_SIZE;
len -= LDP_HDR_SIZE; len -= LDP_HDR_SIZE;
@ -261,7 +260,7 @@ disc_recv_packet(struct thread *thread)
if (msg_len < LDP_MSG_LEN || ((msg_len + LDP_MSG_DEAD_LEN) > pdu_len)) { if (msg_len < LDP_MSG_LEN || ((msg_len + LDP_MSG_DEAD_LEN) > pdu_len)) {
log_debug("%s: invalid LDP message length %u, source %s", log_debug("%s: invalid LDP message length %u, source %s",
__func__, ntohs(msg.length), log_addr(af, &src)); __func__, ntohs(msg.length), log_addr(af, &src));
return (0); return;
} }
buf += LDP_MSG_SIZE; buf += LDP_MSG_SIZE;
len -= LDP_MSG_SIZE; len -= LDP_MSG_SIZE;
@ -275,8 +274,6 @@ disc_recv_packet(struct thread *thread)
log_debug("%s: unknown LDP packet type, source %s", __func__, log_debug("%s: unknown LDP packet type, source %s", __func__,
log_addr(af, &src)); log_addr(af, &src));
} }
return (0);
} }
static struct iface * static struct iface *
@ -304,8 +301,7 @@ disc_find_iface(unsigned int ifindex, int af, union ldpd_addr *src)
return (iface); return (iface);
} }
int void session_accept(struct thread *thread)
session_accept(struct thread *thread)
{ {
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
struct sockaddr_storage src; struct sockaddr_storage src;
@ -328,7 +324,7 @@ session_accept(struct thread *thread)
errno != ECONNABORTED) errno != ECONNABORTED)
log_debug("%s: accept error: %s", __func__, log_debug("%s: accept error: %s", __func__,
strerror(errno)); strerror(errno));
return (0); return;
} }
sock_set_nonblock(newfd); sock_set_nonblock(newfd);
@ -357,22 +353,20 @@ session_accept(struct thread *thread)
close(newfd); close(newfd);
else else
pending_conn_new(newfd, af, &addr); pending_conn_new(newfd, af, &addr);
return (0); return;
} }
/* protection against buggy implementations */ /* protection against buggy implementations */
if (nbr_session_active_role(nbr)) { if (nbr_session_active_role(nbr)) {
close(newfd); close(newfd);
return (0); return;
} }
if (nbr->state != NBR_STA_PRESENT) { if (nbr->state != NBR_STA_PRESENT) {
log_debug("%s: lsr-id %pI4: rejecting additional transport connection", __func__, &nbr->id); log_debug("%s: lsr-id %pI4: rejecting additional transport connection", __func__, &nbr->id);
close(newfd); close(newfd);
return (0); return;
} }
session_accept_nbr(nbr, newfd); session_accept_nbr(nbr, newfd);
return (0);
} }
void void
@ -411,8 +405,7 @@ session_accept_nbr(struct nbr *nbr, int fd)
nbr_fsm(nbr, NBR_EVT_MATCH_ADJ); nbr_fsm(nbr, NBR_EVT_MATCH_ADJ);
} }
static int static void session_read(struct thread *thread)
session_read(struct thread *thread)
{ {
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
struct nbr *nbr = THREAD_ARG(thread); struct nbr *nbr = THREAD_ARG(thread);
@ -431,16 +424,16 @@ session_read(struct thread *thread)
if (errno != EINTR && errno != EAGAIN) { if (errno != EINTR && errno != EAGAIN) {
log_warn("%s: read error", __func__); log_warn("%s: read error", __func__);
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
return (0); return;
} }
/* retry read */ /* retry read */
return (0); return;
} }
if (n == 0) { if (n == 0) {
/* connection closed */ /* connection closed */
log_debug("%s: connection closed by remote end", __func__); log_debug("%s: connection closed by remote end", __func__);
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
return (0); return;
} }
tcp->rbuf->wpos += n; tcp->rbuf->wpos += n;
@ -450,7 +443,7 @@ session_read(struct thread *thread)
if (ntohs(ldp_hdr->version) != LDP_VERSION) { if (ntohs(ldp_hdr->version) != LDP_VERSION) {
session_shutdown(nbr, S_BAD_PROTO_VER, 0, 0); session_shutdown(nbr, S_BAD_PROTO_VER, 0, 0);
free(buf); free(buf);
return (0); return;
} }
pdu_len = ntohs(ldp_hdr->length); pdu_len = ntohs(ldp_hdr->length);
@ -467,14 +460,14 @@ session_read(struct thread *thread)
pdu_len > max_pdu_len) { pdu_len > max_pdu_len) {
session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0); session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0);
free(buf); free(buf);
return (0); return;
} }
pdu_len -= LDP_HDR_PDU_LEN; pdu_len -= LDP_HDR_PDU_LEN;
if (ldp_hdr->lsr_id != nbr->id.s_addr || if (ldp_hdr->lsr_id != nbr->id.s_addr ||
ldp_hdr->lspace_id != 0) { ldp_hdr->lspace_id != 0) {
session_shutdown(nbr, S_BAD_LDP_ID, 0, 0); session_shutdown(nbr, S_BAD_LDP_ID, 0, 0);
free(buf); free(buf);
return (0); return;
} }
pdu += LDP_HDR_SIZE; pdu += LDP_HDR_SIZE;
len -= LDP_HDR_SIZE; len -= LDP_HDR_SIZE;
@ -492,7 +485,7 @@ session_read(struct thread *thread)
session_shutdown(nbr, S_BAD_MSG_LEN, msg->id, session_shutdown(nbr, S_BAD_MSG_LEN, msg->id,
msg->type); msg->type);
free(buf); free(buf);
return (0); return;
} }
msg_size = msg_len + LDP_MSG_DEAD_LEN; msg_size = msg_len + LDP_MSG_DEAD_LEN;
pdu_len -= msg_size; pdu_len -= msg_size;
@ -505,7 +498,7 @@ session_read(struct thread *thread)
session_shutdown(nbr, S_SHUTDOWN, session_shutdown(nbr, S_SHUTDOWN,
msg->id, msg->type); msg->id, msg->type);
free(buf); free(buf);
return (0); return;
} }
break; break;
case MSG_TYPE_KEEPALIVE: case MSG_TYPE_KEEPALIVE:
@ -514,7 +507,7 @@ session_read(struct thread *thread)
session_shutdown(nbr, S_SHUTDOWN, session_shutdown(nbr, S_SHUTDOWN,
msg->id, msg->type); msg->id, msg->type);
free(buf); free(buf);
return (0); return;
} }
break; break;
case MSG_TYPE_NOTIFICATION: case MSG_TYPE_NOTIFICATION:
@ -524,7 +517,7 @@ session_read(struct thread *thread)
session_shutdown(nbr, S_SHUTDOWN, session_shutdown(nbr, S_SHUTDOWN,
msg->id, msg->type); msg->id, msg->type);
free(buf); free(buf);
return (0); return;
} }
break; break;
} }
@ -571,7 +564,7 @@ session_read(struct thread *thread)
if (ret == -1) { if (ret == -1) {
/* parser failed, giving up */ /* parser failed, giving up */
free(buf); free(buf);
return (0); return;
} }
/* no errors - update per neighbor message counters */ /* no errors - update per neighbor message counters */
@ -618,7 +611,7 @@ session_read(struct thread *thread)
buf = NULL; buf = NULL;
if (len != 0) { if (len != 0) {
session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0); session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0);
return (0); return;
} }
} }
@ -626,11 +619,9 @@ session_read(struct thread *thread)
* allocated - but let's get rid of the SA warning. * allocated - but let's get rid of the SA warning.
*/ */
free(buf); free(buf);
return (0);
} }
static int static void session_write(struct thread *thread)
session_write(struct thread *thread)
{ {
struct tcp_conn *tcp = THREAD_ARG(thread); struct tcp_conn *tcp = THREAD_ARG(thread);
struct nbr *nbr = tcp->nbr; struct nbr *nbr = tcp->nbr;
@ -647,12 +638,10 @@ session_write(struct thread *thread)
* close the socket. * close the socket.
*/ */
tcp_close(tcp); tcp_close(tcp);
return (0); return;
} }
evbuf_event_add(&tcp->wbuf); evbuf_event_add(&tcp->wbuf);
return (0);
} }
void void
@ -817,8 +806,7 @@ pending_conn_find(int af, union ldpd_addr *addr)
return (NULL); return (NULL);
} }
static int static void pending_conn_timeout(struct thread *thread)
pending_conn_timeout(struct thread *thread)
{ {
struct pending_conn *pconn = THREAD_ARG(thread); struct pending_conn *pconn = THREAD_ARG(thread);
struct tcp_conn *tcp; struct tcp_conn *tcp;
@ -837,6 +825,4 @@ pending_conn_timeout(struct thread *thread)
msgbuf_write(&tcp->wbuf.wbuf); msgbuf_write(&tcp->wbuf.wbuf);
pending_conn_del(pconn); pending_conn_del(pconn);
return (0);
} }

View File

@ -46,7 +46,7 @@ static struct list *events = NULL;
static void agentx_events_update(void); static void agentx_events_update(void);
static int agentx_timeout(struct thread *t) static void agentx_timeout(struct thread *t)
{ {
timeout_thr = NULL; timeout_thr = NULL;
@ -54,10 +54,9 @@ static int agentx_timeout(struct thread *t)
run_alarms(); run_alarms();
netsnmp_check_outstanding_agent_requests(); netsnmp_check_outstanding_agent_requests();
agentx_events_update(); agentx_events_update();
return 0;
} }
static int agentx_read(struct thread *t) static void agentx_read(struct thread *t)
{ {
fd_set fds; fd_set fds;
int flags, new_flags = 0; int flags, new_flags = 0;
@ -72,7 +71,7 @@ static int agentx_read(struct thread *t)
if (-1 == flags) { if (-1 == flags) {
flog_err(EC_LIB_SYSTEM_CALL, "Failed to get FD settings fcntl: %s(%d)", flog_err(EC_LIB_SYSTEM_CALL, "Failed to get FD settings fcntl: %s(%d)",
strerror(errno), errno); strerror(errno), errno);
return -1; return;
} }
if (flags & O_NONBLOCK) if (flags & O_NONBLOCK)
@ -101,7 +100,6 @@ static int agentx_read(struct thread *t)
netsnmp_check_outstanding_agent_requests(); netsnmp_check_outstanding_agent_requests();
agentx_events_update(); agentx_events_update();
return 0;
} }
static void agentx_events_update(void) static void agentx_events_update(void)

View File

@ -461,14 +461,14 @@ static bool _bfd_sess_valid(const struct bfd_session_params *bsp)
return true; return true;
} }
static int _bfd_sess_send(struct thread *t) static void _bfd_sess_send(struct thread *t)
{ {
struct bfd_session_params *bsp = THREAD_ARG(t); struct bfd_session_params *bsp = THREAD_ARG(t);
int rv; int rv;
/* Validate configuration before trying to send bogus data. */ /* Validate configuration before trying to send bogus data. */
if (!_bfd_sess_valid(bsp)) if (!_bfd_sess_valid(bsp))
return 0; return;
if (bsp->lastev == BSE_INSTALL) { if (bsp->lastev == BSE_INSTALL) {
bsp->args.command = bsp->installed ? ZEBRA_BFD_DEST_UPDATE bsp->args.command = bsp->installed ? ZEBRA_BFD_DEST_UPDATE
@ -478,7 +478,7 @@ static int _bfd_sess_send(struct thread *t)
/* If not installed and asked for uninstall, do nothing. */ /* If not installed and asked for uninstall, do nothing. */
if (!bsp->installed && bsp->args.command == ZEBRA_BFD_DEST_DEREGISTER) if (!bsp->installed && bsp->args.command == ZEBRA_BFD_DEST_DEREGISTER)
return 0; return;
rv = zclient_bfd_command(bsglobal.zc, &bsp->args); rv = zclient_bfd_command(bsglobal.zc, &bsp->args);
/* Command was sent successfully. */ /* Command was sent successfully. */
@ -504,8 +504,6 @@ static int _bfd_sess_send(struct thread *t)
bsp->lastev == BSE_INSTALL ? "installed" bsp->lastev == BSE_INSTALL ? "installed"
: "uninstalled"); : "uninstalled");
} }
return 0;
} }
static void _bfd_sess_remove(struct bfd_session_params *bsp) static void _bfd_sess_remove(struct bfd_session_params *bsp)

View File

@ -237,18 +237,16 @@ void frr_pthread_stop_all(void)
*/ */
/* dummy task for sleeper pipe */ /* dummy task for sleeper pipe */
static int fpt_dummy(struct thread *thread) static void fpt_dummy(struct thread *thread)
{ {
return 0;
} }
/* poison pill task to end event loop */ /* poison pill task to end event loop */
static int fpt_finish(struct thread *thread) static void fpt_finish(struct thread *thread)
{ {
struct frr_pthread *fpt = THREAD_ARG(thread); struct frr_pthread *fpt = THREAD_ARG(thread);
atomic_store_explicit(&fpt->running, false, memory_order_relaxed); atomic_store_explicit(&fpt->running, false, memory_order_relaxed);
return 0;
} }
/* stop function, called from other threads to halt this one */ /* stop function, called from other threads to halt this one */

View File

@ -56,7 +56,7 @@ void frrzmq_finish(void)
} }
} }
static int frrzmq_read_msg(struct thread *t) static void frrzmq_read_msg(struct thread *t)
{ {
struct frrzmq_cb **cbp = THREAD_ARG(t); struct frrzmq_cb **cbp = THREAD_ARG(t);
struct frrzmq_cb *cb; struct frrzmq_cb *cb;
@ -67,10 +67,10 @@ static int frrzmq_read_msg(struct thread *t)
size_t moresz; size_t moresz;
if (!cbp) if (!cbp)
return 1; return;
cb = (*cbp); cb = (*cbp);
if (!cb || !cb->zmqsock) if (!cb || !cb->zmqsock)
return 1; return;
while (1) { while (1) {
zmq_pollitem_t polli = {.socket = cb->zmqsock, zmq_pollitem_t polli = {.socket = cb->zmqsock,
@ -97,7 +97,7 @@ static int frrzmq_read_msg(struct thread *t)
if (cb->write.cancelled && !cb->write.thread) if (cb->write.cancelled && !cb->write.thread)
XFREE(MTYPE_ZEROMQ_CB, *cbp); XFREE(MTYPE_ZEROMQ_CB, *cbp);
return 0; return;
} }
continue; continue;
} }
@ -129,7 +129,7 @@ static int frrzmq_read_msg(struct thread *t)
if (cb->write.cancelled && !cb->write.thread) if (cb->write.cancelled && !cb->write.thread)
XFREE(MTYPE_ZEROMQ_CB, *cbp); XFREE(MTYPE_ZEROMQ_CB, *cbp);
return 0; return;
} }
/* cb_part may have read additional parts of the /* cb_part may have read additional parts of the
@ -153,14 +153,13 @@ static int frrzmq_read_msg(struct thread *t)
thread_add_read(t->master, frrzmq_read_msg, cbp, thread_add_read(t->master, frrzmq_read_msg, cbp,
cb->fd, &cb->read.thread); cb->fd, &cb->read.thread);
return 0; return;
out_err: out_err:
flog_err(EC_LIB_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno), flog_err(EC_LIB_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno),
errno); errno);
if (cb->read.cb_error) if (cb->read.cb_error)
cb->read.cb_error(cb->read.arg, cb->zmqsock); cb->read.cb_error(cb->read.arg, cb->zmqsock);
return 1;
} }
int _frrzmq_thread_add_read(const struct xref_threadsched *xref, int _frrzmq_thread_add_read(const struct xref_threadsched *xref,
@ -215,7 +214,7 @@ int _frrzmq_thread_add_read(const struct xref_threadsched *xref,
return 0; return 0;
} }
static int frrzmq_write_msg(struct thread *t) static void frrzmq_write_msg(struct thread *t)
{ {
struct frrzmq_cb **cbp = THREAD_ARG(t); struct frrzmq_cb **cbp = THREAD_ARG(t);
struct frrzmq_cb *cb; struct frrzmq_cb *cb;
@ -223,10 +222,10 @@ static int frrzmq_write_msg(struct thread *t)
int ret; int ret;
if (!cbp) if (!cbp)
return 1; return;
cb = (*cbp); cb = (*cbp);
if (!cb || !cb->zmqsock) if (!cb || !cb->zmqsock)
return 1; return;
while (1) { while (1) {
zmq_pollitem_t polli = {.socket = cb->zmqsock, zmq_pollitem_t polli = {.socket = cb->zmqsock,
@ -252,7 +251,7 @@ static int frrzmq_write_msg(struct thread *t)
if (cb->read.cancelled && !cb->read.thread) if (cb->read.cancelled && !cb->read.thread)
XFREE(MTYPE_ZEROMQ_CB, *cbp); XFREE(MTYPE_ZEROMQ_CB, *cbp);
return 0; return;
} }
continue; continue;
} }
@ -263,14 +262,13 @@ static int frrzmq_write_msg(struct thread *t)
thread_add_write(t->master, frrzmq_write_msg, cbp, thread_add_write(t->master, frrzmq_write_msg, cbp,
cb->fd, &cb->write.thread); cb->fd, &cb->write.thread);
return 0; return;
out_err: out_err:
flog_err(EC_LIB_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno), flog_err(EC_LIB_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno),
errno); errno);
if (cb->write.cb_error) if (cb->write.cb_error)
cb->write.cb_error(cb->write.arg, cb->zmqsock); cb->write.cb_error(cb->write.arg, cb->zmqsock);
return 1;
} }
int _frrzmq_thread_add_write(const struct xref_threadsched *xref, int _frrzmq_thread_add_write(const struct xref_threadsched *xref,

View File

@ -962,7 +962,7 @@ static void frr_daemonize(void)
* to read the config in after thread execution starts, so that * to read the config in after thread execution starts, so that
* we can match this behavior. * we can match this behavior.
*/ */
static int frr_config_read_in(struct thread *t) static void frr_config_read_in(struct thread *t)
{ {
hook_call(frr_config_pre, master); hook_call(frr_config_pre, master);
@ -1000,8 +1000,6 @@ static int frr_config_read_in(struct thread *t)
} }
hook_call(frr_config_post, master); hook_call(frr_config_post, master);
return 0;
} }
void frr_config_fork(void) void frr_config_fork(void)
@ -1097,7 +1095,7 @@ static void frr_terminal_close(int isexit)
static struct thread *daemon_ctl_thread = NULL; static struct thread *daemon_ctl_thread = NULL;
static int frr_daemon_ctl(struct thread *t) static void frr_daemon_ctl(struct thread *t)
{ {
char buf[1]; char buf[1];
ssize_t nr; ssize_t nr;
@ -1106,7 +1104,7 @@ static int frr_daemon_ctl(struct thread *t)
if (nr < 0 && (errno == EINTR || errno == EAGAIN)) if (nr < 0 && (errno == EINTR || errno == EAGAIN))
goto out; goto out;
if (nr <= 0) if (nr <= 0)
return 0; return;
switch (buf[0]) { switch (buf[0]) {
case 'S': /* SIGTSTP */ case 'S': /* SIGTSTP */
@ -1131,7 +1129,6 @@ static int frr_daemon_ctl(struct thread *t)
out: out:
thread_add_read(master, frr_daemon_ctl, NULL, daemon_ctl_sock, thread_add_read(master, frr_daemon_ctl, NULL, daemon_ctl_sock,
&daemon_ctl_thread); &daemon_ctl_thread);
return 0;
} }
void frr_detach(void) void frr_detach(void)

View File

@ -347,7 +347,7 @@ int nb_cli_confirmed_commit_rollback(struct vty *vty)
return ret; return ret;
} }
static int nb_cli_confirmed_commit_timeout(struct thread *thread) static void nb_cli_confirmed_commit_timeout(struct thread *thread)
{ {
struct vty *vty = THREAD_ARG(thread); struct vty *vty = THREAD_ARG(thread);
@ -357,8 +357,6 @@ static int nb_cli_confirmed_commit_timeout(struct thread *thread)
nb_cli_confirmed_commit_rollback(vty); nb_cli_confirmed_commit_rollback(vty);
nb_cli_confirmed_commit_clean(vty); nb_cli_confirmed_commit_clean(vty);
return 0;
} }
static int nb_cli_commit(struct vty *vty, bool force, static int nb_cli_commit(struct vty *vty, bool force,

View File

@ -283,7 +283,7 @@ frr_confd_cdb_diff_iter(confd_hkeypath_t *kp, enum cdb_iter_op cdb_op,
return ITER_RECURSE; return ITER_RECURSE;
} }
static int frr_confd_cdb_read_cb_prepare(int fd, int *subp, int reslen) static void frr_confd_cdb_read_cb_prepare(int fd, int *subp, int reslen)
{ {
struct nb_context context = {}; struct nb_context context = {};
struct nb_config *candidate; struct nb_config *candidate;
@ -313,9 +313,9 @@ static int frr_confd_cdb_read_cb_prepare(int fd, int *subp, int reslen)
0, "Couldn't apply configuration changes") 0, "Couldn't apply configuration changes")
!= CONFD_OK) { != CONFD_OK) {
flog_err_confd("cdb_sub_abort_trans"); flog_err_confd("cdb_sub_abort_trans");
return -1; return;
} }
return 0; return;
} }
/* /*
@ -346,25 +346,23 @@ static int frr_confd_cdb_read_cb_prepare(int fd, int *subp, int reslen)
errmsg) errmsg)
!= CONFD_OK) { != CONFD_OK) {
flog_err_confd("cdb_sub_abort_trans"); flog_err_confd("cdb_sub_abort_trans");
return -1; return;
} }
} else { } else {
/* Acknowledge the notification. */ /* Acknowledge the notification. */
if (cdb_sync_subscription_socket(fd, CDB_DONE_PRIORITY) if (cdb_sync_subscription_socket(fd, CDB_DONE_PRIORITY)
!= CONFD_OK) { != CONFD_OK) {
flog_err_confd("cdb_sync_subscription_socket"); flog_err_confd("cdb_sync_subscription_socket");
return -1; return;
} }
/* No configuration changes. */ /* No configuration changes. */
if (!transaction) if (!transaction)
nb_config_free(candidate); nb_config_free(candidate);
} }
return 0;
} }
static int frr_confd_cdb_read_cb_commit(int fd, int *subp, int reslen) static void frr_confd_cdb_read_cb_commit(int fd, int *subp, int reslen)
{ {
/* /*
* No need to process the configuration changes again as we're already * No need to process the configuration changes again as we're already
@ -385,10 +383,8 @@ static int frr_confd_cdb_read_cb_commit(int fd, int *subp, int reslen)
/* Acknowledge the notification. */ /* Acknowledge the notification. */
if (cdb_sync_subscription_socket(fd, CDB_DONE_PRIORITY) != CONFD_OK) { if (cdb_sync_subscription_socket(fd, CDB_DONE_PRIORITY) != CONFD_OK) {
flog_err_confd("cdb_sync_subscription_socket"); flog_err_confd("cdb_sync_subscription_socket");
return -1; return;
} }
return 0;
} }
static int frr_confd_cdb_read_cb_abort(int fd, int *subp, int reslen) static int frr_confd_cdb_read_cb_abort(int fd, int *subp, int reslen)
@ -417,7 +413,7 @@ static int frr_confd_cdb_read_cb_abort(int fd, int *subp, int reslen)
return 0; return 0;
} }
static int frr_confd_cdb_read_cb(struct thread *thread) static void frr_confd_cdb_read_cb(struct thread *thread)
{ {
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
enum cdb_sub_notification cdb_ev; enum cdb_sub_notification cdb_ev;
@ -430,19 +426,22 @@ static int frr_confd_cdb_read_cb(struct thread *thread)
if (cdb_read_subscription_socket2(fd, &cdb_ev, &flags, &subp, &reslen) if (cdb_read_subscription_socket2(fd, &cdb_ev, &flags, &subp, &reslen)
!= CONFD_OK) { != CONFD_OK) {
flog_err_confd("cdb_read_subscription_socket2"); flog_err_confd("cdb_read_subscription_socket2");
return -1; return;
} }
switch (cdb_ev) { switch (cdb_ev) {
case CDB_SUB_PREPARE: case CDB_SUB_PREPARE:
return frr_confd_cdb_read_cb_prepare(fd, subp, reslen); frr_confd_cdb_read_cb_prepare(fd, subp, reslen);
break;
case CDB_SUB_COMMIT: case CDB_SUB_COMMIT:
return frr_confd_cdb_read_cb_commit(fd, subp, reslen); frr_confd_cdb_read_cb_commit(fd, subp, reslen);
break;
case CDB_SUB_ABORT: case CDB_SUB_ABORT:
return frr_confd_cdb_read_cb_abort(fd, subp, reslen); frr_confd_cdb_read_cb_abort(fd, subp, reslen);
break;
default: default:
flog_err_confd("unknown CDB event"); flog_err_confd("unknown CDB event");
return -1; break;
} }
} }
@ -1186,7 +1185,7 @@ static int frr_confd_dp_read(struct confd_daemon_ctx *dctx, int fd)
return 0; return 0;
} }
static int frr_confd_dp_ctl_read(struct thread *thread) static void frr_confd_dp_ctl_read(struct thread *thread)
{ {
struct confd_daemon_ctx *dctx = THREAD_ARG(thread); struct confd_daemon_ctx *dctx = THREAD_ARG(thread);
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
@ -1194,11 +1193,9 @@ static int frr_confd_dp_ctl_read(struct thread *thread)
thread_add_read(master, frr_confd_dp_ctl_read, dctx, fd, &t_dp_ctl); thread_add_read(master, frr_confd_dp_ctl_read, dctx, fd, &t_dp_ctl);
frr_confd_dp_read(dctx, fd); frr_confd_dp_read(dctx, fd);
return 0;
} }
static int frr_confd_dp_worker_read(struct thread *thread) static void frr_confd_dp_worker_read(struct thread *thread)
{ {
struct confd_daemon_ctx *dctx = THREAD_ARG(thread); struct confd_daemon_ctx *dctx = THREAD_ARG(thread);
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
@ -1206,8 +1203,6 @@ static int frr_confd_dp_worker_read(struct thread *thread)
thread_add_read(master, frr_confd_dp_worker_read, dctx, fd, &t_dp_worker); thread_add_read(master, frr_confd_dp_worker_read, dctx, fd, &t_dp_worker);
frr_confd_dp_read(dctx, fd); frr_confd_dp_read(dctx, fd);
return 0;
} }
static int frr_confd_subscribe_state(const struct lysc_node *snode, void *arg) static int frr_confd_subscribe_state(const struct lysc_node *snode, void *arg)

View File

@ -206,7 +206,7 @@ template <typename Q, typename S> class NewRpcState : RpcStateBase
} }
static int c_callback(struct thread *thread) static void c_callback(struct thread *thread)
{ {
auto _tag = static_cast<NewRpcState<Q, S> *>(thread->arg); auto _tag = static_cast<NewRpcState<Q, S> *>(thread->arg);
/* /*
@ -225,7 +225,7 @@ template <typename Q, typename S> class NewRpcState : RpcStateBase
pthread_cond_signal(&_tag->cond); pthread_cond_signal(&_tag->cond);
pthread_mutex_unlock(&_tag->cmux); pthread_mutex_unlock(&_tag->cmux);
return 0; return;
} }
NewRpcState<Q, S> *orig; NewRpcState<Q, S> *orig;
@ -1368,7 +1368,7 @@ static int frr_grpc_finish(void)
* fork. This is done by scheduling this init function as an event task, since * fork. This is done by scheduling this init function as an event task, since
* the event loop doesn't run until after fork. * the event loop doesn't run until after fork.
*/ */
static int frr_grpc_module_very_late_init(struct thread *thread) static void frr_grpc_module_very_late_init(struct thread *thread)
{ {
const char *args = THIS_MODULE->load_args; const char *args = THIS_MODULE->load_args;
uint port = GRPC_DEFAULT_PORT; uint port = GRPC_DEFAULT_PORT;
@ -1386,11 +1386,10 @@ static int frr_grpc_module_very_late_init(struct thread *thread)
if (frr_grpc_init(port) < 0) if (frr_grpc_init(port) < 0)
goto error; goto error;
return 0; return;
error: error:
flog_err(EC_LIB_GRPC_INIT, "failed to initialize the gRPC module"); flog_err(EC_LIB_GRPC_INIT, "failed to initialize the gRPC module");
return -1;
} }
static int frr_grpc_module_late_init(struct thread_master *tm) static int frr_grpc_module_late_init(struct thread_master *tm)

View File

@ -41,7 +41,7 @@ static sr_session_ctx_t *session;
static sr_conn_ctx_t *connection; static sr_conn_ctx_t *connection;
static struct nb_transaction *transaction; static struct nb_transaction *transaction;
static int frr_sr_read_cb(struct thread *thread); static void frr_sr_read_cb(struct thread *thread);
static int frr_sr_finish(void); static int frr_sr_finish(void);
/* Convert FRR YANG data value to sysrepo YANG data value. */ /* Convert FRR YANG data value to sysrepo YANG data value. */
@ -526,7 +526,7 @@ static int frr_sr_notification_send(const char *xpath, struct list *arguments)
return NB_OK; return NB_OK;
} }
static int frr_sr_read_cb(struct thread *thread) static void frr_sr_read_cb(struct thread *thread)
{ {
struct yang_module *module = THREAD_ARG(thread); struct yang_module *module = THREAD_ARG(thread);
int fd = THREAD_FD(thread); int fd = THREAD_FD(thread);
@ -536,12 +536,10 @@ static int frr_sr_read_cb(struct thread *thread)
if (ret != SR_ERR_OK) { if (ret != SR_ERR_OK) {
flog_err(EC_LIB_LIBSYSREPO, "%s: sr_fd_event_process(): %s", flog_err(EC_LIB_LIBSYSREPO, "%s: sr_fd_event_process(): %s",
__func__, sr_strerror(ret)); __func__, sr_strerror(ret));
return -1; return;
} }
thread_add_read(master, frr_sr_read_cb, module, fd, &module->sr_thread); thread_add_read(master, frr_sr_read_cb, module, fd, &module->sr_thread);
return 0;
} }
static void frr_sr_subscribe_config(struct yang_module *module) static void frr_sr_subscribe_config(struct yang_module *module)

View File

@ -51,7 +51,7 @@ struct pullwr {
DEFINE_MTYPE_STATIC(LIB, PULLWR_HEAD, "pull-driven write controller"); DEFINE_MTYPE_STATIC(LIB, PULLWR_HEAD, "pull-driven write controller");
DEFINE_MTYPE_STATIC(LIB, PULLWR_BUF, "pull-driven write buffer"); DEFINE_MTYPE_STATIC(LIB, PULLWR_BUF, "pull-driven write buffer");
static int pullwr_run(struct thread *t); static void pullwr_run(struct thread *t);
struct pullwr *_pullwr_new(struct thread_master *tm, int fd, struct pullwr *_pullwr_new(struct thread_master *tm, int fd,
void *arg, void *arg,
@ -189,7 +189,7 @@ void pullwr_write(struct pullwr *pullwr, const void *data, size_t len)
pullwr_bump(pullwr); pullwr_bump(pullwr);
} }
static int pullwr_run(struct thread *t) static void pullwr_run(struct thread *t)
{ {
struct pullwr *pullwr = THREAD_ARG(t); struct pullwr *pullwr = THREAD_ARG(t);
struct iovec iov[2]; struct iovec iov[2];
@ -222,7 +222,7 @@ static int pullwr_run(struct thread *t)
* into idle, i.e. no calling thread_add_write() * into idle, i.e. no calling thread_add_write()
*/ */
pullwr_resize(pullwr, 0); pullwr_resize(pullwr, 0);
return 0; return;
} }
niov = pullwr_iov(pullwr, iov); niov = pullwr_iov(pullwr, iov);
@ -233,12 +233,12 @@ static int pullwr_run(struct thread *t)
if (errno == EAGAIN || errno == EWOULDBLOCK) if (errno == EAGAIN || errno == EWOULDBLOCK)
break; break;
pullwr->err(pullwr->arg, pullwr, false); pullwr->err(pullwr->arg, pullwr, false);
return 0; return;
} }
if (nwr == 0) { if (nwr == 0) {
pullwr->err(pullwr->arg, pullwr, true); pullwr->err(pullwr->arg, pullwr, true);
return 0; return;
} }
pullwr->total_written += nwr; pullwr->total_written += nwr;
@ -258,7 +258,6 @@ static int pullwr_run(struct thread *t)
*/ */
if (!maxspun) if (!maxspun)
pullwr_resize(pullwr, 0); pullwr_resize(pullwr, 0);
return 0;
} }
void pullwr_stats(struct pullwr *pullwr, uint64_t *total_written, void pullwr_stats(struct pullwr *pullwr, uint64_t *total_written,

View File

@ -104,17 +104,15 @@ static void resolver_fd_drop_maybe(struct resolver_fd *resfd)
static void resolver_update_timeouts(struct resolver_state *r); static void resolver_update_timeouts(struct resolver_state *r);
static int resolver_cb_timeout(struct thread *t) static void resolver_cb_timeout(struct thread *t)
{ {
struct resolver_state *r = THREAD_ARG(t); struct resolver_state *r = THREAD_ARG(t);
ares_process(r->channel, NULL, NULL); ares_process(r->channel, NULL, NULL);
resolver_update_timeouts(r); resolver_update_timeouts(r);
return 0;
} }
static int resolver_cb_socket_readable(struct thread *t) static void resolver_cb_socket_readable(struct thread *t)
{ {
struct resolver_fd *resfd = THREAD_ARG(t); struct resolver_fd *resfd = THREAD_ARG(t);
struct resolver_state *r = resfd->state; struct resolver_state *r = resfd->state;
@ -127,11 +125,9 @@ static int resolver_cb_socket_readable(struct thread *t)
*/ */
ares_process_fd(r->channel, resfd->fd, ARES_SOCKET_BAD); ares_process_fd(r->channel, resfd->fd, ARES_SOCKET_BAD);
resolver_update_timeouts(r); resolver_update_timeouts(r);
return 0;
} }
static int resolver_cb_socket_writable(struct thread *t) static void resolver_cb_socket_writable(struct thread *t)
{ {
struct resolver_fd *resfd = THREAD_ARG(t); struct resolver_fd *resfd = THREAD_ARG(t);
struct resolver_state *r = resfd->state; struct resolver_state *r = resfd->state;
@ -144,8 +140,6 @@ static int resolver_cb_socket_writable(struct thread *t)
*/ */
ares_process_fd(r->channel, ARES_SOCKET_BAD, resfd->fd); ares_process_fd(r->channel, ARES_SOCKET_BAD, resfd->fd);
resolver_update_timeouts(r); resolver_update_timeouts(r);
return 0;
} }
static void resolver_update_timeouts(struct resolver_state *r) static void resolver_update_timeouts(struct resolver_state *r)
@ -232,7 +226,7 @@ static void ares_address_cb(void *arg, int status, int timeouts,
callback(query, NULL, i, &addr[0]); callback(query, NULL, i, &addr[0]);
} }
static int resolver_cb_literal(struct thread *t) static void resolver_cb_literal(struct thread *t)
{ {
struct resolver_query *query = THREAD_ARG(t); struct resolver_query *query = THREAD_ARG(t);
void (*callback)(struct resolver_query *, const char *, int, void (*callback)(struct resolver_query *, const char *, int,
@ -242,7 +236,6 @@ static int resolver_cb_literal(struct thread *t)
query->callback = NULL; query->callback = NULL;
callback(query, ARES_SUCCESS, 1, &query->literal_addr); callback(query, ARES_SUCCESS, 1, &query->literal_addr);
return 0;
} }
void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id,

View File

@ -143,7 +143,7 @@ int frr_sigevent_process(void)
#ifdef SIGEVENT_SCHEDULE_THREAD #ifdef SIGEVENT_SCHEDULE_THREAD
/* timer thread to check signals. shouldn't be needed */ /* timer thread to check signals. shouldn't be needed */
int frr_signal_timer(struct thread *t) void frr_signal_timer(struct thread *t)
{ {
struct frr_sigevent_master_t *sigm; struct frr_sigevent_master_t *sigm;
@ -151,7 +151,7 @@ int frr_signal_timer(struct thread *t)
sigm->t = NULL; sigm->t = NULL;
thread_add_timer(sigm->t->master, frr_signal_timer, &sigmaster, thread_add_timer(sigm->t->master, frr_signal_timer, &sigmaster,
FRR_SIGNAL_TIMER_INTERVAL, &sigm->t); FRR_SIGNAL_TIMER_INTERVAL, &sigm->t);
return frr_sigevent_process(); frr_sigevent_process();
} }
#endif /* SIGEVENT_SCHEDULE_THREAD */ #endif /* SIGEVENT_SCHEDULE_THREAD */

View File

@ -117,17 +117,16 @@ void spf_backoff_free(struct spf_backoff *backoff)
XFREE(MTYPE_SPF_BACKOFF, backoff); XFREE(MTYPE_SPF_BACKOFF, backoff);
} }
static int spf_backoff_timetolearn_elapsed(struct thread *thread) static void spf_backoff_timetolearn_elapsed(struct thread *thread)
{ {
struct spf_backoff *backoff = THREAD_ARG(thread); struct spf_backoff *backoff = THREAD_ARG(thread);
backoff->state = SPF_BACKOFF_LONG_WAIT; backoff->state = SPF_BACKOFF_LONG_WAIT;
backoff_debug("SPF Back-off(%s) TIMETOLEARN elapsed, move to state %s", backoff_debug("SPF Back-off(%s) TIMETOLEARN elapsed, move to state %s",
backoff->name, spf_backoff_state2str(backoff->state)); backoff->name, spf_backoff_state2str(backoff->state));
return 0;
} }
static int spf_backoff_holddown_elapsed(struct thread *thread) static void spf_backoff_holddown_elapsed(struct thread *thread)
{ {
struct spf_backoff *backoff = THREAD_ARG(thread); struct spf_backoff *backoff = THREAD_ARG(thread);
@ -136,7 +135,6 @@ static int spf_backoff_holddown_elapsed(struct thread *thread)
backoff->state = SPF_BACKOFF_QUIET; backoff->state = SPF_BACKOFF_QUIET;
backoff_debug("SPF Back-off(%s) HOLDDOWN elapsed, move to state %s", backoff_debug("SPF Back-off(%s) HOLDDOWN elapsed, move to state %s",
backoff->name, spf_backoff_state2str(backoff->state)); backoff->name, spf_backoff_state2str(backoff->state));
return 0;
} }
long spf_backoff_schedule(struct spf_backoff *backoff) long spf_backoff_schedule(struct spf_backoff *backoff)

View File

@ -80,14 +80,13 @@ void systemd_send_stopping(void)
static struct thread_master *systemd_master = NULL; static struct thread_master *systemd_master = NULL;
static int systemd_send_watchdog(struct thread *t) static void systemd_send_watchdog(struct thread *t)
{ {
systemd_send_information("WATCHDOG=1"); systemd_send_information("WATCHDOG=1");
assert(watchdog_msec > 0); assert(watchdog_msec > 0);
thread_add_timer_msec(systemd_master, systemd_send_watchdog, NULL, thread_add_timer_msec(systemd_master, systemd_send_watchdog, NULL,
watchdog_msec, NULL); watchdog_msec, NULL);
return 1;
} }
void systemd_send_started(struct thread_master *m) void systemd_send_started(struct thread_master *m)

View File

@ -773,7 +773,7 @@ char *thread_timer_to_hhmmss(char *buf, int buf_size,
/* Get new thread. */ /* Get new thread. */
static struct thread *thread_get(struct thread_master *m, uint8_t type, static struct thread *thread_get(struct thread_master *m, uint8_t type,
int (*func)(struct thread *), void *arg, void (*func)(struct thread *), void *arg,
const struct xref_threadsched *xref) const struct xref_threadsched *xref)
{ {
struct thread *thread = thread_list_pop(&m->unuse); struct thread *thread = thread_list_pop(&m->unuse);
@ -930,7 +930,7 @@ done:
/* Add new read thread. */ /* Add new read thread. */
void _thread_add_read_write(const struct xref_threadsched *xref, void _thread_add_read_write(const struct xref_threadsched *xref,
struct thread_master *m, struct thread_master *m,
int (*func)(struct thread *), void *arg, int fd, void (*func)(struct thread *), void *arg, int fd,
struct thread **t_ptr) struct thread **t_ptr)
{ {
int dir = xref->thread_type; int dir = xref->thread_type;
@ -1010,7 +1010,7 @@ void _thread_add_read_write(const struct xref_threadsched *xref,
static void _thread_add_timer_timeval(const struct xref_threadsched *xref, static void _thread_add_timer_timeval(const struct xref_threadsched *xref,
struct thread_master *m, struct thread_master *m,
int (*func)(struct thread *), void *arg, void (*func)(struct thread *), void *arg,
struct timeval *time_relative, struct timeval *time_relative,
struct thread **t_ptr) struct thread **t_ptr)
{ {
@ -1057,7 +1057,7 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref,
/* Add timer event thread. */ /* Add timer event thread. */
void _thread_add_timer(const struct xref_threadsched *xref, void _thread_add_timer(const struct xref_threadsched *xref,
struct thread_master *m, int (*func)(struct thread *), struct thread_master *m, void (*func)(struct thread *),
void *arg, long timer, struct thread **t_ptr) void *arg, long timer, struct thread **t_ptr)
{ {
struct timeval trel; struct timeval trel;
@ -1073,8 +1073,8 @@ void _thread_add_timer(const struct xref_threadsched *xref,
/* Add timer event thread with "millisecond" resolution */ /* Add timer event thread with "millisecond" resolution */
void _thread_add_timer_msec(const struct xref_threadsched *xref, void _thread_add_timer_msec(const struct xref_threadsched *xref,
struct thread_master *m, struct thread_master *m,
int (*func)(struct thread *), void *arg, long timer, void (*func)(struct thread *), void *arg,
struct thread **t_ptr) long timer, struct thread **t_ptr)
{ {
struct timeval trel; struct timeval trel;
@ -1088,15 +1088,16 @@ void _thread_add_timer_msec(const struct xref_threadsched *xref,
/* Add timer event thread with "timeval" resolution */ /* Add timer event thread with "timeval" resolution */
void _thread_add_timer_tv(const struct xref_threadsched *xref, void _thread_add_timer_tv(const struct xref_threadsched *xref,
struct thread_master *m, int (*func)(struct thread *), struct thread_master *m,
void *arg, struct timeval *tv, struct thread **t_ptr) void (*func)(struct thread *), void *arg,
struct timeval *tv, struct thread **t_ptr)
{ {
_thread_add_timer_timeval(xref, m, func, arg, tv, t_ptr); _thread_add_timer_timeval(xref, m, func, arg, tv, t_ptr);
} }
/* Add simple event thread. */ /* Add simple event thread. */
void _thread_add_event(const struct xref_threadsched *xref, void _thread_add_event(const struct xref_threadsched *xref,
struct thread_master *m, int (*func)(struct thread *), struct thread_master *m, void (*func)(struct thread *),
void *arg, int val, struct thread **t_ptr) void *arg, int val, struct thread **t_ptr)
{ {
struct thread *thread = NULL; struct thread *thread = NULL;
@ -2008,7 +2009,7 @@ void thread_call(struct thread *thread)
/* Execute thread */ /* Execute thread */
void _thread_execute(const struct xref_threadsched *xref, void _thread_execute(const struct xref_threadsched *xref,
struct thread_master *m, int (*func)(struct thread *), struct thread_master *m, void (*func)(struct thread *),
void *arg, int val) void *arg, int val)
{ {
struct thread *thread; struct thread *thread;

View File

@ -114,7 +114,7 @@ struct thread {
struct thread_timer_list_item timeritem; struct thread_timer_list_item timeritem;
struct thread **ref; /* external reference (if given) */ struct thread **ref; /* external reference (if given) */
struct thread_master *master; /* pointer to the struct thread_master */ struct thread_master *master; /* pointer to the struct thread_master */
int (*func)(struct thread *); /* event function */ void (*func)(struct thread *); /* event function */
void *arg; /* event argument */ void *arg; /* event argument */
union { union {
int val; /* second argument of the event. */ int val; /* second argument of the event. */
@ -134,7 +134,7 @@ struct thread {
#endif #endif
struct cpu_thread_history { struct cpu_thread_history {
int (*func)(struct thread *); void (*func)(struct thread *);
atomic_size_t total_cpu_warn; atomic_size_t total_cpu_warn;
atomic_size_t total_wall_warn; atomic_size_t total_wall_warn;
atomic_size_t total_starv_warn; atomic_size_t total_starv_warn;
@ -227,32 +227,32 @@ extern void thread_master_free_unused(struct thread_master *);
extern void _thread_add_read_write(const struct xref_threadsched *xref, extern void _thread_add_read_write(const struct xref_threadsched *xref,
struct thread_master *master, struct thread_master *master,
int (*fn)(struct thread *), void *arg, void (*fn)(struct thread *), void *arg,
int fd, struct thread **tref); int fd, struct thread **tref);
extern void _thread_add_timer(const struct xref_threadsched *xref, extern void _thread_add_timer(const struct xref_threadsched *xref,
struct thread_master *master, struct thread_master *master,
int (*fn)(struct thread *), void *arg, long t, void (*fn)(struct thread *), void *arg, long t,
struct thread **tref); struct thread **tref);
extern void _thread_add_timer_msec(const struct xref_threadsched *xref, extern void _thread_add_timer_msec(const struct xref_threadsched *xref,
struct thread_master *master, struct thread_master *master,
int (*fn)(struct thread *), void *arg, void (*fn)(struct thread *), void *arg,
long t, struct thread **tref); long t, struct thread **tref);
extern void _thread_add_timer_tv(const struct xref_threadsched *xref, extern void _thread_add_timer_tv(const struct xref_threadsched *xref,
struct thread_master *master, struct thread_master *master,
int (*fn)(struct thread *), void *arg, void (*fn)(struct thread *), void *arg,
struct timeval *tv, struct thread **tref); struct timeval *tv, struct thread **tref);
extern void _thread_add_event(const struct xref_threadsched *xref, extern void _thread_add_event(const struct xref_threadsched *xref,
struct thread_master *master, struct thread_master *master,
int (*fn)(struct thread *), void *arg, int val, void (*fn)(struct thread *), void *arg, int val,
struct thread **tref); struct thread **tref);
extern void _thread_execute(const struct xref_threadsched *xref, extern void _thread_execute(const struct xref_threadsched *xref,
struct thread_master *master, struct thread_master *master,
int (*fn)(struct thread *), void *arg, int val); void (*fn)(struct thread *), void *arg, int val);
extern void thread_cancel(struct thread **event); extern void thread_cancel(struct thread **event);
extern void thread_cancel_async(struct thread_master *, struct thread **, extern void thread_cancel_async(struct thread_master *, struct thread **,

View File

@ -1299,7 +1299,7 @@ static void vty_buffer_reset(struct vty *vty)
} }
/* Read data via vty socket. */ /* Read data via vty socket. */
static int vty_read(struct thread *thread) static void vty_read(struct thread *thread)
{ {
int i; int i;
int nbytes; int nbytes;
@ -1312,7 +1312,7 @@ static int vty_read(struct thread *thread)
if (nbytes < 0) { if (nbytes < 0) {
if (ERRNO_IO_RETRY(errno)) { if (ERRNO_IO_RETRY(errno)) {
vty_event(VTY_READ, vty); vty_event(VTY_READ, vty);
return 0; return;
} }
vty->monitor = 0; /* disable monitoring to avoid vty->monitor = 0; /* disable monitoring to avoid
infinite recursion */ infinite recursion */
@ -1496,11 +1496,10 @@ static int vty_read(struct thread *thread)
vty_event(VTY_WRITE, vty); vty_event(VTY_WRITE, vty);
vty_event(VTY_READ, vty); vty_event(VTY_READ, vty);
} }
return 0;
} }
/* Flush buffer to the vty. */ /* Flush buffer to the vty. */
static int vty_flush(struct thread *thread) static void vty_flush(struct thread *thread)
{ {
int erase; int erase;
buffer_status_t flushrc; buffer_status_t flushrc;
@ -1532,7 +1531,7 @@ static int vty_flush(struct thread *thread)
buffer_reset(vty->lbuf); buffer_reset(vty->lbuf);
buffer_reset(vty->obuf); buffer_reset(vty->obuf);
vty_close(vty); vty_close(vty);
return 0; return;
case BUFFER_EMPTY: case BUFFER_EMPTY:
if (vty->status == VTY_CLOSE) if (vty->status == VTY_CLOSE)
vty_close(vty); vty_close(vty);
@ -1549,8 +1548,6 @@ static int vty_flush(struct thread *thread)
vty_event(VTY_WRITE, vty); vty_event(VTY_WRITE, vty);
break; break;
} }
return 0;
} }
/* Allocate new vty struct. */ /* Allocate new vty struct. */
@ -1753,7 +1750,7 @@ struct vty *vty_stdio(void (*atclose)(int isexit))
} }
/* Accept connection from the network. */ /* Accept connection from the network. */
static int vty_accept(struct thread *thread) static void vty_accept(struct thread *thread)
{ {
struct vty_serv *vtyserv = THREAD_ARG(thread); struct vty_serv *vtyserv = THREAD_ARG(thread);
int vty_sock; int vty_sock;
@ -1774,7 +1771,7 @@ static int vty_accept(struct thread *thread)
if (vty_sock < 0) { if (vty_sock < 0) {
flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s", flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s",
safe_strerror(errno)); safe_strerror(errno));
return -1; return;
} }
set_nonblocking(vty_sock); set_nonblocking(vty_sock);
set_cloexec(vty_sock); set_cloexec(vty_sock);
@ -1783,7 +1780,7 @@ static int vty_accept(struct thread *thread)
close(vty_sock); close(vty_sock);
zlog_info("Vty unable to convert prefix from sockunion %pSU", zlog_info("Vty unable to convert prefix from sockunion %pSU",
&su); &su);
return -1; return;
} }
/* VTY's accesslist apply. */ /* VTY's accesslist apply. */
@ -1792,7 +1789,7 @@ static int vty_accept(struct thread *thread)
&& (access_list_apply(acl, &p) == FILTER_DENY)) { && (access_list_apply(acl, &p) == FILTER_DENY)) {
zlog_info("Vty connection refused from %pSU", &su); zlog_info("Vty connection refused from %pSU", &su);
close(vty_sock); close(vty_sock);
return 0; return;
} }
} }
@ -1803,7 +1800,7 @@ static int vty_accept(struct thread *thread)
&& (access_list_apply(acl, &p) == FILTER_DENY)) { && (access_list_apply(acl, &p) == FILTER_DENY)) {
zlog_info("Vty connection refused from %pSU", &su); zlog_info("Vty connection refused from %pSU", &su);
close(vty_sock); close(vty_sock);
return 0; return;
} }
} }
@ -1817,8 +1814,6 @@ static int vty_accept(struct thread *thread)
zlog_info("Vty connection from %pSU", &su); zlog_info("Vty connection from %pSU", &su);
vty_create(vty_sock, &su); vty_create(vty_sock, &su);
return 0;
} }
static void vty_serv_sock_addrinfo(const char *hostname, unsigned short port) static void vty_serv_sock_addrinfo(const char *hostname, unsigned short port)
@ -1968,7 +1963,7 @@ static void vty_serv_un(const char *path)
/* #define VTYSH_DEBUG 1 */ /* #define VTYSH_DEBUG 1 */
static int vtysh_accept(struct thread *thread) static void vtysh_accept(struct thread *thread)
{ {
struct vty_serv *vtyserv = THREAD_ARG(thread); struct vty_serv *vtyserv = THREAD_ARG(thread);
int accept_sock = vtyserv->sock; int accept_sock = vtyserv->sock;
@ -1988,7 +1983,7 @@ static int vtysh_accept(struct thread *thread)
if (sock < 0) { if (sock < 0) {
flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s", flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s",
safe_strerror(errno)); safe_strerror(errno));
return -1; return;
} }
if (set_nonblocking(sock) < 0) { if (set_nonblocking(sock) < 0) {
@ -1997,7 +1992,7 @@ static int vtysh_accept(struct thread *thread)
"vtysh_accept: could not set vty socket %d to non-blocking, %s, closing", "vtysh_accept: could not set vty socket %d to non-blocking, %s, closing",
sock, safe_strerror(errno)); sock, safe_strerror(errno));
close(sock); close(sock);
return -1; return;
} }
set_cloexec(sock); set_cloexec(sock);
@ -2013,8 +2008,6 @@ static int vtysh_accept(struct thread *thread)
vtys_add_tail(vtysh_sessions, vty); vtys_add_tail(vtysh_sessions, vty);
vty_event(VTYSH_READ, vty); vty_event(VTYSH_READ, vty);
return 0;
} }
static int vtysh_flush(struct vty *vty) static int vtysh_flush(struct vty *vty)
@ -2038,7 +2031,7 @@ static int vtysh_flush(struct vty *vty)
return 0; return 0;
} }
static int vtysh_read(struct thread *thread) static void vtysh_read(struct thread *thread)
{ {
int ret; int ret;
int sock; int sock;
@ -2055,7 +2048,7 @@ static int vtysh_read(struct thread *thread)
if (nbytes < 0) { if (nbytes < 0) {
if (ERRNO_IO_RETRY(errno)) { if (ERRNO_IO_RETRY(errno)) {
vty_event(VTYSH_READ, vty); vty_event(VTYSH_READ, vty);
return 0; return;
} }
vty->monitor = 0; /* disable monitoring to avoid vty->monitor = 0; /* disable monitoring to avoid
infinite recursion */ infinite recursion */
@ -2070,7 +2063,7 @@ static int vtysh_read(struct thread *thread)
#ifdef VTYSH_DEBUG #ifdef VTYSH_DEBUG
printf("close vtysh\n"); printf("close vtysh\n");
#endif /* VTYSH_DEBUG */ #endif /* VTYSH_DEBUG */
return 0; return;
} }
#ifdef VTYSH_DEBUG #ifdef VTYSH_DEBUG
@ -2112,7 +2105,7 @@ static int vtysh_read(struct thread *thread)
if (!vty->t_write && (vtysh_flush(vty) < 0)) if (!vty->t_write && (vtysh_flush(vty) < 0))
/* Try to flush results; exit if a write /* Try to flush results; exit if a write
* error occurs. */ * error occurs. */
return 0; return;
} }
} }
} }
@ -2121,16 +2114,13 @@ static int vtysh_read(struct thread *thread)
vty_close(vty); vty_close(vty);
else else
vty_event(VTYSH_READ, vty); vty_event(VTYSH_READ, vty);
return 0;
} }
static int vtysh_write(struct thread *thread) static void vtysh_write(struct thread *thread)
{ {
struct vty *vty = THREAD_ARG(thread); struct vty *vty = THREAD_ARG(thread);
vtysh_flush(vty); vtysh_flush(vty);
return 0;
} }
#endif /* VTYSH */ #endif /* VTYSH */
@ -2221,7 +2211,7 @@ void vty_close(struct vty *vty)
} }
/* When time out occur output message then close connection. */ /* When time out occur output message then close connection. */
static int vty_timeout(struct thread *thread) static void vty_timeout(struct thread *thread)
{ {
struct vty *vty; struct vty *vty;
@ -2236,8 +2226,6 @@ static int vty_timeout(struct thread *thread)
/* Close connection. */ /* Close connection. */
vty->status = VTY_CLOSE; vty->status = VTY_CLOSE;
vty_close(vty); vty_close(vty);
return 0;
} }
/* Read up configuration file from file_name. */ /* Read up configuration file from file_name. */

View File

@ -29,9 +29,9 @@ DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL_LIST, "Timer Wheel Slot List");
static int debug_timer_wheel = 0; static int debug_timer_wheel = 0;
static int wheel_timer_thread(struct thread *t); static void wheel_timer_thread(struct thread *t);
static int wheel_timer_thread_helper(struct thread *t) static void wheel_timer_thread_helper(struct thread *t)
{ {
struct listnode *node, *nextnode; struct listnode *node, *nextnode;
unsigned long long curr_slot; unsigned long long curr_slot;
@ -63,19 +63,15 @@ static int wheel_timer_thread_helper(struct thread *t)
wheel->slots_to_skip = slots_to_skip; wheel->slots_to_skip = slots_to_skip;
thread_add_timer_msec(wheel->master, wheel_timer_thread, wheel, thread_add_timer_msec(wheel->master, wheel_timer_thread, wheel,
wheel->nexttime * slots_to_skip, &wheel->timer); wheel->nexttime * slots_to_skip, &wheel->timer);
return 0;
} }
static int wheel_timer_thread(struct thread *t) static void wheel_timer_thread(struct thread *t)
{ {
struct timer_wheel *wheel; struct timer_wheel *wheel;
wheel = THREAD_ARG(t); wheel = THREAD_ARG(t);
thread_execute(wheel->master, wheel_timer_thread_helper, wheel, 0); thread_execute(wheel->master, wheel_timer_thread_helper, wheel, 0);
return 0;
} }
struct timer_wheel *wheel_init(struct thread_master *master, int period, struct timer_wheel *wheel_init(struct thread_master *master, int period,

View File

@ -238,7 +238,7 @@ void work_queue_unplug(struct work_queue *wq)
* will reschedule itself if required, * will reschedule itself if required,
* otherwise work_queue_item_add * otherwise work_queue_item_add
*/ */
int work_queue_run(struct thread *thread) void work_queue_run(struct thread *thread)
{ {
struct work_queue *wq; struct work_queue *wq;
struct work_queue_item *item, *titem; struct work_queue_item *item, *titem;
@ -388,6 +388,4 @@ stats:
} else if (wq->spec.completion_func) } else if (wq->spec.completion_func)
wq->spec.completion_func(wq); wq->spec.completion_func(wq);
return 0;
} }

View File

@ -177,7 +177,7 @@ extern void work_queue_unplug(struct work_queue *wq);
bool work_queue_is_scheduled(struct work_queue *); bool work_queue_is_scheduled(struct work_queue *);
/* Helpers, exported for thread.c and command.c */ /* Helpers, exported for thread.c and command.c */
extern int work_queue_run(struct thread *); extern void work_queue_run(struct thread *);
extern void workqueue_cmd_init(void); extern void workqueue_cmd_init(void);

View File

@ -263,20 +263,21 @@ static enum zclient_send_status zclient_failed(struct zclient *zclient)
return ZCLIENT_SEND_FAILURE; return ZCLIENT_SEND_FAILURE;
} }
static int zclient_flush_data(struct thread *thread) static void zclient_flush_data(struct thread *thread)
{ {
struct zclient *zclient = THREAD_ARG(thread); struct zclient *zclient = THREAD_ARG(thread);
zclient->t_write = NULL; zclient->t_write = NULL;
if (zclient->sock < 0) if (zclient->sock < 0)
return -1; return;
switch (buffer_flush_available(zclient->wb, zclient->sock)) { switch (buffer_flush_available(zclient->wb, zclient->sock)) {
case BUFFER_ERROR: case BUFFER_ERROR:
flog_err( flog_err(
EC_LIB_ZAPI_SOCKET, EC_LIB_ZAPI_SOCKET,
"%s: buffer_flush_available failed on zclient fd %d, closing", "%s: buffer_flush_available failed on zclient fd %d, closing",
__func__, zclient->sock); __func__, zclient->sock);
return zclient_failed(zclient); zclient_failed(zclient);
return;
case BUFFER_PENDING: case BUFFER_PENDING:
zclient->t_write = NULL; zclient->t_write = NULL;
thread_add_write(zclient->master, zclient_flush_data, zclient, thread_add_write(zclient->master, zclient_flush_data, zclient,
@ -287,7 +288,6 @@ static int zclient_flush_data(struct thread *thread)
(*zclient->zebra_buffer_write_ready)(); (*zclient->zebra_buffer_write_ready)();
break; break;
} }
return 0;
} }
/* /*
@ -754,7 +754,7 @@ void zclient_init(struct zclient *zclient, int redist_default,
/* This function is a wrapper function for calling zclient_start from /* This function is a wrapper function for calling zclient_start from
timer or event thread. */ timer or event thread. */
static int zclient_connect(struct thread *t) static void zclient_connect(struct thread *t)
{ {
struct zclient *zclient; struct zclient *zclient;
@ -764,7 +764,7 @@ static int zclient_connect(struct thread *t)
if (zclient_debug) if (zclient_debug)
zlog_debug("zclient_connect is called"); zlog_debug("zclient_connect is called");
return zclient_start(zclient); zclient_start(zclient);
} }
enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command, enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command,
@ -3864,7 +3864,7 @@ static zclient_handler *const lib_handlers[] = {
}; };
/* Zebra client message read function. */ /* Zebra client message read function. */
static int zclient_read(struct thread *thread) static void zclient_read(struct thread *thread)
{ {
size_t already; size_t already;
uint16_t length, command; uint16_t length, command;
@ -3888,11 +3888,12 @@ static int zclient_read(struct thread *thread)
zlog_debug( zlog_debug(
"zclient connection closed socket [%d].", "zclient connection closed socket [%d].",
zclient->sock); zclient->sock);
return zclient_failed(zclient); zclient_failed(zclient);
return;
} }
if (nbyte != (ssize_t)(ZEBRA_HEADER_SIZE - already)) { if (nbyte != (ssize_t)(ZEBRA_HEADER_SIZE - already)) {
zclient_event(ZCLIENT_READ, zclient); zclient_event(ZCLIENT_READ, zclient);
return 0; return;
} }
already = ZEBRA_HEADER_SIZE; already = ZEBRA_HEADER_SIZE;
} }
@ -3912,14 +3913,16 @@ static int zclient_read(struct thread *thread)
EC_LIB_ZAPI_MISSMATCH, EC_LIB_ZAPI_MISSMATCH,
"%s: socket %d version mismatch, marker %d, version %d", "%s: socket %d version mismatch, marker %d, version %d",
__func__, zclient->sock, marker, version); __func__, zclient->sock, marker, version);
return zclient_failed(zclient); zclient_failed(zclient);
return;
} }
if (length < ZEBRA_HEADER_SIZE) { if (length < ZEBRA_HEADER_SIZE) {
flog_err(EC_LIB_ZAPI_MISSMATCH, flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: socket %d message length %u is less than %d ", "%s: socket %d message length %u is less than %d ",
__func__, zclient->sock, length, ZEBRA_HEADER_SIZE); __func__, zclient->sock, length, ZEBRA_HEADER_SIZE);
return zclient_failed(zclient); zclient_failed(zclient);
return;
} }
/* Length check. */ /* Length check. */
@ -3947,12 +3950,13 @@ static int zclient_read(struct thread *thread)
zlog_debug( zlog_debug(
"zclient connection closed socket [%d].", "zclient connection closed socket [%d].",
zclient->sock); zclient->sock);
return zclient_failed(zclient); zclient_failed(zclient);
return;
} }
if (nbyte != (ssize_t)(length - already)) { if (nbyte != (ssize_t)(length - already)) {
/* Try again later. */ /* Try again later. */
zclient_event(ZCLIENT_READ, zclient); zclient_event(ZCLIENT_READ, zclient);
return 0; return;
} }
} }
@ -3969,13 +3973,11 @@ static int zclient_read(struct thread *thread)
if (zclient->sock < 0) if (zclient->sock < 0)
/* Connection was closed during packet processing. */ /* Connection was closed during packet processing. */
return -1; return;
/* Register read thread. */ /* Register read thread. */
stream_reset(zclient->ibuf); stream_reset(zclient->ibuf);
zclient_event(ZCLIENT_READ, zclient); zclient_event(ZCLIENT_READ, zclient);
return 0;
} }
void zclient_redistribute(int command, struct zclient *zclient, afi_t afi, void zclient_redistribute(int command, struct zclient *zclient, afi_t afi,

View File

@ -799,7 +799,7 @@ static void zlog_5424_cycle(struct zlog_cfg_5424 *zcf, int fd)
rcu_free(MTYPE_LOG_5424, oldt, zt.rcu_head); rcu_free(MTYPE_LOG_5424, oldt, zt.rcu_head);
} }
static int zlog_5424_reconnect(struct thread *t) static void zlog_5424_reconnect(struct thread *t)
{ {
struct zlog_cfg_5424 *zcf = THREAD_ARG(t); struct zlog_cfg_5424 *zcf = THREAD_ARG(t);
int fd = THREAD_FD(t); int fd = THREAD_FD(t);
@ -812,7 +812,7 @@ static int zlog_5424_reconnect(struct thread *t)
/* logger is sending us something?!?! */ /* logger is sending us something?!?! */
thread_add_read(t->master, zlog_5424_reconnect, zcf, fd, thread_add_read(t->master, zlog_5424_reconnect, zcf, fd,
&zcf->t_reconnect); &zcf->t_reconnect);
return 0; return;
} }
if (ret == 0) if (ret == 0)
@ -832,7 +832,6 @@ static int zlog_5424_reconnect(struct thread *t)
frr_with_mutex (&zcf->cfg_mtx) { frr_with_mutex (&zcf->cfg_mtx) {
zlog_5424_cycle(zcf, fd); zlog_5424_cycle(zcf, fd);
} }
return 0;
} }
static int zlog_5424_unix(struct sockaddr_un *suna, int sock_type) static int zlog_5424_unix(struct sockaddr_un *suna, int sock_type)

View File

@ -100,7 +100,7 @@ static void netlink_log_indication(struct nlmsghdr *msg, struct zbuf *zb)
nhrp_peer_send_indication(ifp, htons(pkthdr->hw_protocol), &pktpl); nhrp_peer_send_indication(ifp, htons(pkthdr->hw_protocol), &pktpl);
} }
static int netlink_log_recv(struct thread *t) static void netlink_log_recv(struct thread *t)
{ {
uint8_t buf[ZNL_BUFFER_SIZE]; uint8_t buf[ZNL_BUFFER_SIZE];
int fd = THREAD_FD(t); int fd = THREAD_FD(t);
@ -124,8 +124,6 @@ static int netlink_log_recv(struct thread *t)
thread_add_read(master, netlink_log_recv, 0, netlink_log_fd, thread_add_read(master, netlink_log_recv, 0, netlink_log_fd,
&netlink_log_thread); &netlink_log_thread);
return 0;
} }
void netlink_set_nflog_group(int nlgroup) void netlink_set_nflog_group(int nlgroup)

View File

@ -197,16 +197,15 @@ struct nhrp_cache *nhrp_cache_get(struct interface *ifp,
create ? nhrp_cache_alloc : NULL); create ? nhrp_cache_alloc : NULL);
} }
static int nhrp_cache_do_free(struct thread *t) static void nhrp_cache_do_free(struct thread *t)
{ {
struct nhrp_cache *c = THREAD_ARG(t); struct nhrp_cache *c = THREAD_ARG(t);
c->t_timeout = NULL; c->t_timeout = NULL;
nhrp_cache_free(c); nhrp_cache_free(c);
return 0;
} }
static int nhrp_cache_do_timeout(struct thread *t) static void nhrp_cache_do_timeout(struct thread *t)
{ {
struct nhrp_cache *c = THREAD_ARG(t); struct nhrp_cache *c = THREAD_ARG(t);
@ -214,7 +213,6 @@ static int nhrp_cache_do_timeout(struct thread *t)
if (c->cur.type != NHRP_CACHE_INVALID) if (c->cur.type != NHRP_CACHE_INVALID)
nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL, nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL,
NULL); NULL);
return 0;
} }
static void nhrp_cache_update_route(struct nhrp_cache *c) static void nhrp_cache_update_route(struct nhrp_cache *c)
@ -392,12 +390,11 @@ static void nhrp_cache_authorize_binding(struct nhrp_reqid *r, void *arg)
nhrp_cache_update_timers(c); nhrp_cache_update_timers(c);
} }
static int nhrp_cache_do_auth_timeout(struct thread *t) static void nhrp_cache_do_auth_timeout(struct thread *t)
{ {
struct nhrp_cache *c = THREAD_ARG(t); struct nhrp_cache *c = THREAD_ARG(t);
c->t_auth = NULL; c->t_auth = NULL;
nhrp_cache_authorize_binding(&c->eventid, (void *)"timeout"); nhrp_cache_authorize_binding(&c->eventid, (void *)"timeout");
return 0;
} }
static void nhrp_cache_newpeer_notifier(struct notifier_block *n, static void nhrp_cache_newpeer_notifier(struct notifier_block *n,

View File

@ -31,7 +31,7 @@ struct event_manager {
uint8_t ibuf_data[4 * 1024]; uint8_t ibuf_data[4 * 1024];
}; };
static int evmgr_reconnect(struct thread *t); static void evmgr_reconnect(struct thread *t);
static void evmgr_connection_error(struct event_manager *evmgr) static void evmgr_connection_error(struct event_manager *evmgr)
{ {
@ -78,7 +78,7 @@ static void evmgr_recv_message(struct event_manager *evmgr, struct zbuf *zb)
} }
} }
static int evmgr_read(struct thread *t) static void evmgr_read(struct thread *t)
{ {
struct event_manager *evmgr = THREAD_ARG(t); struct event_manager *evmgr = THREAD_ARG(t);
struct zbuf *ibuf = &evmgr->ibuf; struct zbuf *ibuf = &evmgr->ibuf;
@ -86,7 +86,7 @@ static int evmgr_read(struct thread *t)
if (zbuf_read(ibuf, evmgr->fd, (size_t)-1) < 0) { if (zbuf_read(ibuf, evmgr->fd, (size_t)-1) < 0) {
evmgr_connection_error(evmgr); evmgr_connection_error(evmgr);
return 0; return;
} }
/* Process all messages in buffer */ /* Process all messages in buffer */
@ -94,10 +94,9 @@ static int evmgr_read(struct thread *t)
evmgr_recv_message(evmgr, &msg); evmgr_recv_message(evmgr, &msg);
thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read);
return 0;
} }
static int evmgr_write(struct thread *t) static void evmgr_write(struct thread *t)
{ {
struct event_manager *evmgr = THREAD_ARG(t); struct event_manager *evmgr = THREAD_ARG(t);
int r; int r;
@ -109,8 +108,6 @@ static int evmgr_write(struct thread *t)
} else if (r < 0) { } else if (r < 0) {
evmgr_connection_error(evmgr); evmgr_connection_error(evmgr);
} }
return 0;
} }
static void evmgr_hexdump(struct zbuf *zb, const uint8_t *val, size_t vallen) static void evmgr_hexdump(struct zbuf *zb, const uint8_t *val, size_t vallen)
@ -186,13 +183,13 @@ static void evmgr_submit(struct event_manager *evmgr, struct zbuf *obuf)
&evmgr->t_write); &evmgr->t_write);
} }
static int evmgr_reconnect(struct thread *t) static void evmgr_reconnect(struct thread *t)
{ {
struct event_manager *evmgr = THREAD_ARG(t); struct event_manager *evmgr = THREAD_ARG(t);
int fd; int fd;
if (evmgr->fd >= 0 || !nhrp_event_socket_path) if (evmgr->fd >= 0 || !nhrp_event_socket_path)
return 0; return;
fd = sock_open_unix(nhrp_event_socket_path); fd = sock_open_unix(nhrp_event_socket_path);
if (fd < 0) { if (fd < 0) {
@ -201,14 +198,12 @@ static int evmgr_reconnect(struct thread *t)
zbufq_reset(&evmgr->obuf); zbufq_reset(&evmgr->obuf);
thread_add_timer(master, evmgr_reconnect, evmgr, 10, thread_add_timer(master, evmgr_reconnect, evmgr, 10,
&evmgr->t_reconnect); &evmgr->t_reconnect);
return 0; return;
} }
zlog_info("Connected to Event Manager"); zlog_info("Connected to Event Manager");
evmgr->fd = fd; evmgr->fd = fd;
thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read);
return 0;
} }
static struct event_manager evmgr_connection; static struct event_manager evmgr_connection;

View File

@ -142,7 +142,7 @@ static void netlink_mcast_log_handler(struct nlmsghdr *msg, struct zbuf *zb)
} }
} }
static int netlink_mcast_log_recv(struct thread *t) static void netlink_mcast_log_recv(struct thread *t)
{ {
uint8_t buf[65535]; /* Max OSPF Packet size */ uint8_t buf[65535]; /* Max OSPF Packet size */
int fd = THREAD_FD(t); int fd = THREAD_FD(t);
@ -166,8 +166,6 @@ static int netlink_mcast_log_recv(struct thread *t)
thread_add_read(master, netlink_mcast_log_recv, 0, netlink_mcast_log_fd, thread_add_read(master, netlink_mcast_log_recv, 0, netlink_mcast_log_fd,
&netlink_mcast_log_thread); &netlink_mcast_log_thread);
return 0;
} }
static void netlink_mcast_log_register(int fd, int group) static void netlink_mcast_log_register(int fd, int group)

View File

@ -17,8 +17,8 @@
DEFINE_MTYPE_STATIC(NHRPD, NHRP_NHS, "NHRP next hop server"); DEFINE_MTYPE_STATIC(NHRPD, NHRP_NHS, "NHRP next hop server");
DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries"); DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries");
static int nhrp_nhs_resolve(struct thread *t); static void nhrp_nhs_resolve(struct thread *t);
static int nhrp_reg_send_req(struct thread *t); static void nhrp_reg_send_req(struct thread *t);
static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
{ {
@ -107,7 +107,7 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
&cie_nbma_nhs); &cie_nbma_nhs);
} }
static int nhrp_reg_timeout(struct thread *t) static void nhrp_reg_timeout(struct thread *t)
{ {
struct nhrp_registration *r = THREAD_ARG(t); struct nhrp_registration *r = THREAD_ARG(t);
struct nhrp_cache *c; struct nhrp_cache *c;
@ -138,8 +138,6 @@ static int nhrp_reg_timeout(struct thread *t)
r->timeout = 2; r->timeout = 2;
} }
thread_add_timer_msec(master, nhrp_reg_send_req, r, 10, &r->t_register); thread_add_timer_msec(master, nhrp_reg_send_req, r, 10, &r->t_register);
return 0;
} }
static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd) static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd)
@ -161,7 +159,7 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd)
} }
} }
static int nhrp_reg_send_req(struct thread *t) static void nhrp_reg_send_req(struct thread *t)
{ {
struct nhrp_registration *r = THREAD_ARG(t); struct nhrp_registration *r = THREAD_ARG(t);
struct nhrp_nhs *nhs = r->nhs; struct nhrp_nhs *nhs = r->nhs;
@ -180,7 +178,7 @@ static int nhrp_reg_send_req(struct thread *t)
&r->peer->vc->remote.nbma); &r->peer->vc->remote.nbma);
thread_add_timer(master, nhrp_reg_send_req, r, 120, thread_add_timer(master, nhrp_reg_send_req, r, 120,
&r->t_register); &r->t_register);
return 0; return;
} }
thread_add_timer(master, nhrp_reg_timeout, r, r->timeout, thread_add_timer(master, nhrp_reg_timeout, r, r->timeout,
@ -198,7 +196,7 @@ static int nhrp_reg_send_req(struct thread *t)
/* No protocol address configured for tunnel interface */ /* No protocol address configured for tunnel interface */
if (sockunion_family(&if_ad->addr) == AF_UNSPEC) if (sockunion_family(&if_ad->addr) == AF_UNSPEC)
return 0; return;
zb = zbuf_alloc(1400); zb = zbuf_alloc(1400);
hdr = nhrp_packet_push(zb, NHRP_PACKET_REGISTRATION_REQUEST, hdr = nhrp_packet_push(zb, NHRP_PACKET_REGISTRATION_REQUEST,
@ -246,8 +244,6 @@ static int nhrp_reg_send_req(struct thread *t)
nhrp_packet_complete(zb, hdr); nhrp_packet_complete(zb, hdr);
nhrp_peer_send(r->peer, zb); nhrp_peer_send(r->peer, zb);
zbuf_free(zb); zbuf_free(zb);
return 0;
} }
static void nhrp_reg_delete(struct nhrp_registration *r) static void nhrp_reg_delete(struct nhrp_registration *r)
@ -320,14 +316,12 @@ static void nhrp_nhs_resolve_cb(struct resolver_query *q, const char *errstr,
nhrp_reg_delete(reg); nhrp_reg_delete(reg);
} }
static int nhrp_nhs_resolve(struct thread *t) static void nhrp_nhs_resolve(struct thread *t)
{ {
struct nhrp_nhs *nhs = THREAD_ARG(t); struct nhrp_nhs *nhs = THREAD_ARG(t);
resolver_resolve(&nhs->dns_resolve, AF_INET, VRF_DEFAULT, resolver_resolve(&nhs->dns_resolve, AF_INET, VRF_DEFAULT,
nhs->nbma_fqdn, nhrp_nhs_resolve_cb); nhs->nbma_fqdn, nhrp_nhs_resolve_cb);
return 0;
} }
int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr, int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr,

View File

@ -290,7 +290,7 @@ err:
return -1; return -1;
} }
static int nhrp_packet_recvraw(struct thread *t) static void nhrp_packet_recvraw(struct thread *t)
{ {
int fd = THREAD_FD(t), ifindex; int fd = THREAD_FD(t), ifindex;
struct zbuf *zb; struct zbuf *zb;
@ -304,7 +304,7 @@ static int nhrp_packet_recvraw(struct thread *t)
zb = zbuf_alloc(1500); zb = zbuf_alloc(1500);
if (!zb) if (!zb)
return 0; return;
len = zbuf_size(zb); len = zbuf_size(zb);
addrlen = sizeof(addr); addrlen = sizeof(addr);
@ -332,11 +332,10 @@ static int nhrp_packet_recvraw(struct thread *t)
nhrp_peer_recv(p, zb); nhrp_peer_recv(p, zb);
nhrp_peer_unref(p); nhrp_peer_unref(p);
return 0; return;
err: err:
zbuf_free(zb); zbuf_free(zb);
return 0;
} }
int nhrp_packet_init(void) int nhrp_packet_init(void)

View File

@ -54,7 +54,7 @@ static void nhrp_peer_check_delete(struct nhrp_peer *p)
XFREE(MTYPE_NHRP_PEER, p); XFREE(MTYPE_NHRP_PEER, p);
} }
static int nhrp_peer_notify_up(struct thread *t) static void nhrp_peer_notify_up(struct thread *t)
{ {
struct nhrp_peer *p = THREAD_ARG(t); struct nhrp_peer *p = THREAD_ARG(t);
struct nhrp_vc *vc = p->vc; struct nhrp_vc *vc = p->vc;
@ -68,8 +68,6 @@ static int nhrp_peer_notify_up(struct thread *t)
notifier_call(&p->notifier_list, NOTIFY_PEER_UP); notifier_call(&p->notifier_list, NOTIFY_PEER_UP);
nhrp_peer_unref(p); nhrp_peer_unref(p);
} }
return 0;
} }
static void __nhrp_peer_check(struct nhrp_peer *p) static void __nhrp_peer_check(struct nhrp_peer *p)
@ -258,7 +256,7 @@ void nhrp_peer_unref(struct nhrp_peer *p)
} }
} }
static int nhrp_peer_request_timeout(struct thread *t) static void nhrp_peer_request_timeout(struct thread *t)
{ {
struct nhrp_peer *p = THREAD_ARG(t); struct nhrp_peer *p = THREAD_ARG(t);
struct nhrp_vc *vc = p->vc; struct nhrp_vc *vc = p->vc;
@ -267,7 +265,7 @@ static int nhrp_peer_request_timeout(struct thread *t)
if (p->online) if (p->online)
return 0; return;
if (nifp->ipsec_fallback_profile && !p->prio if (nifp->ipsec_fallback_profile && !p->prio
&& !p->fallback_requested) { && !p->fallback_requested) {
@ -279,11 +277,9 @@ static int nhrp_peer_request_timeout(struct thread *t)
} else { } else {
p->requested = p->fallback_requested = 0; p->requested = p->fallback_requested = 0;
} }
return 0;
} }
static int nhrp_peer_defer_vici_request(struct thread *t) static void nhrp_peer_defer_vici_request(struct thread *t)
{ {
struct nhrp_peer *p = THREAD_ARG(t); struct nhrp_peer *p = THREAD_ARG(t);
struct nhrp_vc *vc = p->vc; struct nhrp_vc *vc = p->vc;
@ -304,7 +300,6 @@ static int nhrp_peer_defer_vici_request(struct thread *t)
(nifp->ipsec_fallback_profile && !p->prio) ? 15 : 30, (nifp->ipsec_fallback_profile && !p->prio) ? 15 : 30,
&p->t_fallback); &p->t_fallback);
} }
return 0;
} }
int nhrp_peer_check(struct nhrp_peer *p, int establish) int nhrp_peer_check(struct nhrp_peer *p, int establish)

Some files were not shown because too many files have changed in this diff Show More