diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-02-23 01:04:25 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-02-24 01:56:04 +0100 |
commit | cc9f21da2218d95567eff1501482ce58e6600f54 (patch) | |
tree | d579c9754161d874bad6eb09c67821b65fb559ca | |
parent | Merge pull request #10621 from donaldsharp/cov_fun (diff) | |
download | frr-cc9f21da2218d95567eff1501482ce58e6600f54.tar.xz frr-cc9f21da2218d95567eff1501482ce58e6600f54.zip |
*: 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>
207 files changed, 1109 insertions, 1834 deletions
diff --git a/babeld/babeld.c b/babeld/babeld.c index 0104620cd..a1e00bfb8 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -49,11 +49,11 @@ THE SOFTWARE. DEFINE_MGROUP(BABELD, "babeld"); 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_initial_noise(void); -static int babel_read_protocol (struct thread *thread); -static int babel_main_loop(struct thread *thread); +static void babel_read_protocol(struct thread *thread); +static void babel_main_loop(struct thread *thread); static void babel_set_timer(struct timeval *timeout); static void babel_fill_with_next_timeout(struct timeval *tv); static void @@ -175,8 +175,7 @@ fail: } /* thread reading entries form others babel daemons */ -static int -babel_read_protocol (struct thread *thread) +static void babel_read_protocol(struct thread *thread) { int rc; struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); @@ -207,14 +206,12 @@ babel_read_protocol (struct thread *thread) /* re-add thread */ 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 must be call with a litte timeout wich may give zebra the time to do his job, making these inits have sense. */ -static int -babel_init_routing_process(struct thread *thread) +static void babel_init_routing_process(struct thread *thread) { myseqno = (frr_weak_random() & 0xFFFF); 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)); babel_initial_noise(); 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}). */ @@ -327,8 +323,7 @@ babel_clean_routing_process(void) } /* Function used with timeout. */ -static int -babel_main_loop(struct thread *thread) +static void babel_main_loop(struct thread *thread) { struct timeval tv; 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. */ timeval_add_msec(&tv, &tv, 300); babel_set_timer(&tv); - return 0; - } + return; + } gettime(&babel_now); @@ -410,7 +405,6 @@ babel_main_loop(struct thread *thread) } assert(0); /* this line should never be reach */ - return 0; } static void diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 588c9fc00..455dd9fe8 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -609,27 +609,23 @@ struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp, 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); 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); if (bs->echo_xmt_TO > 0) ptm_bfd_echo_xmt_TO(bs); - - return 0; } /* 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); @@ -639,12 +635,10 @@ int bfd_recvtimer_cb(struct thread *t) ptm_bfd_sess_dn(bs, BD_CONTROL_EXPIRED); break; } - - return 0; } /* 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); @@ -654,8 +648,6 @@ int bfd_echo_recvtimer_cb(struct thread *t) ptm_bfd_sess_dn(bs, BD_ECHO_FAILED); break; } - - return 0; } struct bfd_session *bfd_session_new(void) diff --git a/bfdd/bfd.h b/bfdd/bfd.h index 473886901..7ab5ef13b 100644 --- a/bfdd/bfd.h +++ b/bfdd/bfd.h @@ -426,7 +426,7 @@ int control_init(const char *path); void control_shutdown(void); int control_notify(struct bfd_session *bs, uint8_t notify_state); 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_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`. */ extern struct thread_master *master; -int bfd_recvtimer_cb(struct thread *t); -int bfd_echo_recvtimer_cb(struct thread *t); -int bfd_xmt_cb(struct thread *t); -int bfd_echo_xmt_cb(struct thread *t); +void bfd_recvtimer_cb(struct thread *t); +void bfd_echo_recvtimer_cb(struct thread *t); +void bfd_xmt_cb(struct thread *t); +void bfd_echo_xmt_cb(struct thread *t); extern struct in6_addr zero_addr; diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 8eda78ebd..34b171f40 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -531,7 +531,7 @@ static void cp_debug(bool mhop, struct sockaddr_any *peer, 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); struct bfd_session *bfd; @@ -552,7 +552,7 @@ int bfd_recv_cb(struct thread *t) /* Handle echo packets. */ if (sd == bvrf->bg_echo || sd == bvrf->bg_echov6) { ptm_bfd_process_echo_pkt(bvrf, sd); - return 0; + return; } /* Sanitize input/output. */ @@ -590,14 +590,14 @@ int bfd_recv_cb(struct thread *t) if (mlen < BFD_PKT_LEN) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "too small (%ld bytes)", mlen); - return 0; + return; } /* Validate single hop packet TTL. */ if ((!is_mhop) && (ttl != BFD_TTL_VAL)) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "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) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "bad version %d", BFD_GETVER(cp->diag)); - return 0; + return; } if (cp->detect_mult == 0) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "detect multiplier set to zero"); - return 0; + return; } if ((cp->len < BFD_PKT_LEN) || (cp->len > mlen)) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "too small"); - return 0; + return; } if (cp->discrs.my_discr == 0) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "'my discriminator' is zero"); - return 0; + return; } /* Find the session that this packet belongs. */ @@ -636,7 +636,7 @@ int bfd_recv_cb(struct thread *t) if (bfd == NULL) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "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, "exceeded max hop count (expected %d, got %d)", bfd->mh_ttl, ttl); - return 0; + return; } } else if (bfd->local_address.sa_sin.sin_family == AF_UNSPEC) { bfd->local_address = local; @@ -733,8 +733,6 @@ int bfd_recv_cb(struct thread *t) /* Send the control packet with the final bit immediately. */ ptm_bfd_snd(bfd, 1); } - - return 0; } /* diff --git a/bfdd/control.c b/bfdd/control.c index e772aadfc..473843fe2 100644 --- a/bfdd/control.c +++ b/bfdd/control.c @@ -52,8 +52,8 @@ struct bfd_notify_peer *control_notifypeer_find(struct bfd_control_socket *bcs, struct bfd_control_socket *control_new(int sd); static void control_free(struct bfd_control_socket *bcs); static void control_reset_buf(struct bfd_control_buffer *bcb); -static int control_read(struct thread *t); -static int control_write(struct thread *t); +static void control_read(struct thread *t); +static void control_write(struct thread *t); static void control_handle_request_add(struct bfd_control_socket *bcs, 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); csock = accept(sd, NULL, 0); if (csock == -1) { zlog_warn("%s: accept: %s", __func__, strerror(errno)); - return 0; + return; } control_new(csock); 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; } -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_buffer *bcb = &bcs->bcs_bin; @@ -417,7 +415,7 @@ static int control_read(struct thread *t) bread = read(sd, &bcm, sizeof(bcm)); if (bread == 0) { control_free(bcs); - return 0; + return; } if (bread < 0) { 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)); control_free(bcs); - return 0; + return; } /* Validate header fields. */ @@ -434,14 +432,14 @@ static int control_read(struct thread *t) zlog_debug("%s: client closed due small message length: %d", __func__, bcm.bcm_length); control_free(bcs); - return 0; + return; } if (bcm.bcm_ver != BMV_VERSION_1) { zlog_debug("%s: client closed due bad version: %d", __func__, bcm.bcm_ver); control_free(bcs); - return 0; + return; } /* 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", __func__, bcb->bcb_left); control_free(bcs); - return 0; + return; } 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); if (bread == 0) { control_free(bcs); - return 0; + return; } if (bread < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) @@ -477,7 +475,7 @@ skip_header: zlog_warn("%s: read: %s", __func__, strerror(errno)); control_free(bcs); - return 0; + return; } bcb->bcb_pos += bread; @@ -518,11 +516,9 @@ skip_header: schedule_next_read: bcs->bcs_ev = NULL; 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_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); if (bwrite == 0) { control_free(bcs); - return 0; + return; } if (bwrite < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { bcs->bcs_outev = NULL; thread_add_write(master, control_write, bcs, bcs->bcs_sd, &bcs->bcs_outev); - return 0; + return; } zlog_warn("%s: write: %s", __func__, strerror(errno)); control_free(bcs); - return 0; + return; } bcb->bcb_pos += bwrite; @@ -553,12 +549,10 @@ static int control_write(struct thread *t) bcs->bcs_outev = NULL; thread_add_write(master, control_write, bcs, bcs->bcs_sd, &bcs->bcs_outev); - return 0; + return; } control_queue_dequeue(bcs); - - return 0; } diff --git a/bfdd/dplane.c b/bfdd/dplane.c index 9dee2a558..c1081643e 100644 --- a/bfdd/dplane.c +++ b/bfdd/dplane.c @@ -107,7 +107,7 @@ struct bfd_dplane_ctx { */ 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 void bfd_dplane_ctx_free(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; } -static int bfd_dplane_write(struct thread *t) +static void bfd_dplane_write(struct thread *t) { struct bfd_dplane_ctx *bdc = THREAD_ARG(t); /* Handle connection stage. */ if (bdc->connecting && bfd_dplane_client_connecting(bdc)) - return 0; + return; bfd_dplane_flush(bdc); - - return 0; } static void @@ -614,18 +612,17 @@ skip_read: 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); int rv; rv = bfd_dplane_expect(bdc, 0, bfd_dplane_handle_message, NULL); if (rv == -1) - return 0; + return; stream_pulldown(bdc->inbuf); 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) @@ -835,7 +832,7 @@ static uint16_t bfd_dplane_request_counters(const struct bfd_session *bs) /* * 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_dplane_ctx *bdc; @@ -858,7 +855,6 @@ static int bfd_dplane_accept(struct thread *t) reschedule_and_return: thread_add_read(master, bfd_dplane_accept, bg, bg->bg_dplane_sock, &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); int rv, sock; @@ -965,15 +961,12 @@ static int bfd_dplane_client_connect(struct thread *t) _bfd_dplane_client_bootstrap(bdc); } - return 0; - reschedule_connect: THREAD_OFF(bdc->inbufev); THREAD_OFF(bdc->outbufev); socket_close(&sock); thread_add_timer(master, bfd_dplane_client_connect, bdc, 3, &bdc->connectev); - return 0; } static void bfd_dplane_client_init(const struct sockaddr *sa, socklen_t salen) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 1c9852f5c..96c34f919 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1315,7 +1315,7 @@ static void bmp_stat_put_u32(struct stream *s, size_t *cnt, uint16_t type, (*cnt)++; } -static int bmp_stats(struct thread *thread) +static void bmp_stats(struct thread *thread) { struct bmp_targets *bt = THREAD_ARG(thread); struct stream *s; @@ -1365,11 +1365,10 @@ static int bmp_stats(struct thread *thread) bmp_send_all(bt->bmpbgp, s); } - return 0; } /* 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); char buf[1024]; @@ -1383,16 +1382,14 @@ static int bmp_read(struct thread *t) } else if (n == 0) { /* the TCP session was terminated by the far end */ bmp_wrerr(bmp, NULL, true); - return 0; + return; } else if (!(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) { /* the TCP session experienced a fatal error, likely a timeout */ bmp_wrerr(bmp, NULL, false); - return -1; + return; } 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) @@ -1475,7 +1472,7 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) } /* Accept BMP connection. */ -static int bmp_accept(struct thread *thread) +static void bmp_accept(struct thread *thread) { union sockunion su; 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); if (bmp_sock < 0) { zlog_info("bmp: accept_sock failed: %s", safe_strerror(errno)); - return -1; + return; } bmp_open(bl->targets, bmp_sock); - return 0; } 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); } -static int bmp_active_thread(struct thread *t) +static void bmp_active_thread(struct thread *t) { struct bmp_active *ba = THREAD_ARG(t); socklen_t slen; @@ -1861,7 +1857,7 @@ static int bmp_active_thread(struct thread *t) vrf_id = ba->targets->bgp->vrf_id; resolver_resolve(&ba->resq, AF_UNSPEC, vrf_id, ba->hostname, bmp_active_resolved); - return 0; + return; } slen = sizeof(status); @@ -1886,14 +1882,13 @@ static int bmp_active_thread(struct thread *t) ba->bmp->active = ba; ba->socket = -1; ba->curretry = ba->minretry; - return 0; + return; out_next: close(ba->socket); ba->socket = -1; ba->addrpos++; bmp_active_connect(ba); - return 0; } static void bmp_active_disconnected(struct bmp_active *ba) diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index e5a4b0e9f..f72a373a1 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -165,7 +165,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi, /* Handler of conditional advertisement timer event. * 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; safi_t safi; @@ -286,7 +286,6 @@ static int bgp_conditional_adv_timer(struct thread *t) } peer->advmap_table_change = false; } - return 0; } void bgp_conditional_adv_enable(struct peer *peer, afi_t afi, safi_t safi) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 91e983e5d..62e8e71aa 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -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 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 *next; @@ -178,8 +178,6 @@ static int bgp_reuse_timer(struct thread *t) * 4.8.6). */ bgp_reuse_list_add(bdi, bdc); } - - return 0; } /* A route becomes unreachable (RFC2439 Section 4.8.2). */ diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 9ddfe7bb5..c389fec5f 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -88,7 +88,7 @@ struct 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. */ struct stream *bgp_dump_obuf; @@ -439,7 +439,7 @@ static unsigned int bgp_dump_routes_func(int afi, int first_run, 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; bgp_dump = THREAD_ARG(t); @@ -462,8 +462,6 @@ static int bgp_dump_interval_func(struct thread *t) /* if interval is set reschedule */ if (bgp_dump->interval > 0) bgp_dump_interval_add(bgp_dump, bgp_dump->interval); - - return 0; } /* Dump common information. */ diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 9b184ac9c..ea179ec2b 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -76,7 +76,7 @@ static void bgp_evpn_mac_update_on_es_local_chg(struct bgp_evpn_es *es, bool is_local); 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_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; } -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 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, BGP_EVPN_CONS_CHECK_INTERVAL, &bgp_mh_info->t_cons_check); - - return 0; } /***************************************************************************** diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 672fa4512..a0b92b6c7 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -90,13 +90,13 @@ static const char *const bgp_event_str[] = { function. */ /* BGP event function. */ -int bgp_event(struct thread *); +void bgp_event(struct thread *); /* BGP thread functions. */ -static int bgp_start_timer(struct thread *); -static int bgp_connect_timer(struct thread *); -static int bgp_holdtime_timer(struct thread *); -static int bgp_delayopen_timer(struct thread *); +static void bgp_start_timer(struct thread *); +static void bgp_connect_timer(struct thread *); +static void bgp_holdtime_timer(struct thread *); +static void bgp_delayopen_timer(struct thread *); /* BGP FSM functions. */ 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 and process event. */ -static int bgp_start_timer(struct thread *thread) +static void bgp_start_timer(struct thread *thread) { struct peer *peer; @@ -505,15 +505,12 @@ static int bgp_start_timer(struct thread *thread) THREAD_VAL(thread) = BGP_Start; bgp_event(thread); /* bgp_event unlocks peer */ - - return 0; } /* BGP connect retry timer. */ -static int bgp_connect_timer(struct thread *thread) +static void bgp_connect_timer(struct thread *thread) { struct peer *peer; - int ret; peer = THREAD_ARG(thread); @@ -526,20 +523,16 @@ static int bgp_connect_timer(struct thread *thread) if (bgp_debug_neighbor_events(peer)) 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); - ret = -1; - } else { + else { THREAD_VAL(thread) = ConnectRetry_timer_expired; bgp_event(thread); /* bgp_event unlocks peer */ - ret = 0; } - - return ret; } /* BGP holdtime timer. */ -static int bgp_holdtime_timer(struct thread *thread) +static void bgp_holdtime_timer(struct thread *thread) { atomic_size_t inq_count; struct peer *peer; @@ -562,20 +555,15 @@ static int bgp_holdtime_timer(struct thread *thread) */ inq_count = atomic_load_explicit(&peer->ibuf->count, memory_order_relaxed); - if (inq_count) { + if (inq_count) BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, peer->v_holdtime); - return 0; - } - THREAD_VAL(thread) = Hold_Timer_expired; 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; @@ -593,11 +581,10 @@ int bgp_routeadv_timer(struct thread *thread) /* MRAI timer will be started again when FIFO is built, no need to * do it here. */ - return 0; } /* RFC 4271 DelayOpenTimer */ -int bgp_delayopen_timer(struct thread *thread) +void bgp_delayopen_timer(struct thread *thread) { struct peer *peer; @@ -609,8 +596,6 @@ int bgp_delayopen_timer(struct thread *thread) THREAD_VAL(thread) = DelayOpen_timer_expired; bgp_event(thread); /* bgp_event unlocks peer */ - - return 0; } /* BGP Peer Down Cause */ @@ -674,7 +659,7 @@ static void bgp_graceful_restart_timer_off(struct peer *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 *peer; @@ -700,8 +685,6 @@ static int bgp_llgr_stale_timer_expire(struct thread *thread) bgp_clear_stale_route(peer, afi, safi); bgp_graceful_restart_timer_off(peer); - - return 0; } 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 listnode *node, *nnode; @@ -840,11 +823,9 @@ static int bgp_graceful_restart_timer_expire(struct thread *thread) } 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; afi_t afi; @@ -860,12 +841,10 @@ static int bgp_graceful_stale_timer_expire(struct thread *thread) FOREACH_AFI_SAFI_NSF (afi, safi) if (peer->nsf[afi][safi]) bgp_clear_stale_route(peer, afi, safi); - - return 0; } /* 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; afi_t afi; @@ -887,7 +866,7 @@ static int bgp_graceful_deferral_timer_expire(struct thread *thread) XFREE(MTYPE_TMP, info); /* 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) @@ -1135,7 +1114,7 @@ int bgp_fsm_error_subcode(int status) } /* 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; @@ -1146,8 +1125,6 @@ static int bgp_maxmed_onstartup_timer(struct thread *thread) bgp->maxmed_onstartup_over = 1; bgp_maxmed_update(bgp); - - return 0; } 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. */ -static int bgp_update_delay_timer(struct thread *thread) +static void bgp_update_delay_timer(struct thread *thread) { struct bgp *bgp; @@ -1188,12 +1165,10 @@ static int bgp_update_delay_timer(struct thread *thread) bgp = THREAD_ARG(thread); THREAD_OFF(bgp->t_update_delay); bgp_update_delay_end(bgp); - - return 0; } /* 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; @@ -1202,8 +1177,6 @@ static int bgp_establish_wait_timer(struct thread *thread) bgp = THREAD_ARG(thread); THREAD_OFF(bgp->t_establish_wait); bgp_check_update_delay(bgp); - - return 0; } /* 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 * 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; 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)", errno, safe_strerror(errno)); BGP_EVENT_ADD(peer, TCP_fatal_error); - return -1; + return; } /* 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); else BGP_EVENT_ADD(peer, TCP_connection_open); - return 1; + return; } else { if (bgp_debug_neighbor_events(peer)) zlog_debug("%s [Event] Connect failed %d(%s)", peer->host, status, safe_strerror(status)); BGP_EVENT_ADD(peer, TCP_connection_open_failed); - return 0; + return; } } @@ -2542,18 +2515,15 @@ static const struct { }; /* Execute event process. */ -int bgp_event(struct thread *thread) +void bgp_event(struct thread *thread) { enum bgp_fsm_events event; struct peer *peer; - int ret; peer = THREAD_ARG(thread); event = THREAD_VAL(thread); - ret = bgp_event_update(peer, event); - - return (ret); + bgp_event_update(peer, event); } int bgp_event_update(struct peer *peer, enum bgp_fsm_events event) diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index 12cbad3eb..f3d1781ed 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -125,11 +125,11 @@ * 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 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_stop(struct peer *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 const char *const peer_down_str[]; extern void bgp_update_delay_end(struct bgp *); diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 9b5a31f28..bd0dfb3a6 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -45,8 +45,8 @@ /* forward declarations */ static uint16_t bgp_write(struct peer *); static uint16_t bgp_read(struct peer *peer, int *code_p); -static int bgp_process_writes(struct thread *); -static int bgp_process_reads(struct thread *); +static void bgp_process_writes(struct thread *); +static void bgp_process_reads(struct thread *); static bool validate_header(struct peer *); /* 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. */ -static int bgp_process_writes(struct thread *thread) +static void bgp_process_writes(struct thread *thread) { static struct peer *peer; peer = THREAD_ARG(thread); @@ -130,7 +130,7 @@ static int bgp_process_writes(struct thread *thread) bool fatal = false; if (peer->fd < 0) - return -1; + return; 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_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 * 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 */ static struct peer *peer; // peer to read from @@ -186,7 +184,7 @@ static int bgp_process_reads(struct thread *thread) peer = THREAD_ARG(thread); if (peer->fd < 0 || bm->terminating) - return -1; + return; 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, peer, 0, &peer->t_process_packet); } - - return 0; } /* diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 3fb7619ed..0c325b678 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -342,7 +342,7 @@ static void bgp_socket_set_buffer_size(const int fd) } /* Accept bgp connection. */ -static int bgp_accept(struct thread *thread) +static void bgp_accept(struct thread *thread) { int bgp_sock; int accept_sock; @@ -363,7 +363,7 @@ static int bgp_accept(struct thread *thread) flog_err_sys(EC_LIB_SOCKET, "[Error] BGP accept socket fd is negative: %d", accept_sock); - return -1; + return; } 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", safe_strerror(save_errno)); } - return -1; + return; } 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", inet_sutop(&su, buf)); close(bgp_sock); - return -1; + return; } bgp_socket_set_buffer_size(bgp_sock); @@ -451,7 +451,7 @@ static int bgp_accept(struct thread *thread) 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))); } close(bgp_sock); - return -1; + return; } 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, VRF_LOGNAME(vrf_lookup_by_id(bgp->vrf_id))); 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", peer1->host, peer1, peer1->status); close(bgp_sock); - return -1; + return; } /* 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", peer1->host); close(bgp_sock); - return -1; + return; } /* 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", peer1->host); close(bgp_sock); - return -1; + return; } 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 */ bgp_nht_interface_events(peer); - - return 0; } /* BGP socket bind. */ diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 19ae13720..8313c12e6 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -54,7 +54,7 @@ static void register_zebra_rnh(struct bgp_nexthop_cache *bnc, static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc, int is_bgp_static_route); 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) { @@ -608,14 +608,14 @@ void bgp_nht_ifp_down(struct interface *ifp) 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); struct bgp *bgp = THREAD_ARG(thread); struct interface *ifp = if_lookup_by_index(ifindex, bgp->vrf_id); if (!ifp) - return 0; + return; if (BGP_DEBUG(nht, NHT)) zlog_debug( @@ -626,8 +626,6 @@ static int bgp_nht_ifp_initial(struct thread *thread) bgp_nht_ifp_up(ifp); else bgp_nht_ifp_down(ifp); - - return 0; } /* diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 4bb08404d..8fac36cf6 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -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 * 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); @@ -407,14 +407,14 @@ int bgp_generate_updgrp_packets(struct thread *thread) * update-delay processing). */ if (!peer_established(peer)) - return 0; + return; if ((peer->bgp->main_peers_update_hold) || bgp_update_delay_active(peer->bgp)) - return 0; + return; if (peer->t_routeadv) - return 0; + return; do { enum bgp_af_index index; @@ -541,8 +541,6 @@ int bgp_generate_updgrp_packets(struct thread *thread) bgp_writes_on(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; } -static int bgp_refresh_stalepath_timer_expire(struct thread *thread) +static void bgp_refresh_stalepath_timer_expire(struct thread *thread) { struct peer_af *paf; @@ -1560,8 +1558,6 @@ static int bgp_refresh_stalepath_timer_expire(struct thread *thread) peer->host, afi2str(afi), safi2str(safi)); bgp_timer_set(peer); - - return 0; } /** @@ -2573,7 +2569,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size) * @param thread * @return 0 */ -int bgp_process_packet(struct thread *thread) +void bgp_process_packet(struct thread *thread) { /* Yes first of all get peer pointer. */ struct peer *peer; // peer @@ -2588,7 +2584,7 @@ int bgp_process_packet(struct thread *thread) /* Guard against scheduled events that occur after peer deletion. */ if (peer->status == Deleted || peer->status == Clearing) - return 0; + return; unsigned int processed = 0; @@ -2602,7 +2598,7 @@ int bgp_process_packet(struct thread *thread) } if (peer->curr == NULL) // no packets to process, hmm... - return 0; + return; /* skip the marker and copy the packet length */ stream_forward_getp(peer->curr, BGP_MARKER_SIZE); @@ -2732,8 +2728,6 @@ int bgp_process_packet(struct thread *thread) &peer->t_process_packet); } } - - return 0; } /* 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 * struct. */ -int bgp_packet_process_error(struct thread *thread) +void bgp_packet_process_error(struct thread *thread) { struct peer *peer; int code; @@ -2777,6 +2771,4 @@ int bgp_packet_process_error(struct thread *thread) } bgp_event_update(peer, code); - - return 0; } diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index 280d3ec17..8c2de6d62 100644 --- a/bgpd/bgp_packet.h +++ b/bgpd/bgp_packet.h @@ -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 void bgp_packet_set_size(struct stream *s); -extern int bgp_generate_updgrp_packets(struct thread *); -extern int bgp_process_packet(struct thread *); +extern void bgp_generate_updgrp_packets(struct thread *); +extern void bgp_process_packet(struct thread *); extern void bgp_send_delayed_eor(struct bgp *bgp); /* 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 */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 0238e36cd..bd7031def 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2402,7 +2402,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, 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; afi_t afi; @@ -2423,7 +2423,7 @@ static int bgp_route_select_timer_expire(struct thread *thread) XFREE(MTYPE_TMP, info); /* 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, @@ -3354,7 +3354,7 @@ void bgp_add_eoiu_mark(struct bgp *bgp) 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; @@ -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)) 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, @@ -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 * 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 *peer; @@ -4719,17 +4717,15 @@ static int bgp_announce_route_timer_expired(struct thread *t) peer = paf->peer; if (!peer_established(peer)) - return 0; + return; if (!peer->afc_nego[paf->afi][paf->safi]) - return 0; + return; peer_af_announce_route(paf, 1); /* Notify BGP conditional advertisement scanner percess */ 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, * 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; int ret; @@ -4933,7 +4929,7 @@ static int bgp_soft_reconfig_table_task(struct thread *thread) &table->soft_reconfig_peers); bgp_soft_reconfig_table_flag( table, false); - return 0; + return; } } } @@ -4947,7 +4943,7 @@ static int bgp_soft_reconfig_table_task(struct thread *thread) table->soft_reconfig_init = false; thread_add_event(bm->master, bgp_soft_reconfig_table_task, table, 0, &table->soft_reconfig_thread); - return 0; + return; } /* we're done, clean up the background iteration context info and schedule route annoucement @@ -4958,8 +4954,6 @@ static int bgp_soft_reconfig_table_task(struct thread *thread) } 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 *top; @@ -12862,7 +12856,7 @@ static int bgp_table_stats_walker(struct thread *t) unsigned int space = 0; if (!(top = bgp_table_top(ts->table))) - return 0; + return; switch (ts->table->afi) { case AFI_IP: @@ -12875,7 +12869,7 @@ static int bgp_table_stats_walker(struct thread *t) space = EVPN_ROUTE_PREFIXLEN; break; default: - return 0; + return; } 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); } } - - return 0; } 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; const struct bgp_table *table; @@ -13237,8 +13229,6 @@ static int bgp_peer_count_walker(struct thread *t) } else for (rn = bgp_table_top(pc->table); rn; rn = bgp_route_next(rn)) bgp_peer_count_proc(rn, pc); - - return 0; } static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi, diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index efb7f9eb7..657e022db 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4042,13 +4042,11 @@ static void bgp_route_map_process_update_cb(char *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; route_map_walk_update_list(bgp_route_map_process_update_cb); - - return 0; } static void bgp_route_map_mark_update(const char *rmap_name) diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index b320e4e71..5d1ae766e 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -357,7 +357,7 @@ static struct prefix *pfx_record_to_prefix(struct pfx_record *record) return prefix; } -static int bgpd_sync_callback(struct thread *thread) +static void bgpd_sync_callback(struct thread *thread) { struct bgp *bgp; struct listnode *node; @@ -375,13 +375,13 @@ static int bgpd_sync_callback(struct thread *thread) atomic_store_explicit(&rtr_update_overflow, 0, memory_order_seq_cst); revalidate_all_routes(); - return 0; + return; } retval = read(socket, &rec, sizeof(struct pfx_record)); if (retval != sizeof(struct pfx_record)) { RPKI_DEBUG("Could not read from socket"); - return retval; + return; } /* 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) { reset(true); - return 0; + return; } prefix = pfx_record_to_prefix(&rec); @@ -421,7 +421,6 @@ static int bgpd_sync_callback(struct thread *thread) } prefix_free(&prefix); - return 0; } static void revalidate_bgp_node(struct bgp_dest *bgp_dest, afi_t afi, diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index bfcb4810d..aa3e44318 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1157,7 +1157,7 @@ bool update_subgroup_check_merge(struct update_subgroup *subgrp, /* * 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; @@ -1166,7 +1166,6 @@ static int update_subgroup_merge_check_thread_cb(struct thread *thread) subgrp->t_merge_check = NULL; 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; } -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; char reason[] = "refresh default-originate route-map"; @@ -1813,8 +1812,6 @@ int update_group_refresh_default_originate_route_map(struct thread *thread) reason); thread_cancel(&bgp->t_rmap_def_originate_eval); bgp_unlock(bgp); - - return 0; } /* diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index 5a9bebf8f..0e10341bc 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -375,7 +375,7 @@ extern void update_group_af_walk(struct bgp *bgp, afi_t afi, safi_t safi, 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 int +extern void update_group_refresh_default_originate_route_map(struct thread *thread); extern void update_group_start_advtimer(struct bgp *bgp); diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 97b32643b..0d8ee79ae 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -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); } -static int subgroup_coalesce_timer(struct thread *thread) +static void subgroup_coalesce_timer(struct thread *thread) { struct update_subgroup *subgrp; 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); } } - - return 0; } static int update_group_announce_walkcb(struct update_group *updgrp, void *arg) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 6691dc56c..c295b0660 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1019,7 +1019,7 @@ static bool bgp_tm_chunk_obtained; static uint32_t bgp_tm_min, bgp_tm_max, bgp_tm_chunk_size; 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; 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, &bgp_tm_thread_connect); - return 0; } bool bgp_zebra_tm_chunk_obtained(void) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 43046f7f1..16488eb4a 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3044,14 +3044,12 @@ int peer_group_bind(struct bgp *bgp, union sockunion *su, struct peer *peer, return 0; } -static int bgp_startup_timer_expire(struct thread *thread) +static void bgp_startup_timer_expire(struct thread *thread) { struct bgp *bgp; bgp = THREAD_ARG(thread); bgp->t_startup = NULL; - - return 0; } /* diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 8b93c450e..926b0b033 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -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_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 int peer_cmp(struct peer *p1, struct peer *p2); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 1f60c6699..1d58c0331 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -2372,7 +2372,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi) * quagga lib/thread.h says this must return int even though * 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 bgp_path_info *bpi = wcb->info; @@ -2385,13 +2385,13 @@ static int rfapiWithdrawTimerVPN(struct thread *t) vnc_zlog_debug_verbose( "%s: NULL BGP pointer, assume shutdown race condition!!!", __func__); - return 0; + return; } if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) { vnc_zlog_debug_verbose( "%s: BGP delete in progress, assume shutdown race condition!!!", __func__); - return 0; + return; } assert(wcb->node); assert(bpi); @@ -2503,7 +2503,6 @@ done: RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, 1 + wcb->lockoffset); agg_unlock_node(wcb->node); /* decr ref count */ XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - return 0; } /* @@ -2674,7 +2673,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table, return 0; } -static int rfapiWithdrawTimerEncap(struct thread *t) +static void rfapiWithdrawTimerEncap(struct thread *t) { struct rfapi_withdraw *wcb = t->arg; struct bgp_path_info *bpi = wcb->info; @@ -2748,7 +2747,6 @@ done: agg_unlock_node(wcb->node); /* decr ref count */ XFREE(MTYPE_RFAPI_WITHDRAW, wcb); skiplist_free(vpn_node_sl); - return 0; } @@ -2760,7 +2758,7 @@ static void rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, struct agg_node *rn, struct bgp_path_info *bpi, afi_t afi, safi_t safi, - int (*timer_service_func)(struct thread *)) + void (*timer_service_func)(struct thread *)) { uint32_t lifetime; struct rfapi_withdraw *wcb; @@ -4062,7 +4060,7 @@ static void rfapiProcessPeerDownRt(struct peer *peer, struct agg_node *rn; struct bgp_path_info *bpi; struct agg_table *rt; - int (*timer_service_func)(struct thread *); + void (*timer_service_func)(struct thread *); assert(afi == AFI_IP || afi == AFI_IP6); diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h index 50093111c..387e6c47c 100644 --- a/bgpd/rfapi/rfapi_import.h +++ b/bgpd/rfapi/rfapi_import.h @@ -126,8 +126,6 @@ extern void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, 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 void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p); diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index ce916c104..58a0f8dea 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -731,7 +731,7 @@ void rfapiMonitorResponseRemovalOn(struct bgp *bgp) 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; @@ -740,8 +740,6 @@ static int rfapiMonitorTimerExpire(struct thread *t) /* delete the monitor */ rfapiMonitorDel(bgp_get_default(), m->rfd, &m->p); - - return 0; } 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; @@ -1052,7 +1050,6 @@ static int rfapiMonitorEthTimerExpire(struct thread *t) rfapiMonitorEthDel(bgp_get_default(), m->rfd, &m->macaddr, m->logical_net_id); - return 0; } static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m) diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 6f555d368..ba0c576f1 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -291,7 +291,7 @@ struct rfapi_rib_tcb { /* * remove route from rib */ -static int rfapiRibExpireTimer(struct thread *t) +static void rfapiRibExpireTimer(struct thread *t) { struct rfapi_rib_tcb *tcb = t->arg; @@ -328,8 +328,6 @@ static int rfapiRibExpireTimer(struct thread *t) XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); RFAPI_RIB_CHECK_COUNTS(1, 0); - - return 0; } static void rfapiRibStartTimer(struct rfapi_descriptor *rfd, diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index 67c43a867..f4f2e1139 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -1728,7 +1728,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, bgp_attr_unintern(&iattr); } -static int vncExportWithdrawTimer(struct thread *t) +static void vncExportWithdrawTimer(struct thread *t) { struct vnc_export_info *eti = t->arg; const struct prefix *p = agg_node_get_prefix(eti->node); @@ -1747,8 +1747,6 @@ static int vncExportWithdrawTimer(struct thread *t) * Free the eti */ vnc_eti_delete(eti); - - return 0; } /* diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c index 69c0d22ae..8d50ed689 100644 --- a/eigrpd/eigrp_filter.c +++ b/eigrpd/eigrp_filter.c @@ -251,13 +251,13 @@ void eigrp_distribute_update_all_wrapper(struct access_list *notused) * * @param[in] thread current execution thread timer is associated with * - * @return int always returns 0 + * @return void * * @par * Called when 10sec waiting time expire and * 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; @@ -265,8 +265,6 @@ int eigrp_distribute_timer_process(struct thread *thread) /* execute GR for whole process */ 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 * - * @return int always returns 0 + * @return void * * @par * Called when 10sec waiting time expire and * 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; @@ -289,6 +287,4 @@ int eigrp_distribute_timer_interface(struct thread *thread) /* execute GR for interface */ eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL); - - return 0; } diff --git a/eigrpd/eigrp_filter.h b/eigrpd/eigrp_filter.h index 03f45cedb..4dbfe276d 100644 --- a/eigrpd/eigrp_filter.h +++ b/eigrpd/eigrp_filter.h @@ -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_all(struct prefix_list *plist); extern void eigrp_distribute_update_all_wrapper(struct access_list *alist); -extern int eigrp_distribute_timer_process(struct thread *thread); -extern int eigrp_distribute_timer_interface(struct thread *thread); +extern void eigrp_distribute_timer_process(struct thread *thread); +extern void eigrp_distribute_timer_interface(struct thread *thread); #endif /* EIGRPD_EIGRP_FILTER_H_ */ diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index 2ff8fc5f3..717d8c095 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -74,14 +74,14 @@ static const struct message eigrp_general_tlv_type_str[] = { * * @param[in] thread current execution thread timer is associated with * - * @return int always returns 0 + * @return void * * @par * Called once per "hello" time interval, default 5 seconds * Sends hello packet via multicast for all interfaces eigrp * is configured for */ -int eigrp_hello_timer(struct thread *thread) +void eigrp_hello_timer(struct thread *thread) { struct eigrp_interface *ei; @@ -97,8 +97,6 @@ int eigrp_hello_timer(struct thread *thread) /* Hello timer set. */ thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello, &ei->t_hello); - - return 0; } /** diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index f2d5217eb..0ed8927d4 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -189,7 +189,7 @@ void eigrp_nbr_delete(struct 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 *eigrp = nbr->ei->eigrp; @@ -198,8 +198,6 @@ int holddown_timer_expired(struct thread *thread) ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); nbr->state = EIGRP_NEIGHBOR_DOWN; eigrp_nbr_delete(nbr); - - return 0; } uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *nbr) diff --git a/eigrpd/eigrp_neighbor.h b/eigrpd/eigrp_neighbor.h index 80ab1eded..693d780f0 100644 --- a/eigrpd/eigrp_neighbor.h +++ b/eigrpd/eigrp_neighbor.h @@ -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 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, struct TLV_Parameter_Type *tlv); diff --git a/eigrpd/eigrp_network.h b/eigrpd/eigrp_network.h index eeb32ba35..912a9248c 100644 --- a/eigrpd/eigrp_network.h +++ b/eigrpd/eigrp_network.h @@ -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_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 int eigrp_if_add_allspfrouters(struct eigrp *, struct prefix *, unsigned int); diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 529d94567..491b2994b 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -320,7 +320,7 @@ int eigrp_check_sha256_digest(struct stream *s, return 1; } -int eigrp_write(struct thread *thread) +void eigrp_write(struct thread *thread) { struct eigrp *eigrp = THREAD_ARG(thread); struct eigrp_header *eigrph; @@ -471,12 +471,10 @@ out: thread_add_write(master, eigrp_write, eigrp, eigrp->fd, &eigrp->t_write); } - - return 0; } /* Starting point of packet process function. */ -int eigrp_read(struct thread *thread) +void eigrp_read(struct thread *thread) { int ret; struct stream *ibuf; @@ -500,7 +498,7 @@ int eigrp_read(struct thread *thread) 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 * header. */ - return -1; + return; } /* Note that there should not be alignment problems with this assignment @@ -531,7 +529,7 @@ int eigrp_read(struct thread *thread) eigrp->vrf_id); if (c == NULL) - return 0; + return; ifp = c->ifp; } @@ -546,7 +544,7 @@ int eigrp_read(struct thread *thread) must remain very accurate in doing this. */ if (!ei) - return 0; + return; /* Self-originated packet should be discarded silently. */ if (eigrp_if_lookup_by_local_addr(eigrp, NULL, iph->ip_src) @@ -555,7 +553,7 @@ int eigrp_read(struct thread *thread) zlog_debug( "eigrp_read[%pI4]: Dropping self-originated packet", &srcaddr); - return 0; + return; } /* 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", ntohs(eigrph->vrid), &iph->ip_dst, ntohs(eigrph->ASNumber)); - return 0; + return; } /* 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)) { eigrp_if_set_multicast(ei); } - return 0; + return; } /* 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( "Packet from [%pI4] received on wrong link %s", &iph->ip_src, ifp->name); - return 0; + return; } /* Verify more EIGRP header fields. */ @@ -609,7 +607,7 @@ int eigrp_read(struct thread *thread) zlog_debug( "eigrp_read[%pI4]: Header check failed, dropping.", &iph->ip_src); - return ret; + return; } /* 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); break; } - - return 0; } 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; } -int eigrp_unack_packet_retrans(struct thread *thread) +void eigrp_unack_packet_retrans(struct thread *thread) { struct eigrp_neighbor *nbr; 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); ep->retrans_counter++; - if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) - return eigrp_retrans_count_exceeded(ep, nbr); + if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) { + eigrp_retrans_count_exceeded(ep, nbr); + return; + } /*Start retransmission timer*/ 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, 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; 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); ep->retrans_counter++; - if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) - return eigrp_retrans_count_exceeded(ep, nbr); + if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX) { + eigrp_retrans_count_exceeded(ep, nbr); + return; + } /*Start retransmission timer*/ 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, nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); } - - return 0; } /* Get packet from tail of fifo. */ diff --git a/eigrpd/eigrp_packet.h b/eigrpd/eigrp_packet.h index cb69bc26b..f65917666 100644 --- a/eigrpd/eigrp_packet.h +++ b/eigrpd/eigrp_packet.h @@ -33,8 +33,8 @@ #define _ZEBRA_EIGRP_PACKET_H /*Prototypes*/ -extern int eigrp_read(struct thread *); -extern int eigrp_write(struct thread *); +extern void eigrp_read(struct thread *thread); +extern void eigrp_write(struct thread *thread); extern struct eigrp_packet *eigrp_packet_new(size_t size, 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, struct eigrp_interface *ei); -extern int eigrp_unack_packet_retrans(struct thread *thread); -extern int eigrp_unack_multicast_packet_retrans(struct thread *thread); +extern void eigrp_unack_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 @@ -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, struct eigrp_header *eigrph, struct stream *s, 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 @@ -96,7 +96,7 @@ extern void eigrp_update_send_all(struct eigrp *eigrp, struct eigrp_interface *exception); extern void eigrp_update_send_init(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, enum GR_type gr_type, struct vty *vty); extern void eigrp_update_send_interface_GR(struct eigrp_interface *ei, diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index 8a9eea8a7..5848632d8 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -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. */ -int eigrp_update_send_GR_thread(struct thread *thread) +void eigrp_update_send_GR_thread(struct thread *thread) { struct eigrp_neighbor *nbr; @@ -923,7 +923,7 @@ int eigrp_update_send_GR_thread(struct thread *thread) if (nbr->retrans_queue->count > 0) { thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, 10, &nbr->t_nbr_send_gr); - return 0; + return; } /* 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) { thread_execute(master, eigrp_update_send_GR_thread, nbr, 0); } - - return 0; } /** diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 2937df992..3e0d4ba54 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -250,7 +250,7 @@ void fabricd_finish(struct fabricd *f) 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); @@ -258,7 +258,6 @@ static int fabricd_initial_sync_timeout(struct thread *thread) f->initial_sync_circuit->interface->name); f->initial_sync_state = FABRICD_SYNC_PENDING; f->initial_sync_circuit = NULL; - return 0; } 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; } -static int fabricd_tier_set_timer(struct thread *thread) +static void fabricd_tier_set_timer(struct thread *thread) { struct fabricd *f = THREAD_ARG(thread); 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); uint8_t tier = ISIS_TIER_UNDEFINED; tier = fabricd_calculate_fabric_tier(f->area); if (tier == ISIS_TIER_UNDEFINED) - return 0; + return; zlog_info("OpenFabric: Got tier %hhu from algorithm. Arming timer.", tier); @@ -423,7 +421,6 @@ static int fabricd_tier_calculation_cb(struct thread *thread) f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], &f->tier_set_timer); - return 0; } static void fabricd_bump_tier_calculation_timer(struct fabricd *f) diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index d75613f30..06909c430 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -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; @@ -461,8 +461,6 @@ int isis_adj_expire(struct thread *thread) /* trigger the adj expire event */ isis_adj_state_change(&adj, ISIS_ADJ_DOWN, "holding time expired"); - - return 0; } /* diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h index af70775a8..4d84c5ca4 100644 --- a/isisd/isis_adjacency.h +++ b/isisd/isis_adjacency.h @@ -141,13 +141,13 @@ void isis_adj_state_change(struct isis_adjacency **adj, enum isis_adj_state state, const char *reason); void isis_adj_print(struct isis_adjacency *adj); 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, char detail); void isis_adj_build_neigh_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_bfd_startup_timer(struct thread *thread); +void isis_bfd_startup_timer(struct thread *thread); const char *isis_adj_name(const struct isis_adjacency *adj); #endif /* ISIS_ADJACENCY_H */ diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index e09e23aae..78197974d 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -61,7 +61,7 @@ const char *isis_disflag2string(int disflag) 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); @@ -76,7 +76,7 @@ int isis_run_dr(struct thread *thread) zlog_warn("%s: scheduled for non broadcast circuit from %s:%d", __func__, thread->xref->xref.file, thread->xref->xref.line); - return ISIS_WARNING; + return; } 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.run_dr_elect[level - 1] = 1; - - return ISIS_OK; } static int isis_check_dr_change(struct isis_adjacency *adj, int level) diff --git a/isisd/isis_dr.h b/isisd/isis_dr.h index 5cab985d4..f01a03f37 100644 --- a/isisd/isis_dr.h +++ b/isisd/isis_dr.h @@ -24,7 +24,7 @@ #ifndef _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_resign(struct isis_circuit *circuit, int level); int isis_dr_commence(struct isis_circuit *circuit, int level); diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c index ade6e8222..8d76e8193 100644 --- a/isisd/isis_dynhn.c +++ b/isisd/isis_dynhn.c @@ -42,7 +42,7 @@ 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) { @@ -67,7 +67,7 @@ void dyn_cache_finish(struct isis *isis) 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 isis_dynhn *dyn; @@ -87,8 +87,6 @@ static int dyn_cache_cleanup(struct thread *thread) thread_add_timer(master, dyn_cache_cleanup, isis, 120, &isis->t_dync_clean); - - return ISIS_OK; } struct isis_dynhn *dynhn_find_by_id(struct isis *isis, const uint8_t *id) diff --git a/isisd/isis_events.c b/isisd/isis_events.c index 26c68db76..fce48fec9 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -209,7 +209,7 @@ void isis_circuit_is_type_set(struct isis_circuit *circuit, int newtype) /* 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; @@ -217,15 +217,13 @@ int isis_event_dis_status_change(struct thread *thread) /* invalid arguments */ if (!circuit || !circuit->area) - return 0; + return; if (IS_DEBUG_EVENTS) zlog_debug("ISIS-Evt (%s) DIS status change", circuit->area->area_tag); /* LSP generation again */ 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, diff --git a/isisd/isis_events.h b/isisd/isis_events.h index 25643f4ed..e6d9af58b 100644 --- a/isisd/isis_events.h +++ b/isisd/isis_events.h @@ -31,7 +31,7 @@ void isis_event_circuit_type_change(struct isis_circuit *circuit, int newtype); /* * Events related to adjacencies */ -int isis_event_dis_status_change(struct thread *thread); +void isis_event_dis_status_change(struct thread *thread); /* * Error events diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index 0c541348d..3c68b8d15 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -344,7 +344,7 @@ void isis_ldp_sync_set_if_metric(struct isis_circuit *circuit, bool run_regen) /* * 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 ldp_sync_info *ldp_sync_info; @@ -355,7 +355,7 @@ static int isis_ldp_sync_holddown_timer(struct thread *thread) */ circuit = THREAD_ARG(thread); if (circuit->ldp_sync_info == NULL) - return 0; + return; ldp_sync_info = circuit->ldp_sync_info; @@ -366,7 +366,6 @@ static int isis_ldp_sync_holddown_timer(struct thread *thread) circuit->interface->name); isis_ldp_sync_set_if_metric(circuit, true); - return 0; } void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit) diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index 84aac24d5..d515873ec 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -1401,7 +1401,7 @@ static struct rlfa *rlfa_lookup(struct isis_spftree *spftree, 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); @@ -1409,8 +1409,6 @@ static int isis_area_verify_routes_cb(struct thread *thread) zlog_debug("ISIS-LFA: updating RLFAs in the RIB"); isis_area_verify_routes(area); - - return 0; } static mpls_label_t rlfa_nexthop_label(struct isis_spftree *spftree, diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 92d329f03..463d26f6c 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -62,9 +62,9 @@ DEFINE_MTYPE_STATIC(ISISD, ISIS_LSP, "ISIS LSP"); -static int lsp_refresh(struct thread *thread); -static int lsp_l1_refresh_pseudo(struct thread *thread); -static int lsp_l2_refresh_pseudo(struct thread *thread); +static void lsp_refresh(struct thread *thread); +static void lsp_l1_refresh_pseudo(struct thread *thread); +static void lsp_l2_refresh_pseudo(struct thread *thread); 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 */ -static int lsp_refresh(struct thread *thread) +static void lsp_refresh(struct thread *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; if ((area->is_type & level) == 0) - return ISIS_ERROR; + return; /* * 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); _lsp_regenerate_schedule(area, level, 0, false, __func__, __FILE__, __LINE__); - return 0; + return; } sched_debug( "ISIS (%s): LSP L%d refresh timer expired. Refreshing LSP...", area->area_tag, level); - return lsp_regenerate(area, level); + lsp_regenerate(area, 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 */ -static int lsp_l1_refresh_pseudo(struct thread *thread) +static void lsp_l1_refresh_pseudo(struct thread *thread) { struct isis_circuit *circuit; 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_FRAGMENT(id) = 0; 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; 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_FRAGMENT(id) = 0; 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) @@ -1973,7 +1973,7 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level) * Walk through LSPs for an area * - set remaining lifetime */ -int lsp_tick(struct thread *thread) +void lsp_tick(struct thread *thread) { struct isis_area *area; struct isis_lsp *lsp; @@ -2064,8 +2064,6 @@ int lsp_tick(struct thread *thread) && !isis_tx_queue_len(fabricd_init_c->tx_queue)) { fabricd_initial_sync_finish(area); } - - return ISIS_OK; } void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level) diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h index cac5f0d73..f42d702b3 100644 --- a/isisd/isis_lsp.h +++ b/isisd/isis_lsp.h @@ -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_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); #define lsp_regenerate_schedule(area, level, all_pseudo) \ diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 0814f3eea..517c9ec5a 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1793,11 +1793,10 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) return retval; } -int isis_receive(struct thread *thread) +void isis_receive(struct thread *thread) { struct isis_circuit *circuit; uint8_t ssnpa[ETH_ALEN]; - int retval; /* * Get the circuit @@ -1809,20 +1808,22 @@ int isis_receive(struct thread *thread) isis_circuit_stream(circuit, &circuit->rcv_stream); +#if ISIS_METHOD != ISIS_METHOD_BPF + int retval; + retval = circuit->rx(circuit, ssnpa); -#if ISIS_METHOD != ISIS_METHOD_BPF if (retval == ISIS_OK) - retval = isis_handle_pdu(circuit, ssnpa); -#endif //ISIS_METHOD != ISIS_METHOD_BPF + isis_handle_pdu(circuit, ssnpa); +#else // ISIS_METHOD != ISIS_METHOD_BPF + circuit->rx(circuit, ssnpa); +#endif /* * prepare for next packet. */ if (!circuit->is_passive) isis_circuit_prepare(circuit); - - return retval; } /* @@ -2015,7 +2016,7 @@ int send_hello(struct isis_circuit *circuit, int level) 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); assert(arg); @@ -2030,30 +2031,29 @@ static int send_hello_cb(struct thread *thread) send_hello(circuit, 1); send_hello_sched(circuit, ISIS_LEVEL1, 1000 * circuit->hello_interval[1]); - return ISIS_OK; + return; } if (circuit->circ_type != CIRCUIT_T_BROADCAST) { zlog_warn("ISIS-Hello (%s): Trying to send hello on unknown circuit type %d", circuit->area->area_tag, circuit->circ_type); - return ISIS_WARNING; + return; } circuit->u.bc.t_send_lan_hello[level - 1] = NULL; if (!(circuit->is_type & level)) { zlog_warn("ISIS-Hello (%s): Trying to send L%d IIH in L%d-only circuit", circuit->area->area_tag, level, 3 - level); - return ISIS_WARNING; + return; } if (circuit->u.bc.run_dr_elect[level - 1]) isis_dr_elect(circuit, level); - int rv = send_hello(circuit, level); + send_hello(circuit, level); /* set next timer thread */ send_hello_sched(circuit, level, 1000 * circuit->hello_interval[level - 1]); - return rv; } 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; } -int send_l1_csnp(struct thread *thread) +void send_l1_csnp(struct thread *thread) { struct isis_circuit *circuit; @@ -2265,11 +2265,9 @@ int send_l1_csnp(struct thread *thread) thread_add_timer(master, send_l1_csnp, circuit, isis_jitter(circuit->csnp_interval[0], CSNP_JITTER), &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; @@ -2287,8 +2285,6 @@ int send_l2_csnp(struct thread *thread) thread_add_timer(master, send_l2_csnp, circuit, isis_jitter(circuit->csnp_interval[1], CSNP_JITTER), &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; } -int send_l1_psnp(struct thread *thread) +void send_l1_psnp(struct thread *thread) { struct isis_circuit *circuit; @@ -2420,15 +2416,13 @@ int send_l1_psnp(struct thread *thread) thread_add_timer(master, send_l1_psnp, circuit, isis_jitter(circuit->psnp_interval[0], PSNP_JITTER), &circuit->t_send_psnp[0]); - - return ISIS_OK; } /* * 7.3.15.4 action on expiration of partial SNP interval * level 2 */ -int send_l2_psnp(struct thread *thread) +void send_l2_psnp(struct thread *thread) { struct isis_circuit *circuit; @@ -2443,8 +2437,6 @@ int send_l2_psnp(struct thread *thread) thread_add_timer(master, send_l2_psnp, circuit, isis_jitter(circuit->psnp_interval[1], PSNP_JITTER), &circuit->t_send_psnp[1]); - - return ISIS_OK; } /* diff --git a/isisd/isis_pdu.h b/isisd/isis_pdu.h index 1e70a42f1..b2e43781f 100644 --- a/isisd/isis_pdu.h +++ b/isisd/isis_pdu.h @@ -195,7 +195,7 @@ struct isis_partial_seqnum_hdr { /* * Function for receiving IS-IS PDUs */ -int isis_receive(struct thread *thread); +void isis_receive(struct thread *thread); /* * 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); int send_csnp(struct isis_circuit *circuit, int level); -int send_l1_csnp(struct thread *thread); -int send_l2_csnp(struct thread *thread); -int send_l1_psnp(struct thread *thread); -int send_l2_psnp(struct thread *thread); +void send_l1_csnp(struct thread *thread); +void send_l2_csnp(struct thread *thread); +void send_l1_psnp(struct thread *thread); +void send_l2_psnp(struct thread *thread); void send_lsp(struct isis_circuit *circuit, struct isis_lsp *lsp, enum isis_tx_type tx_type); void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream); diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 5718b48b9..04b5cf1a6 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1832,7 +1832,7 @@ void isis_spf_invalidate_routes(struct isis_spftree *tree) 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_area *area = run->area; @@ -1845,7 +1845,7 @@ static int isis_run_spf_cb(struct thread *thread) if (IS_DEBUG_SPF_EVENTS) zlog_warn("ISIS-SPF (%s) area does not share level", area->area_tag); - return ISIS_WARNING; + return; } 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); fabricd_run_spf(area); - - return 0; } static struct isis_spf_run *isis_run_spf_arg(struct isis_area *area, int level) diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 18a727add..91886cbc3 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -1090,7 +1090,7 @@ DEFUN(show_sr_node, show_sr_node_cmd, * * @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; @@ -1098,8 +1098,6 @@ static int sr_start_label_manager(struct thread *start) /* re-attempt to start SR & Label Manager connection */ isis_sr_start(area); - - return 1; } /** diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c index d3da5b9d3..078329221 100644 --- a/isisd/isis_tx_queue.c +++ b/isisd/isis_tx_queue.c @@ -114,7 +114,7 @@ static struct isis_tx_queue_entry *tx_queue_find(struct isis_tx_queue *queue, 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 *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); /* Don't access e here anymore, send_event might have destroyed it */ - - return 0; } void _isis_tx_queue_add(struct isis_tx_queue *queue, diff --git a/ldpd/accept.c b/ldpd/accept.c index e8d3976ee..2999a35c0 100644 --- a/ldpd/accept.c +++ b/ldpd/accept.c @@ -25,7 +25,7 @@ struct accept_ev { LIST_ENTRY(accept_ev) entry; struct thread *ev; - int (*accept_cb)(struct thread *); + void (*accept_cb)(struct thread *); void *arg; int fd; }; @@ -37,8 +37,8 @@ struct { static void accept_arm(void); static void accept_unarm(void); -static int accept_cb(struct thread *); -static int accept_timeout(struct thread *); +static void accept_cb(struct thread *); +static void accept_timeout(struct thread *); void accept_init(void) @@ -46,8 +46,7 @@ accept_init(void) LIST_INIT(&accept_queue.queue); } -int -accept_add(int fd, int (*cb)(struct thread *), void *arg) +int accept_add(int fd, void (*cb)(struct thread *), void *arg) { struct accept_ev *av; @@ -115,23 +114,17 @@ accept_unarm(void) thread_cancel(&av->ev); } -static int -accept_cb(struct thread *thread) +static void accept_cb(struct thread *thread) { struct accept_ev *av = THREAD_ARG(thread); thread_add_read(master, accept_cb, av, av->fd, &av->ev); av->accept_cb(thread); - - return (0); } -static int -accept_timeout(struct thread *thread) +static void accept_timeout(struct thread *thread) { accept_queue.evt = NULL; log_debug(__func__); accept_arm(); - - return (0); } diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c index d390e70ad..bbc8a277a 100644 --- a/ldpd/adjacency.c +++ b/ldpd/adjacency.c @@ -26,12 +26,12 @@ #include "log.h" 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 void tnbr_del(struct ldpd_conf *, struct tnbr *); static void tnbr_start(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_stop_hello_timer(struct tnbr *); @@ -172,8 +172,7 @@ adj_get_af(const struct adj *adj) /* adjacency timers */ /* ARGSUSED */ -static int -adj_itimer(struct thread *thread) +static void adj_itimer(struct thread *thread) { struct adj *adj = THREAD_ARG(thread); @@ -187,13 +186,11 @@ adj_itimer(struct thread *thread) adj->source.target->rlfa_count == 0) { /* remove dynamic targeted neighbor */ tnbr_del(leconf, adj->source.target); - return (0); + return; } } adj_del(adj, S_HOLDTIME_EXP); - - return (0); } void @@ -345,16 +342,13 @@ tnbr_get_hello_interval(struct tnbr *tnbr) /* target neighbors timers */ /* ARGSUSED */ -static int -tnbr_hello_timer(struct thread *thread) +static void tnbr_hello_timer(struct thread *thread) { struct tnbr *tnbr = THREAD_ARG(thread); tnbr->hello_timer = NULL; send_hello(HELLO_TARGETED, NULL, tnbr); tnbr_start_hello_timer(tnbr); - - return (0); } static void diff --git a/ldpd/control.c b/ldpd/control.c index 3b7776595..376f488bd 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -26,11 +26,11 @@ #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_connbypid(pid_t); static void control_close(int); -static int control_dispatch_imsg(struct thread *); +static void control_dispatch_imsg(struct thread *); struct ctl_conns ctl_conns; @@ -101,8 +101,7 @@ control_cleanup(char *path) } /* ARGSUSED */ -static int -control_accept(struct thread *thread) +static void control_accept(struct thread *thread) { int connfd; socklen_t len; @@ -121,14 +120,14 @@ control_accept(struct thread *thread) else if (errno != EWOULDBLOCK && errno != EINTR && errno != ECONNABORTED) log_warn("%s: accept", __func__); - return (0); + return; } sock_set_nonblock(connfd); if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) { log_warn(__func__); close(connfd); - return (0); + return; } imsg_init(&c->iev.ibuf, connfd); @@ -140,8 +139,6 @@ control_accept(struct thread *thread) c->iev.ev_write = NULL; TAILQ_INSERT_TAIL(&ctl_conns, c, entry); - - return (0); } static struct ctl_conn * @@ -191,8 +188,7 @@ control_close(int fd) } /* ARGSUSED */ -static int -control_dispatch_imsg(struct thread *thread) +static void control_dispatch_imsg(struct thread *thread) { int fd = THREAD_FD(thread); struct ctl_conn *c; @@ -202,7 +198,7 @@ control_dispatch_imsg(struct thread *thread) if ((c = control_connbyfd(fd)) == NULL) { log_warnx("%s: fd %d: not found", __func__, fd); - return (0); + return; } 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) || n == 0) { control_close(fd); - return (0); + return; } for (;;) { if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) { control_close(fd); - return (0); + return; } if (n == 0) @@ -278,8 +274,6 @@ control_dispatch_imsg(struct thread *thread) } imsg_event_add(&c->iev); - - return (0); } int diff --git a/ldpd/interface.c b/ldpd/interface.c index 5e04eab1b..af6e8fd7e 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -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_reset(struct iface *, int); 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_stop_hello_timer(struct iface_af *); 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_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 stop_wait_for_ldp_sync_timer(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 */ /* ARGSUSED */ -static int -if_hello_timer(struct thread *thread) +static void if_hello_timer(struct thread *thread) { struct iface_af *ia = THREAD_ARG(thread); ia->hello_timer = NULL; send_hello(HELLO_LINK, ia, NULL); if_start_hello_timer(ia); - - return (0); } static void @@ -737,14 +734,11 @@ ldp_sync_act_iface_start_sync(struct iface *iface) return (0); } -static int -iface_wait_for_ldp_sync_timer(struct thread *thread) +static void iface_wait_for_ldp_sync_timer(struct thread *thread) { struct iface *iface = THREAD_ARG(thread); ldp_sync_fsm(iface, LDP_SYNC_EVT_LDP_SYNC_COMPLETE); - - return (0); } static void start_wait_for_ldp_sync_timer(struct iface *iface) diff --git a/ldpd/lde.c b/ldpd/lde.c index 55fa806d4..9d1daabbe 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -41,8 +41,8 @@ #include "libfrr.h" static void lde_shutdown(void); -static int lde_dispatch_imsg(struct thread *); -static int lde_dispatch_parent(struct thread *); +static void lde_dispatch_imsg(struct thread *thread); +static void lde_dispatch_parent(struct thread *thread); static __inline int lde_nbr_compare(const struct lde_nbr *, const 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 */ -static int -lde_dispatch_imsg(struct thread *thread) +static void lde_dispatch_imsg(struct thread *thread) { struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; @@ -422,13 +421,10 @@ lde_dispatch_imsg(struct thread *thread) thread_cancel(&iev->ev_write); lde_shutdown(); } - - return (0); } /* ARGSUSED */ -static int -lde_dispatch_parent(struct thread *thread) +static void lde_dispatch_parent(struct thread *thread) { static struct ldpd_conf *nconf; struct iface *iface, *niface; @@ -710,8 +706,6 @@ lde_dispatch_parent(struct thread *thread) thread_cancel(&iev->ev_write); lde_shutdown(); } - - return (0); } int @@ -2173,11 +2167,9 @@ lde_address_list_free(struct lde_nbr *ln) /* * 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(); - - return 0; } /* diff --git a/ldpd/lde.h b/ldpd/lde.h index dee6f3fcb..bcb1e1cca 100644 --- a/ldpd/lde.h +++ b/ldpd/lde.h @@ -227,7 +227,7 @@ void lde_check_withdraw(struct map *, struct lde_nbr *); void lde_check_withdraw_wcard(struct map *, struct lde_nbr *); int lde_wildcard_apply(struct map *, struct fec *, 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_stop_timer(void); diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 33bb6c0fc..1ade3c537 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -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 */ /* ARGSUSED */ -int -lde_gc_timer(struct thread *thread) +void lde_gc_timer(struct thread *thread) { struct fec *fec, *safe; struct fec_node *fn; @@ -1064,8 +1063,6 @@ lde_gc_timer(struct thread *thread) log_debug("%s: %u entries removed", __func__, count); lde_gc_start_timer(); - - return (0); } void diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 92cf24bd5..a78d2b25d 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -46,8 +46,8 @@ static void ldpd_shutdown(void); static pid_t start_child(enum ldpd_process, char *, int, int); -static int main_dispatch_ldpe(struct thread *); -static int main_dispatch_lde(struct thread *); +static void main_dispatch_ldpe(struct thread *thread); +static void main_dispatch_lde(struct thread *thread); static int main_imsg_send_ipc_sockets(struct imsgbuf *, struct imsgbuf *); 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), ); -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 @@ -231,8 +231,6 @@ static int ldp_config_fork_apply(struct thread *t) * after the read in of the config. */ ldp_config_apply(NULL, vty_conf); - - return 0; } int @@ -563,8 +561,7 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync) /* imsg handling */ /* ARGSUSED */ -static int -main_dispatch_ldpe(struct thread *thread) +static void main_dispatch_ldpe(struct thread *thread) { struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; @@ -627,13 +624,10 @@ main_dispatch_ldpe(struct thread *thread) else kill(lde_pid, SIGTERM); } - - return (0); } /* ARGSUSED */ -static int -main_dispatch_lde(struct thread *thread) +static void main_dispatch_lde(struct thread *thread) { struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; @@ -735,13 +729,10 @@ main_dispatch_lde(struct thread *thread) else kill(ldpe_pid, SIGTERM); } - - return (0); } /* ARGSUSED */ -int -ldp_write_handler(struct thread *thread) +void ldp_write_handler(struct thread *thread) { struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; @@ -755,12 +746,10 @@ ldp_write_handler(struct thread *thread) /* this pipe is dead, so remove the event handlers */ thread_cancel(&iev->ev_read); thread_cancel(&iev->ev_write); - return (0); + return; } imsg_event_add(iev); - - return (0); } void @@ -828,9 +817,8 @@ evbuf_event_add(struct evbuf *eb) &eb->ev); } -void -evbuf_init(struct evbuf *eb, int fd, int (*handler)(struct thread *), - void *arg) +void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct thread *), + void *arg) { msgbuf_init(&eb->wbuf); eb->wbuf.fd = fd; diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index 616c390e5..fd0097ca5 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -63,15 +63,15 @@ struct evbuf { struct msgbuf wbuf; struct thread *ev; - int (*handler)(struct thread *); + void (*handler)(struct thread *); void *arg; }; struct imsgev { struct imsgbuf ibuf; - int (*handler_write)(struct thread *); + void (*handler_write)(struct thread *); struct thread *ev_write; - int (*handler_read)(struct thread *); + void (*handler_read)(struct thread *); struct thread *ev_read; }; @@ -792,7 +792,7 @@ void sa2addr(struct sockaddr *, int *, union ldpd_addr *, socklen_t sockaddr_len(struct sockaddr *); /* 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_lde(int, pid_t, void *, uint16_t); 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); void evbuf_enqueue(struct evbuf *, struct ibuf *); void evbuf_event_add(struct evbuf *); -void evbuf_init(struct evbuf *, int, - int (*)(struct thread *), void *); +void evbuf_init(struct evbuf *, int, void (*)(struct thread *), void *); void evbuf_clear(struct evbuf *); int ldp_acl_request(struct imsgev *, char *, int, union ldpd_addr *, uint8_t); diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 31f8026e3..29abd420e 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -36,10 +36,10 @@ #include "libfrr.h" static void ldpe_shutdown(void); -static int ldpe_dispatch_main(struct thread *); -static int ldpe_dispatch_lde(struct thread *); +static void ldpe_dispatch_main(struct thread *thread); +static void ldpe_dispatch_lde(struct thread *thread); #ifdef __OpenBSD__ -static int ldpe_dispatch_pfkey(struct thread *); +static void ldpe_dispatch_pfkey(struct thread *thread); #endif static void ldpe_setup_sockets(int, int, int, 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 */ -static int -ldpe_dispatch_main(struct thread *thread) +static void ldpe_dispatch_main(struct thread *thread) { static struct ldpd_conf *nconf; struct iface *niface; @@ -631,13 +630,10 @@ ldpe_dispatch_main(struct thread *thread) thread_cancel(&iev->ev_write); ldpe_shutdown(); } - - return (0); } /* ARGSUSED */ -static int -ldpe_dispatch_lde(struct thread *thread) +static void ldpe_dispatch_lde(struct thread *thread) { struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; @@ -770,14 +766,11 @@ ldpe_dispatch_lde(struct thread *thread) thread_cancel(&iev->ev_write); ldpe_shutdown(); } - - return (0); } #ifdef __OpenBSD__ /* ARGSUSED */ -static int -ldpe_dispatch_pfkey(struct thread *thread) +static void ldpe_dispatch_pfkey(struct thread *thread) { int fd = THREAD_FD(thread); @@ -786,8 +779,6 @@ ldpe_dispatch_pfkey(struct thread *thread) if (pfkey_read(fd, NULL) == -1) fatal("pfkey_read failed, exiting..."); - - return (0); } #endif /* __OpenBSD__ */ diff --git a/ldpd/ldpe.h b/ldpd/ldpe.h index 0f650a86d..ddb0e0d97 100644 --- a/ldpd/ldpe.h +++ b/ldpd/ldpe.h @@ -148,7 +148,7 @@ extern struct nbr_pid_head nbrs_by_pid; /* accept.c */ 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_pause(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 send_packet(int, int, union ldpd_addr *, struct iface_af *, void *, size_t); -int disc_recv_packet(struct thread *); -int session_accept(struct thread *); +void disc_recv_packet(struct thread *thread); +void session_accept(struct thread *thread); void session_accept_nbr(struct nbr *, int); void session_shutdown(struct nbr *, uint32_t, uint32_t, uint32_t); diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index e884b3ebf..867ad92e4 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -35,13 +35,13 @@ static __inline int nbr_addr_compare(const struct nbr *, static __inline int nbr_pid_compare(const struct nbr *, const 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 int nbr_ktimeout(struct thread *); +static void nbr_ktimeout(struct thread *thread); 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 int nbr_idtimer(struct thread *); +static void nbr_idtimer(struct thread *thread); static int nbr_act_session_operational(struct nbr *); static void nbr_send_labelmappings(struct nbr *); 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 */ -static int -nbr_ktimer(struct thread *thread) +static void nbr_ktimer(struct thread *thread) { struct nbr *nbr = THREAD_ARG(thread); nbr->keepalive_timer = NULL; send_keepalive(nbr); nbr_start_ktimer(nbr); - - return (0); } static void @@ -451,8 +448,7 @@ nbr_stop_ktimer(struct nbr *nbr) /* Keepalive timeout: if the nbr hasn't sent keepalive */ -static int -nbr_ktimeout(struct thread *thread) +static void nbr_ktimeout(struct thread *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); session_shutdown(nbr, S_KEEPALIVE_TMR, 0, 0); - - return (0); } static void @@ -482,16 +476,13 @@ nbr_stop_ktimeout(struct nbr *nbr) /* Session initialization timeout: if nbr got stuck in the initialization FSM */ -static int -nbr_itimeout(struct thread *thread) +static void nbr_itimeout(struct thread *thread) { struct nbr *nbr = THREAD_ARG(thread); log_debug("%s: lsr-id %pI4", __func__, &nbr->id); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); - - return (0); } static void @@ -513,8 +504,7 @@ nbr_stop_itimeout(struct nbr *nbr) /* Init delay timer: timer to retry to iniziatize session */ -static int -nbr_idtimer(struct thread *thread) +static void nbr_idtimer(struct thread *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); nbr_establish_connection(nbr); - - return (0); } void @@ -573,8 +561,7 @@ nbr_pending_connect(struct nbr *nbr) return (nbr->ev_connect != NULL); } -static int -nbr_connect_cb(struct thread *thread) +static void nbr_connect_cb(struct thread *thread) { struct nbr *nbr = THREAD_ARG(thread); int error; @@ -585,7 +572,7 @@ nbr_connect_cb(struct thread *thread) len = sizeof(error); if (getsockopt(nbr->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { log_warn("%s: getsockopt SOL_SOCKET SO_ERROR", __func__); - return (0); + return; } if (error) { @@ -593,12 +580,10 @@ nbr_connect_cb(struct thread *thread) errno = error; log_debug("%s: error while connecting to %s: %s", __func__, log_addr(nbr->af, &nbr->raddr), strerror(errno)); - return (0); + return; } nbr_fsm(nbr, NBR_EVT_CONNECT_UP); - - return (0); } int diff --git a/ldpd/packet.c b/ldpd/packet.c index 56af16d28..707878ca9 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -28,12 +28,12 @@ static struct iface *disc_find_iface(unsigned int, int, union ldpd_addr *); -static int session_read(struct thread *); -static int session_write(struct thread *); +static void session_read(struct thread *thread); +static void session_write(struct thread *thread); static ssize_t session_get_pdu(struct ibuf_read *, char **); static void tcp_close(struct tcp_conn *); 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 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 */ -int -disc_recv_packet(struct thread *thread) +void disc_recv_packet(struct thread *thread) { int fd = THREAD_FD(thread); struct thread **threadp = THREAD_ARG(thread); @@ -158,7 +157,7 @@ disc_recv_packet(struct thread *thread) if (errno != EAGAIN && errno != EINTR) log_debug("%s: read error: %s", __func__, strerror(errno)); - return (0); + return; } sa2addr((struct sockaddr *)&from, &af, &src, NULL); @@ -205,7 +204,7 @@ disc_recv_packet(struct thread *thread) if (bad_addr(af, &src)) { log_debug("%s: invalid source address: %s", __func__, log_addr(af, &src)); - return (0); + return; } ifindex = getsockopt_ifindex(af, &m); @@ -213,7 +212,7 @@ disc_recv_packet(struct thread *thread) if (multicast) { iface = disc_find_iface(ifindex, af, &src); if (iface == NULL) - return (0); + return; } /* 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) { log_debug("%s: bad packet size, source %s", __func__, log_addr(af, &src)); - return (0); + return; } /* LDP header sanity checks */ @@ -229,12 +228,12 @@ disc_recv_packet(struct thread *thread) if (ntohs(ldp_hdr.version) != LDP_VERSION) { log_debug("%s: invalid LDP version %d, source %s", __func__, ntohs(ldp_hdr.version), log_addr(af, &src)); - return (0); + return; } if (ntohs(ldp_hdr.lspace_id) != 0) { log_debug("%s: invalid label space %u, source %s", __func__, ntohs(ldp_hdr.lspace_id), log_addr(af, &src)); - return (0); + return; } /* check "PDU Length" field */ pdu_len = ntohs(ldp_hdr.length); @@ -242,7 +241,7 @@ disc_recv_packet(struct thread *thread) (pdu_len > (len - LDP_HDR_DEAD_LEN))) { log_debug("%s: invalid LDP packet length %u, source %s", __func__, ntohs(ldp_hdr.length), log_addr(af, &src)); - return (0); + return; } buf += 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)) { log_debug("%s: invalid LDP message length %u, source %s", __func__, ntohs(msg.length), log_addr(af, &src)); - return (0); + return; } buf += 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_addr(af, &src)); } - - return (0); } static struct iface * @@ -304,8 +301,7 @@ disc_find_iface(unsigned int ifindex, int af, union ldpd_addr *src) return (iface); } -int -session_accept(struct thread *thread) +void session_accept(struct thread *thread) { int fd = THREAD_FD(thread); struct sockaddr_storage src; @@ -328,7 +324,7 @@ session_accept(struct thread *thread) errno != ECONNABORTED) log_debug("%s: accept error: %s", __func__, strerror(errno)); - return (0); + return; } sock_set_nonblock(newfd); @@ -357,22 +353,20 @@ session_accept(struct thread *thread) close(newfd); else pending_conn_new(newfd, af, &addr); - return (0); + return; } /* protection against buggy implementations */ if (nbr_session_active_role(nbr)) { close(newfd); - return (0); + return; } if (nbr->state != NBR_STA_PRESENT) { log_debug("%s: lsr-id %pI4: rejecting additional transport connection", __func__, &nbr->id); close(newfd); - return (0); + return; } session_accept_nbr(nbr, newfd); - - return (0); } void @@ -411,8 +405,7 @@ session_accept_nbr(struct nbr *nbr, int fd) nbr_fsm(nbr, NBR_EVT_MATCH_ADJ); } -static int -session_read(struct thread *thread) +static void session_read(struct thread *thread) { int fd = THREAD_FD(thread); struct nbr *nbr = THREAD_ARG(thread); @@ -431,16 +424,16 @@ session_read(struct thread *thread) if (errno != EINTR && errno != EAGAIN) { log_warn("%s: read error", __func__); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); - return (0); + return; } /* retry read */ - return (0); + return; } if (n == 0) { /* connection closed */ log_debug("%s: connection closed by remote end", __func__); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); - return (0); + return; } tcp->rbuf->wpos += n; @@ -450,7 +443,7 @@ session_read(struct thread *thread) if (ntohs(ldp_hdr->version) != LDP_VERSION) { session_shutdown(nbr, S_BAD_PROTO_VER, 0, 0); free(buf); - return (0); + return; } pdu_len = ntohs(ldp_hdr->length); @@ -467,14 +460,14 @@ session_read(struct thread *thread) pdu_len > max_pdu_len) { session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0); free(buf); - return (0); + return; } pdu_len -= LDP_HDR_PDU_LEN; if (ldp_hdr->lsr_id != nbr->id.s_addr || ldp_hdr->lspace_id != 0) { session_shutdown(nbr, S_BAD_LDP_ID, 0, 0); free(buf); - return (0); + return; } pdu += 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, msg->type); free(buf); - return (0); + return; } msg_size = msg_len + LDP_MSG_DEAD_LEN; pdu_len -= msg_size; @@ -505,7 +498,7 @@ session_read(struct thread *thread) session_shutdown(nbr, S_SHUTDOWN, msg->id, msg->type); free(buf); - return (0); + return; } break; case MSG_TYPE_KEEPALIVE: @@ -514,7 +507,7 @@ session_read(struct thread *thread) session_shutdown(nbr, S_SHUTDOWN, msg->id, msg->type); free(buf); - return (0); + return; } break; case MSG_TYPE_NOTIFICATION: @@ -524,7 +517,7 @@ session_read(struct thread *thread) session_shutdown(nbr, S_SHUTDOWN, msg->id, msg->type); free(buf); - return (0); + return; } break; } @@ -571,7 +564,7 @@ session_read(struct thread *thread) if (ret == -1) { /* parser failed, giving up */ free(buf); - return (0); + return; } /* no errors - update per neighbor message counters */ @@ -618,7 +611,7 @@ session_read(struct thread *thread) buf = NULL; if (len != 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. */ free(buf); - return (0); } -static int -session_write(struct thread *thread) +static void session_write(struct thread *thread) { struct tcp_conn *tcp = THREAD_ARG(thread); struct nbr *nbr = tcp->nbr; @@ -647,12 +638,10 @@ session_write(struct thread *thread) * close the socket. */ tcp_close(tcp); - return (0); + return; } evbuf_event_add(&tcp->wbuf); - - return (0); } void @@ -817,8 +806,7 @@ pending_conn_find(int af, union ldpd_addr *addr) return (NULL); } -static int -pending_conn_timeout(struct thread *thread) +static void pending_conn_timeout(struct thread *thread) { struct pending_conn *pconn = THREAD_ARG(thread); struct tcp_conn *tcp; @@ -837,6 +825,4 @@ pending_conn_timeout(struct thread *thread) msgbuf_write(&tcp->wbuf.wbuf); pending_conn_del(pconn); - - return (0); } diff --git a/lib/agentx.c b/lib/agentx.c index 5f865ca2b..821c573fb 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -46,7 +46,7 @@ static struct list *events = NULL; static void agentx_events_update(void); -static int agentx_timeout(struct thread *t) +static void agentx_timeout(struct thread *t) { timeout_thr = NULL; @@ -54,10 +54,9 @@ static int agentx_timeout(struct thread *t) run_alarms(); netsnmp_check_outstanding_agent_requests(); agentx_events_update(); - return 0; } -static int agentx_read(struct thread *t) +static void agentx_read(struct thread *t) { fd_set fds; int flags, new_flags = 0; @@ -72,7 +71,7 @@ static int agentx_read(struct thread *t) if (-1 == flags) { flog_err(EC_LIB_SYSTEM_CALL, "Failed to get FD settings fcntl: %s(%d)", strerror(errno), errno); - return -1; + return; } if (flags & O_NONBLOCK) @@ -101,7 +100,6 @@ static int agentx_read(struct thread *t) netsnmp_check_outstanding_agent_requests(); agentx_events_update(); - return 0; } static void agentx_events_update(void) @@ -461,14 +461,14 @@ static bool _bfd_sess_valid(const struct bfd_session_params *bsp) 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); int rv; /* Validate configuration before trying to send bogus data. */ if (!_bfd_sess_valid(bsp)) - return 0; + return; if (bsp->lastev == BSE_INSTALL) { 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 (!bsp->installed && bsp->args.command == ZEBRA_BFD_DEST_DEREGISTER) - return 0; + return; rv = zclient_bfd_command(bsglobal.zc, &bsp->args); /* Command was sent successfully. */ @@ -504,8 +504,6 @@ static int _bfd_sess_send(struct thread *t) bsp->lastev == BSE_INSTALL ? "installed" : "uninstalled"); } - - return 0; } static void _bfd_sess_remove(struct bfd_session_params *bsp) diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 898fe98aa..0f56fbac8 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -237,18 +237,16 @@ void frr_pthread_stop_all(void) */ /* 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 */ -static int fpt_finish(struct thread *thread) +static void fpt_finish(struct thread *thread) { struct frr_pthread *fpt = THREAD_ARG(thread); atomic_store_explicit(&fpt->running, false, memory_order_relaxed); - return 0; } /* stop function, called from other threads to halt this one */ diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index e572558de..db5c4c91a 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -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 *cb; @@ -67,10 +67,10 @@ static int frrzmq_read_msg(struct thread *t) size_t moresz; if (!cbp) - return 1; + return; cb = (*cbp); if (!cb || !cb->zmqsock) - return 1; + return; while (1) { 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) XFREE(MTYPE_ZEROMQ_CB, *cbp); - return 0; + return; } continue; } @@ -129,7 +129,7 @@ static int frrzmq_read_msg(struct thread *t) if (cb->write.cancelled && !cb->write.thread) XFREE(MTYPE_ZEROMQ_CB, *cbp); - return 0; + return; } /* 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, cb->fd, &cb->read.thread); - return 0; + return; out_err: flog_err(EC_LIB_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno), errno); if (cb->read.cb_error) cb->read.cb_error(cb->read.arg, cb->zmqsock); - return 1; } 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; } -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 *cb; @@ -223,10 +222,10 @@ static int frrzmq_write_msg(struct thread *t) int ret; if (!cbp) - return 1; + return; cb = (*cbp); if (!cb || !cb->zmqsock) - return 1; + return; while (1) { 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) XFREE(MTYPE_ZEROMQ_CB, *cbp); - return 0; + return; } continue; } @@ -263,14 +262,13 @@ static int frrzmq_write_msg(struct thread *t) thread_add_write(t->master, frrzmq_write_msg, cbp, cb->fd, &cb->write.thread); - return 0; + return; out_err: flog_err(EC_LIB_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno), errno); if (cb->write.cb_error) cb->write.cb_error(cb->write.arg, cb->zmqsock); - return 1; } int _frrzmq_thread_add_write(const struct xref_threadsched *xref, diff --git a/lib/libfrr.c b/lib/libfrr.c index d5e326be4..10b3aad89 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -962,7 +962,7 @@ static void frr_daemonize(void) * to read the config in after thread execution starts, so that * 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); @@ -1000,8 +1000,6 @@ static int frr_config_read_in(struct thread *t) } hook_call(frr_config_post, master); - - return 0; } void frr_config_fork(void) @@ -1097,7 +1095,7 @@ static void frr_terminal_close(int isexit) 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]; ssize_t nr; @@ -1106,7 +1104,7 @@ static int frr_daemon_ctl(struct thread *t) if (nr < 0 && (errno == EINTR || errno == EAGAIN)) goto out; if (nr <= 0) - return 0; + return; switch (buf[0]) { case 'S': /* SIGTSTP */ @@ -1131,7 +1129,6 @@ static int frr_daemon_ctl(struct thread *t) out: thread_add_read(master, frr_daemon_ctl, NULL, daemon_ctl_sock, &daemon_ctl_thread); - return 0; } void frr_detach(void) diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 70c71b18c..1e25f6a1e 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -347,7 +347,7 @@ int nb_cli_confirmed_commit_rollback(struct vty *vty) 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); @@ -357,8 +357,6 @@ static int nb_cli_confirmed_commit_timeout(struct thread *thread) nb_cli_confirmed_commit_rollback(vty); nb_cli_confirmed_commit_clean(vty); - - return 0; } static int nb_cli_commit(struct vty *vty, bool force, diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index e1c8983fc..27eaefd07 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -283,7 +283,7 @@ frr_confd_cdb_diff_iter(confd_hkeypath_t *kp, enum cdb_iter_op cdb_op, 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_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") != CONFD_OK) { 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) != CONFD_OK) { flog_err_confd("cdb_sub_abort_trans"); - return -1; + return; } } else { /* Acknowledge the notification. */ if (cdb_sync_subscription_socket(fd, CDB_DONE_PRIORITY) != CONFD_OK) { flog_err_confd("cdb_sync_subscription_socket"); - return -1; + return; } /* No configuration changes. */ if (!transaction) 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 @@ -385,10 +383,8 @@ static int frr_confd_cdb_read_cb_commit(int fd, int *subp, int reslen) /* Acknowledge the notification. */ if (cdb_sync_subscription_socket(fd, CDB_DONE_PRIORITY) != CONFD_OK) { 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) @@ -417,7 +413,7 @@ static int frr_confd_cdb_read_cb_abort(int fd, int *subp, int reslen) 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); 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) != CONFD_OK) { flog_err_confd("cdb_read_subscription_socket2"); - return -1; + return; } switch (cdb_ev) { 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: - return frr_confd_cdb_read_cb_commit(fd, subp, reslen); + frr_confd_cdb_read_cb_commit(fd, subp, reslen); + break; 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: 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; } -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); 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); 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); 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); frr_confd_dp_read(dctx, fd); - - return 0; } static int frr_confd_subscribe_state(const struct lysc_node *snode, void *arg) diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index e227d0385..34bb1e498 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -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); /* @@ -225,7 +225,7 @@ template <typename Q, typename S> class NewRpcState : RpcStateBase pthread_cond_signal(&_tag->cond); pthread_mutex_unlock(&_tag->cmux); - return 0; + return; } 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 * 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; 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) goto error; - return 0; + return; error: 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) diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 86a159e50..0158d8ea0 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -41,7 +41,7 @@ static sr_session_ctx_t *session; static sr_conn_ctx_t *connection; 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); /* 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; } -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); int fd = THREAD_FD(thread); @@ -536,12 +536,10 @@ static int frr_sr_read_cb(struct thread *thread) if (ret != SR_ERR_OK) { flog_err(EC_LIB_LIBSYSREPO, "%s: sr_fd_event_process(): %s", __func__, sr_strerror(ret)); - return -1; + return; } 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) diff --git a/lib/pullwr.c b/lib/pullwr.c index 15563d247..5e836984b 100644 --- a/lib/pullwr.c +++ b/lib/pullwr.c @@ -51,7 +51,7 @@ struct pullwr { DEFINE_MTYPE_STATIC(LIB, PULLWR_HEAD, "pull-driven write controller"); 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, void *arg, @@ -189,7 +189,7 @@ void pullwr_write(struct pullwr *pullwr, const void *data, size_t len) pullwr_bump(pullwr); } -static int pullwr_run(struct thread *t) +static void pullwr_run(struct thread *t) { struct pullwr *pullwr = THREAD_ARG(t); struct iovec iov[2]; @@ -222,7 +222,7 @@ static int pullwr_run(struct thread *t) * into idle, i.e. no calling thread_add_write() */ pullwr_resize(pullwr, 0); - return 0; + return; } niov = pullwr_iov(pullwr, iov); @@ -233,12 +233,12 @@ static int pullwr_run(struct thread *t) if (errno == EAGAIN || errno == EWOULDBLOCK) break; pullwr->err(pullwr->arg, pullwr, false); - return 0; + return; } if (nwr == 0) { pullwr->err(pullwr->arg, pullwr, true); - return 0; + return; } pullwr->total_written += nwr; @@ -258,7 +258,6 @@ static int pullwr_run(struct thread *t) */ if (!maxspun) pullwr_resize(pullwr, 0); - return 0; } void pullwr_stats(struct pullwr *pullwr, uint64_t *total_written, diff --git a/lib/resolver.c b/lib/resolver.c index 29138bbc8..93fa84bbe 100644 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -104,17 +104,15 @@ static void resolver_fd_drop_maybe(struct resolver_fd *resfd) 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); ares_process(r->channel, NULL, NULL); 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_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); 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_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); resolver_update_timeouts(r); - - return 0; } 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]); } -static int resolver_cb_literal(struct thread *t) +static void resolver_cb_literal(struct thread *t) { struct resolver_query *query = THREAD_ARG(t); void (*callback)(struct resolver_query *, const char *, int, @@ -242,7 +236,6 @@ static int resolver_cb_literal(struct thread *t) query->callback = NULL; callback(query, ARES_SUCCESS, 1, &query->literal_addr); - return 0; } void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, diff --git a/lib/sigevent.c b/lib/sigevent.c index 00bc31f51..0f20bc027 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -143,7 +143,7 @@ int frr_sigevent_process(void) #ifdef SIGEVENT_SCHEDULE_THREAD /* 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; @@ -151,7 +151,7 @@ int frr_signal_timer(struct thread *t) sigm->t = NULL; thread_add_timer(sigm->t->master, frr_signal_timer, &sigmaster, FRR_SIGNAL_TIMER_INTERVAL, &sigm->t); - return frr_sigevent_process(); + frr_sigevent_process(); } #endif /* SIGEVENT_SCHEDULE_THREAD */ diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index a273e9346..117b7d3e8 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -117,17 +117,16 @@ void spf_backoff_free(struct 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); backoff->state = SPF_BACKOFF_LONG_WAIT; backoff_debug("SPF Back-off(%s) TIMETOLEARN elapsed, move to state %s", 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); @@ -136,7 +135,6 @@ static int spf_backoff_holddown_elapsed(struct thread *thread) backoff->state = SPF_BACKOFF_QUIET; backoff_debug("SPF Back-off(%s) HOLDDOWN elapsed, move to state %s", backoff->name, spf_backoff_state2str(backoff->state)); - return 0; } long spf_backoff_schedule(struct spf_backoff *backoff) diff --git a/lib/systemd.c b/lib/systemd.c index 2238dc9f3..1c9a6f122 100644 --- a/lib/systemd.c +++ b/lib/systemd.c @@ -80,14 +80,13 @@ void systemd_send_stopping(void) 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"); assert(watchdog_msec > 0); thread_add_timer_msec(systemd_master, systemd_send_watchdog, NULL, watchdog_msec, NULL); - return 1; } void systemd_send_started(struct thread_master *m) diff --git a/lib/thread.c b/lib/thread.c index ada7a9cc8..58b8e206f 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -773,7 +773,7 @@ char *thread_timer_to_hhmmss(char *buf, int buf_size, /* Get new thread. */ 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) { struct thread *thread = thread_list_pop(&m->unuse); @@ -930,7 +930,7 @@ done: /* Add new read thread. */ void _thread_add_read_write(const struct xref_threadsched *xref, struct thread_master *m, - int (*func)(struct thread *), void *arg, int fd, + void (*func)(struct thread *), void *arg, int fd, struct thread **t_ptr) { 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, struct thread_master *m, - int (*func)(struct thread *), void *arg, + void (*func)(struct thread *), void *arg, struct timeval *time_relative, struct thread **t_ptr) { @@ -1057,7 +1057,7 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref, /* Add timer event thread. */ 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) { struct timeval trel; @@ -1073,8 +1073,8 @@ void _thread_add_timer(const struct xref_threadsched *xref, /* Add timer event thread with "millisecond" resolution */ void _thread_add_timer_msec(const struct xref_threadsched *xref, struct thread_master *m, - int (*func)(struct thread *), void *arg, long timer, - struct thread **t_ptr) + void (*func)(struct thread *), void *arg, + long timer, struct thread **t_ptr) { struct timeval trel; @@ -1088,15 +1088,16 @@ void _thread_add_timer_msec(const struct xref_threadsched *xref, /* Add timer event thread with "timeval" resolution */ void _thread_add_timer_tv(const struct xref_threadsched *xref, - struct thread_master *m, int (*func)(struct thread *), - void *arg, struct timeval *tv, struct thread **t_ptr) + struct thread_master *m, + void (*func)(struct thread *), void *arg, + struct timeval *tv, struct thread **t_ptr) { _thread_add_timer_timeval(xref, m, func, arg, tv, t_ptr); } /* Add simple event thread. */ 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) { struct thread *thread = NULL; @@ -2008,7 +2009,7 @@ void thread_call(struct thread *thread) /* Execute thread */ 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) { struct thread *thread; diff --git a/lib/thread.h b/lib/thread.h index 0c2a4ba86..a2049ae52 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -114,7 +114,7 @@ struct thread { struct thread_timer_list_item timeritem; struct thread **ref; /* external reference (if given) */ 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 */ union { int val; /* second argument of the event. */ @@ -134,7 +134,7 @@ struct thread { #endif struct cpu_thread_history { - int (*func)(struct thread *); + void (*func)(struct thread *); atomic_size_t total_cpu_warn; atomic_size_t total_wall_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, struct thread_master *master, - int (*fn)(struct thread *), void *arg, + void (*fn)(struct thread *), void *arg, int fd, struct thread **tref); extern void _thread_add_timer(const struct xref_threadsched *xref, struct thread_master *master, - int (*fn)(struct thread *), void *arg, long t, + void (*fn)(struct thread *), void *arg, long t, struct thread **tref); extern void _thread_add_timer_msec(const struct xref_threadsched *xref, struct thread_master *master, - int (*fn)(struct thread *), void *arg, + void (*fn)(struct thread *), void *arg, long t, struct thread **tref); extern void _thread_add_timer_tv(const struct xref_threadsched *xref, struct thread_master *master, - int (*fn)(struct thread *), void *arg, + void (*fn)(struct thread *), void *arg, struct timeval *tv, struct thread **tref); extern void _thread_add_event(const struct xref_threadsched *xref, struct thread_master *master, - int (*fn)(struct thread *), void *arg, int val, + void (*fn)(struct thread *), void *arg, int val, struct thread **tref); extern void _thread_execute(const struct xref_threadsched *xref, 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_async(struct thread_master *, struct thread **, @@ -1299,7 +1299,7 @@ static void vty_buffer_reset(struct vty *vty) } /* Read data via vty socket. */ -static int vty_read(struct thread *thread) +static void vty_read(struct thread *thread) { int i; int nbytes; @@ -1312,7 +1312,7 @@ static int vty_read(struct thread *thread) if (nbytes < 0) { if (ERRNO_IO_RETRY(errno)) { vty_event(VTY_READ, vty); - return 0; + return; } vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ @@ -1496,11 +1496,10 @@ static int vty_read(struct thread *thread) vty_event(VTY_WRITE, vty); vty_event(VTY_READ, vty); } - return 0; } /* Flush buffer to the vty. */ -static int vty_flush(struct thread *thread) +static void vty_flush(struct thread *thread) { int erase; buffer_status_t flushrc; @@ -1532,7 +1531,7 @@ static int vty_flush(struct thread *thread) buffer_reset(vty->lbuf); buffer_reset(vty->obuf); vty_close(vty); - return 0; + return; case BUFFER_EMPTY: if (vty->status == VTY_CLOSE) vty_close(vty); @@ -1549,8 +1548,6 @@ static int vty_flush(struct thread *thread) vty_event(VTY_WRITE, vty); break; } - - return 0; } /* Allocate new vty struct. */ @@ -1753,7 +1750,7 @@ struct vty *vty_stdio(void (*atclose)(int isexit)) } /* 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); int vty_sock; @@ -1774,7 +1771,7 @@ static int vty_accept(struct thread *thread) if (vty_sock < 0) { flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s", safe_strerror(errno)); - return -1; + return; } set_nonblocking(vty_sock); set_cloexec(vty_sock); @@ -1783,7 +1780,7 @@ static int vty_accept(struct thread *thread) close(vty_sock); zlog_info("Vty unable to convert prefix from sockunion %pSU", &su); - return -1; + return; } /* VTY's accesslist apply. */ @@ -1792,7 +1789,7 @@ static int vty_accept(struct thread *thread) && (access_list_apply(acl, &p) == FILTER_DENY)) { zlog_info("Vty connection refused from %pSU", &su); close(vty_sock); - return 0; + return; } } @@ -1803,7 +1800,7 @@ static int vty_accept(struct thread *thread) && (access_list_apply(acl, &p) == FILTER_DENY)) { zlog_info("Vty connection refused from %pSU", &su); close(vty_sock); - return 0; + return; } } @@ -1817,8 +1814,6 @@ static int vty_accept(struct thread *thread) zlog_info("Vty connection from %pSU", &su); vty_create(vty_sock, &su); - - return 0; } 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 */ -static int vtysh_accept(struct thread *thread) +static void vtysh_accept(struct thread *thread) { struct vty_serv *vtyserv = THREAD_ARG(thread); int accept_sock = vtyserv->sock; @@ -1988,7 +1983,7 @@ static int vtysh_accept(struct thread *thread) if (sock < 0) { flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s", safe_strerror(errno)); - return -1; + return; } 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", sock, safe_strerror(errno)); close(sock); - return -1; + return; } set_cloexec(sock); @@ -2013,8 +2008,6 @@ static int vtysh_accept(struct thread *thread) vtys_add_tail(vtysh_sessions, vty); vty_event(VTYSH_READ, vty); - - return 0; } static int vtysh_flush(struct vty *vty) @@ -2038,7 +2031,7 @@ static int vtysh_flush(struct vty *vty) return 0; } -static int vtysh_read(struct thread *thread) +static void vtysh_read(struct thread *thread) { int ret; int sock; @@ -2055,7 +2048,7 @@ static int vtysh_read(struct thread *thread) if (nbytes < 0) { if (ERRNO_IO_RETRY(errno)) { vty_event(VTYSH_READ, vty); - return 0; + return; } vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ @@ -2070,7 +2063,7 @@ static int vtysh_read(struct thread *thread) #ifdef VTYSH_DEBUG printf("close vtysh\n"); #endif /* VTYSH_DEBUG */ - return 0; + return; } #ifdef VTYSH_DEBUG @@ -2112,7 +2105,7 @@ static int vtysh_read(struct thread *thread) if (!vty->t_write && (vtysh_flush(vty) < 0)) /* Try to flush results; exit if a write * error occurs. */ - return 0; + return; } } } @@ -2121,16 +2114,13 @@ static int vtysh_read(struct thread *thread) vty_close(vty); else 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); vtysh_flush(vty); - return 0; } #endif /* VTYSH */ @@ -2221,7 +2211,7 @@ void vty_close(struct vty *vty) } /* 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; @@ -2236,8 +2226,6 @@ static int vty_timeout(struct thread *thread) /* Close connection. */ vty->status = VTY_CLOSE; vty_close(vty); - - return 0; } /* Read up configuration file from file_name. */ diff --git a/lib/wheel.c b/lib/wheel.c index 1a0469b25..463410bea 100644 --- a/lib/wheel.c +++ b/lib/wheel.c @@ -29,9 +29,9 @@ DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL_LIST, "Timer Wheel Slot List"); 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; 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; thread_add_timer_msec(wheel->master, wheel_timer_thread, wheel, 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; wheel = THREAD_ARG(t); thread_execute(wheel->master, wheel_timer_thread_helper, wheel, 0); - - return 0; } struct timer_wheel *wheel_init(struct thread_master *master, int period, diff --git a/lib/workqueue.c b/lib/workqueue.c index 86afe4082..92869594d 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -238,7 +238,7 @@ void work_queue_unplug(struct work_queue *wq) * will reschedule itself if required, * 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_item *item, *titem; @@ -388,6 +388,4 @@ stats: } else if (wq->spec.completion_func) wq->spec.completion_func(wq); - - return 0; } diff --git a/lib/workqueue.h b/lib/workqueue.h index b076ed0d2..39202dcda 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -177,7 +177,7 @@ extern void work_queue_unplug(struct work_queue *wq); bool work_queue_is_scheduled(struct work_queue *); /* 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); diff --git a/lib/zclient.c b/lib/zclient.c index ab2dd0989..cfccb2166 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -263,20 +263,21 @@ static enum zclient_send_status zclient_failed(struct zclient *zclient) 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); zclient->t_write = NULL; if (zclient->sock < 0) - return -1; + return; switch (buffer_flush_available(zclient->wb, zclient->sock)) { case BUFFER_ERROR: flog_err( EC_LIB_ZAPI_SOCKET, "%s: buffer_flush_available failed on zclient fd %d, closing", __func__, zclient->sock); - return zclient_failed(zclient); + zclient_failed(zclient); + return; case BUFFER_PENDING: zclient->t_write = NULL; 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)(); 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 timer or event thread. */ -static int zclient_connect(struct thread *t) +static void zclient_connect(struct thread *t) { struct zclient *zclient; @@ -764,7 +764,7 @@ static int zclient_connect(struct thread *t) if (zclient_debug) 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, @@ -3864,7 +3864,7 @@ static zclient_handler *const lib_handlers[] = { }; /* Zebra client message read function. */ -static int zclient_read(struct thread *thread) +static void zclient_read(struct thread *thread) { size_t already; uint16_t length, command; @@ -3888,11 +3888,12 @@ static int zclient_read(struct thread *thread) zlog_debug( "zclient connection closed socket [%d].", zclient->sock); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } if (nbyte != (ssize_t)(ZEBRA_HEADER_SIZE - already)) { zclient_event(ZCLIENT_READ, zclient); - return 0; + return; } already = ZEBRA_HEADER_SIZE; } @@ -3912,14 +3913,16 @@ static int zclient_read(struct thread *thread) EC_LIB_ZAPI_MISSMATCH, "%s: socket %d version mismatch, marker %d, version %d", __func__, zclient->sock, marker, version); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } if (length < ZEBRA_HEADER_SIZE) { flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: socket %d message length %u is less than %d ", __func__, zclient->sock, length, ZEBRA_HEADER_SIZE); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } /* Length check. */ @@ -3947,12 +3950,13 @@ static int zclient_read(struct thread *thread) zlog_debug( "zclient connection closed socket [%d].", zclient->sock); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } if (nbyte != (ssize_t)(length - already)) { /* Try again later. */ zclient_event(ZCLIENT_READ, zclient); - return 0; + return; } } @@ -3969,13 +3973,11 @@ static int zclient_read(struct thread *thread) if (zclient->sock < 0) /* Connection was closed during packet processing. */ - return -1; + return; /* Register read thread. */ stream_reset(zclient->ibuf); zclient_event(ZCLIENT_READ, zclient); - - return 0; } void zclient_redistribute(int command, struct zclient *zclient, afi_t afi, diff --git a/lib/zlog_5424.c b/lib/zlog_5424.c index 740d6bfba..9da7c55fc 100644 --- a/lib/zlog_5424.c +++ b/lib/zlog_5424.c @@ -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); } -static int zlog_5424_reconnect(struct thread *t) +static void zlog_5424_reconnect(struct thread *t) { struct zlog_cfg_5424 *zcf = THREAD_ARG(t); int fd = THREAD_FD(t); @@ -812,7 +812,7 @@ static int zlog_5424_reconnect(struct thread *t) /* logger is sending us something?!?! */ thread_add_read(t->master, zlog_5424_reconnect, zcf, fd, &zcf->t_reconnect); - return 0; + return; } if (ret == 0) @@ -832,7 +832,6 @@ static int zlog_5424_reconnect(struct thread *t) frr_with_mutex (&zcf->cfg_mtx) { zlog_5424_cycle(zcf, fd); } - return 0; } static int zlog_5424_unix(struct sockaddr_un *suna, int sock_type) diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 3658cb16b..cd7fb7aed 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -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); } -static int netlink_log_recv(struct thread *t) +static void netlink_log_recv(struct thread *t) { uint8_t buf[ZNL_BUFFER_SIZE]; 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, &netlink_log_thread); - - return 0; } void netlink_set_nflog_group(int nlgroup) diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c index 3823464a7..81d9bb255 100644 --- a/nhrpd/nhrp_cache.c +++ b/nhrpd/nhrp_cache.c @@ -197,16 +197,15 @@ struct nhrp_cache *nhrp_cache_get(struct interface *ifp, 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); c->t_timeout = NULL; 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); @@ -214,7 +213,6 @@ static int nhrp_cache_do_timeout(struct thread *t) if (c->cur.type != NHRP_CACHE_INVALID) nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL, NULL); - return 0; } 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); } -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); c->t_auth = NULL; nhrp_cache_authorize_binding(&c->eventid, (void *)"timeout"); - return 0; } static void nhrp_cache_newpeer_notifier(struct notifier_block *n, diff --git a/nhrpd/nhrp_event.c b/nhrpd/nhrp_event.c index 206b2cacc..e46a6d17c 100644 --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -31,7 +31,7 @@ struct event_manager { 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) { @@ -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 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) { evmgr_connection_error(evmgr); - return 0; + return; } /* Process all messages in buffer */ @@ -94,10 +94,9 @@ static int evmgr_read(struct thread *t) evmgr_recv_message(evmgr, &msg); 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); int r; @@ -109,8 +108,6 @@ static int evmgr_write(struct thread *t) } else if (r < 0) { evmgr_connection_error(evmgr); } - - return 0; } 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); } -static int evmgr_reconnect(struct thread *t) +static void evmgr_reconnect(struct thread *t) { struct event_manager *evmgr = THREAD_ARG(t); int fd; if (evmgr->fd >= 0 || !nhrp_event_socket_path) - return 0; + return; fd = sock_open_unix(nhrp_event_socket_path); if (fd < 0) { @@ -201,14 +198,12 @@ static int evmgr_reconnect(struct thread *t) zbufq_reset(&evmgr->obuf); thread_add_timer(master, evmgr_reconnect, evmgr, 10, &evmgr->t_reconnect); - return 0; + return; } zlog_info("Connected to Event Manager"); evmgr->fd = fd; thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); - - return 0; } static struct event_manager evmgr_connection; diff --git a/nhrpd/nhrp_multicast.c b/nhrpd/nhrp_multicast.c index d8372ae8a..89be13b60 100644 --- a/nhrpd/nhrp_multicast.c +++ b/nhrpd/nhrp_multicast.c @@ -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 */ 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, &netlink_mcast_log_thread); - - return 0; } static void netlink_mcast_log_register(int fd, int group) diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c index 3733910a6..63eaf1e39 100644 --- a/nhrpd/nhrp_nhs.c +++ b/nhrpd/nhrp_nhs.c @@ -17,8 +17,8 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_NHS, "NHRP next hop server"); DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries"); -static int nhrp_nhs_resolve(struct thread *t); -static int nhrp_reg_send_req(struct thread *t); +static void nhrp_nhs_resolve(struct thread *t); +static void nhrp_reg_send_req(struct thread *t); 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); } -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_cache *c; @@ -138,8 +138,6 @@ static int nhrp_reg_timeout(struct thread *t) r->timeout = 2; } 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) @@ -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_nhs *nhs = r->nhs; @@ -180,7 +178,7 @@ static int nhrp_reg_send_req(struct thread *t) &r->peer->vc->remote.nbma); thread_add_timer(master, nhrp_reg_send_req, r, 120, &r->t_register); - return 0; + return; } 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 */ if (sockunion_family(&if_ad->addr) == AF_UNSPEC) - return 0; + return; zb = zbuf_alloc(1400); 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_peer_send(r->peer, zb); zbuf_free(zb); - - return 0; } 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); } -static int nhrp_nhs_resolve(struct thread *t) +static void nhrp_nhs_resolve(struct thread *t) { struct nhrp_nhs *nhs = THREAD_ARG(t); resolver_resolve(&nhs->dns_resolve, AF_INET, VRF_DEFAULT, nhs->nbma_fqdn, nhrp_nhs_resolve_cb); - - return 0; } int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr, diff --git a/nhrpd/nhrp_packet.c b/nhrpd/nhrp_packet.c index fd77533c8..2407a8d36 100644 --- a/nhrpd/nhrp_packet.c +++ b/nhrpd/nhrp_packet.c @@ -290,7 +290,7 @@ err: return -1; } -static int nhrp_packet_recvraw(struct thread *t) +static void nhrp_packet_recvraw(struct thread *t) { int fd = THREAD_FD(t), ifindex; struct zbuf *zb; @@ -304,7 +304,7 @@ static int nhrp_packet_recvraw(struct thread *t) zb = zbuf_alloc(1500); if (!zb) - return 0; + return; len = zbuf_size(zb); addrlen = sizeof(addr); @@ -332,11 +332,10 @@ static int nhrp_packet_recvraw(struct thread *t) nhrp_peer_recv(p, zb); nhrp_peer_unref(p); - return 0; + return; err: zbuf_free(zb); - return 0; } int nhrp_packet_init(void) diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 51cae44bd..67d12cbcf 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -54,7 +54,7 @@ static void nhrp_peer_check_delete(struct 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_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); nhrp_peer_unref(p); } - - return 0; } 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_vc *vc = p->vc; @@ -267,7 +265,7 @@ static int nhrp_peer_request_timeout(struct thread *t) if (p->online) - return 0; + return; if (nifp->ipsec_fallback_profile && !p->prio && !p->fallback_requested) { @@ -279,11 +277,9 @@ static int nhrp_peer_request_timeout(struct thread *t) } else { 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_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, &p->t_fallback); } - return 0; } int nhrp_peer_check(struct nhrp_peer *p, int establish) diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 244273cd5..71b6dd870 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -22,7 +22,7 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_SHORTCUT, "NHRP shortcut"); static struct route_table *shortcut_rib[AFI_MAX]; -static int nhrp_shortcut_do_purge(struct thread *t); +static void nhrp_shortcut_do_purge(struct thread *t); static void nhrp_shortcut_delete(struct nhrp_shortcut *s); static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s); @@ -35,7 +35,7 @@ static void nhrp_shortcut_check_use(struct nhrp_shortcut *s) } } -static int nhrp_shortcut_do_expire(struct thread *t) +static void nhrp_shortcut_do_expire(struct thread *t) { struct nhrp_shortcut *s = THREAD_ARG(t); @@ -43,8 +43,6 @@ static int nhrp_shortcut_do_expire(struct thread *t) &s->t_timer); s->expiring = 1; nhrp_shortcut_check_use(s); - - return 0; } static void nhrp_shortcut_cache_notify(struct notifier_block *n, @@ -166,12 +164,11 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s) } } -static int nhrp_shortcut_do_purge(struct thread *t) +static void nhrp_shortcut_do_purge(struct thread *t) { struct nhrp_shortcut *s = THREAD_ARG(t); s->t_timer = NULL; nhrp_shortcut_delete(s); - return 0; } static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p) diff --git a/nhrpd/vici.c b/nhrpd/vici.c index 8fce82866..56adde406 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -60,7 +60,7 @@ struct vici_message_ctx { int nsections; }; -static int vici_reconnect(struct thread *t); +static void vici_reconnect(struct thread *t); static void vici_submit_request(struct vici_conn *vici, const char *name, ...); static void vici_zbuf_puts(struct zbuf *obuf, const char *str) @@ -355,7 +355,7 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg) } } -static int vici_read(struct thread *t) +static void vici_read(struct thread *t) { struct vici_conn *vici = THREAD_ARG(t); struct zbuf *ibuf = &vici->ibuf; @@ -363,7 +363,7 @@ static int vici_read(struct thread *t) if (zbuf_read(ibuf, vici->fd, (size_t)-1) < 0) { vici_connection_error(vici); - return 0; + return; } /* Process all messages in buffer */ @@ -383,10 +383,9 @@ static int vici_read(struct thread *t) } while (1); thread_add_read(master, vici_read, vici, vici->fd, &vici->t_read); - return 0; } -static int vici_write(struct thread *t) +static void vici_write(struct thread *t) { struct vici_conn *vici = THREAD_ARG(t); int r; @@ -398,8 +397,6 @@ static int vici_write(struct thread *t) } else if (r < 0) { vici_connection_error(vici); } - - return 0; } static void vici_submit(struct vici_conn *vici, struct zbuf *obuf) @@ -501,14 +498,14 @@ static char *vici_get_charon_filepath(void) return buff; } -static int vici_reconnect(struct thread *t) +static void vici_reconnect(struct thread *t) { struct vici_conn *vici = THREAD_ARG(t); int fd; char *file_path; if (vici->fd >= 0) - return 0; + return; fd = sock_open_unix(VICI_SOCKET); if (fd < 0) { @@ -522,7 +519,7 @@ static int vici_reconnect(struct thread *t) strerror(errno)); thread_add_timer(master, vici_reconnect, vici, 2, &vici->t_reconnect); - return 0; + return; } debugf(NHRP_DEBUG_COMMON, "VICI: Connected"); @@ -537,8 +534,6 @@ static int vici_reconnect(struct thread *t) vici_register_event(vici, "child-state-destroying"); vici_register_event(vici, "list-sa"); vici_submit_request(vici, "list-sas", VICI_END); - - return 0; } static struct vici_conn vici_connection; diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 1c0d948cc..40afd716c 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -197,7 +197,7 @@ struct ospf6_lsa *ospf6_as_external_lsa_originate(struct ospf6_route *route, return lsa; } -int ospf6_orig_as_external_lsa(struct thread *thread) +void ospf6_orig_as_external_lsa(struct thread *thread) { struct ospf6_interface *oi; struct ospf6_lsa *lsa; @@ -206,9 +206,9 @@ int ospf6_orig_as_external_lsa(struct thread *thread) oi = (struct ospf6_interface *)THREAD_ARG(thread); if (oi->state == OSPF6_INTERFACE_DOWN) - return 0; + return; if (IS_AREA_NSSA(oi->area) || IS_AREA_STUB(oi->area)) - return 0; + return; type = htons(OSPF6_LSTYPE_AS_EXTERNAL); adv_router = oi->area->ospf6->router_id; @@ -222,8 +222,6 @@ int ospf6_orig_as_external_lsa(struct thread *thread) ospf6_flood_interface(NULL, lsa, oi); } - - return 0; } static route_tag_t ospf6_as_external_lsa_get_tag(struct ospf6_lsa *lsa) @@ -1084,7 +1082,7 @@ static void ospf6_asbr_routemap_unset(struct ospf6_redist *red) ROUTEMAP(red) = NULL; } -static int ospf6_asbr_routemap_update_timer(struct thread *thread) +static void ospf6_asbr_routemap_update_timer(struct thread *thread) { struct ospf6 *ospf6 = THREAD_ARG(thread); struct ospf6_redist *red; @@ -1116,8 +1114,6 @@ static int ospf6_asbr_routemap_update_timer(struct thread *thread) UNSET_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED); } - - return 0; } void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, @@ -3331,7 +3327,7 @@ ospf6_handle_external_aggr_add(struct ospf6 *ospf6) } } -static int ospf6_asbr_summary_process(struct thread *thread) +static void ospf6_asbr_summary_process(struct thread *thread) { struct ospf6 *ospf6 = THREAD_ARG(thread); int operation = 0; @@ -3354,8 +3350,6 @@ static int ospf6_asbr_summary_process(struct thread *thread) default: break; } - - return OSPF6_SUCCESS; } static void diff --git a/ospf6d/ospf6_gr.c b/ospf6d/ospf6_gr.c index c3e6f62f0..d618ed86e 100644 --- a/ospf6d/ospf6_gr.c +++ b/ospf6d/ospf6_gr.c @@ -455,14 +455,12 @@ static bool ospf6_gr_check_adjs(struct ospf6 *ospf6) } /* Handling of grace period expiry. */ -static int ospf6_gr_grace_period_expired(struct thread *thread) +static void ospf6_gr_grace_period_expired(struct thread *thread) { struct ospf6 *ospf6 = THREAD_ARG(thread); ospf6->gr_info.t_grace_period = NULL; ospf6_gr_restart_exit(ospf6, "grace period has expired"); - - return 0; } /* diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index 84ee35a3e..5f9b7f029 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -208,12 +208,11 @@ static int ospf6_extract_grace_lsa_fields(struct ospf6_lsa *lsa, * Returns: * Nothing */ -static int ospf6_handle_grace_timer_expiry(struct thread *thread) +static void ospf6_handle_grace_timer_expiry(struct thread *thread) { struct ospf6_neighbor *nbr = THREAD_ARG(thread); ospf6_gr_helper_exit(nbr, OSPF6_GR_HELPER_GRACE_TIMEOUT); - return OSPF6_SUCCESS; } /* diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index f39d208bb..b9ee3c340 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -731,7 +731,7 @@ static bool ifmaddr_check(ifindex_t ifindex, struct in6_addr *addr) #endif /* __FreeBSD__ */ /* Interface State Machine */ -int interface_up(struct thread *thread) +void interface_up(struct thread *thread) { struct ospf6_interface *oi; struct ospf6 *ospf6; @@ -752,7 +752,7 @@ int interface_up(struct thread *thread) if (!if_is_operative(oi->interface)) { zlog_warn("Interface %s is down, can't execute [InterfaceUp]", oi->interface->name); - return 0; + return; } /* check interface has a link-local address */ @@ -761,7 +761,7 @@ int interface_up(struct thread *thread) zlog_warn( "Interface %s has no link local address, can't execute [InterfaceUp]", oi->interface->name); - return 0; + return; } /* Recompute cost */ @@ -772,7 +772,7 @@ int interface_up(struct thread *thread) if (IS_OSPF6_DEBUG_INTERFACE) zlog_debug("Interface %s already enabled", oi->interface->name); - return 0; + return; } /* If no area assigned, return */ @@ -780,7 +780,7 @@ int interface_up(struct thread *thread) zlog_warn( "%s: Not scheduling Hello for %s as there is no area assigned yet", __func__, oi->interface->name); - return 0; + return; } #ifdef __FreeBSD__ @@ -799,7 +799,7 @@ int interface_up(struct thread *thread) thread_add_timer(master, interface_up, oi, OSPF6_INTERFACE_SSO_RETRY_INT, &oi->thread_sso); - return 0; + return; } #endif /* __FreeBSD__ */ @@ -817,7 +817,7 @@ int interface_up(struct thread *thread) OSPF6_INTERFACE_SSO_RETRY_INT, &oi->thread_sso); } - return 0; + return; } oi->sso_try_cnt = 0; /* Reset on success */ @@ -843,11 +843,9 @@ int interface_up(struct thread *thread) thread_add_timer(master, wait_timer, oi, oi->dead_interval, &oi->thread_wait_timer); } - - return 0; } -int wait_timer(struct thread *thread) +void wait_timer(struct thread *thread) { struct ospf6_interface *oi; @@ -860,11 +858,9 @@ int wait_timer(struct thread *thread) if (oi->state == OSPF6_INTERFACE_WAITING) ospf6_interface_state_change(dr_election(oi), oi); - - return 0; } -int backup_seen(struct thread *thread) +void backup_seen(struct thread *thread) { struct ospf6_interface *oi; @@ -877,11 +873,9 @@ int backup_seen(struct thread *thread) if (oi->state == OSPF6_INTERFACE_WAITING) ospf6_interface_state_change(dr_election(oi), oi); - - return 0; } -int neighbor_change(struct thread *thread) +void neighbor_change(struct thread *thread) { struct ospf6_interface *oi; @@ -896,11 +890,9 @@ int neighbor_change(struct thread *thread) || oi->state == OSPF6_INTERFACE_BDR || oi->state == OSPF6_INTERFACE_DR) ospf6_interface_state_change(dr_election(oi), oi); - - return 0; } -int interface_down(struct thread *thread) +void interface_down(struct thread *thread) { struct ospf6_interface *oi; struct listnode *node, *nnode; @@ -942,7 +934,7 @@ int interface_down(struct thread *thread) oi->bdrouter = oi->prev_bdrouter = htonl(0); if (oi->area == NULL) - return 0; + return; ospf6 = oi->area->ospf6; /* Leave AllSPFRouters */ @@ -960,8 +952,6 @@ int interface_down(struct thread *thread) } ospf6_interface_state_change(OSPF6_INTERFACE_DOWN, oi); - - return 0; } diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index 59e4888a5..9a57a7f4d 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -226,11 +226,11 @@ extern struct in6_addr * ospf6_interface_get_global_address(struct interface *ifp); /* interface event */ -extern int interface_up(struct thread *thread); -extern int interface_down(struct thread *thread); -extern int wait_timer(struct thread *thread); -extern int backup_seen(struct thread *thread); -extern int neighbor_change(struct thread *thread); +extern void interface_up(struct thread *thread); +extern void interface_down(struct thread *thread); +extern void wait_timer(struct thread *thread); +extern void backup_seen(struct thread *thread); +extern void neighbor_change(struct thread *thread); extern void ospf6_interface_init(void); extern void ospf6_interface_clear(struct interface *ifp); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index da5cad053..f3fd9dab6 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -224,7 +224,7 @@ int ospf6_router_is_stub_router(struct ospf6_lsa *lsa) return OSPF6_NOT_STUB_ROUTER; } -int ospf6_router_lsa_originate(struct thread *thread) +void ospf6_router_lsa_originate(struct thread *thread) { struct ospf6_area *oa; @@ -249,7 +249,7 @@ int ospf6_router_lsa_originate(struct thread *thread) if (IS_DEBUG_OSPF6_GR) zlog_debug( "Graceful Restart in progress, don't originate LSA"); - return 0; + return; } if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER)) @@ -294,7 +294,7 @@ int ospf6_router_lsa_originate(struct thread *thread) + sizeof(struct ospf6_router_lsa)) { zlog_warn( "Size limit setting for Router-LSA too short"); - return 0; + return; } /* Fill LSA Header */ @@ -433,8 +433,6 @@ int ospf6_router_lsa_originate(struct thread *thread) if (count && !link_state_id) ospf6_spf_schedule(oa->ospf6, OSPF6_SPF_FLAGS_ROUTER_LSA_ORIGINATED); - - return 0; } /*******************************/ @@ -511,7 +509,7 @@ static int ospf6_network_lsa_show(struct vty *vty, struct ospf6_lsa *lsa, return 0; } -int ospf6_network_lsa_originate(struct thread *thread) +void ospf6_network_lsa_originate(struct thread *thread) { struct ospf6_interface *oi; @@ -538,7 +536,7 @@ int ospf6_network_lsa_originate(struct thread *thread) if (IS_DEBUG_OSPF6_GR) zlog_debug( "Graceful Restart in progress, don't originate LSA"); - return 0; + return; } old = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_NETWORK), @@ -558,7 +556,7 @@ int ospf6_network_lsa_originate(struct thread *thread) oi->area->ospf6, OSPF6_SPF_FLAGS_NETWORK_LSA_ORIGINATED); } - return 0; + return; } if (IS_OSPF6_DEBUG_ORIGINATE(NETWORK)) @@ -577,7 +575,7 @@ int ospf6_network_lsa_originate(struct thread *thread) zlog_debug("Interface stub, ignore"); if (old) ospf6_lsa_purge(old); - return 0; + return; } /* prepare buffer */ @@ -635,8 +633,6 @@ int ospf6_network_lsa_originate(struct thread *thread) /* Originate */ ospf6_lsa_originate_area(lsa, oi->area); - - return 0; } @@ -765,7 +761,7 @@ static int ospf6_link_lsa_show(struct vty *vty, struct ospf6_lsa *lsa, return 0; } -int ospf6_link_lsa_originate(struct thread *thread) +void ospf6_link_lsa_originate(struct thread *thread) { struct ospf6_interface *oi; @@ -785,7 +781,7 @@ int ospf6_link_lsa_originate(struct thread *thread) if (IS_DEBUG_OSPF6_GR) zlog_debug( "Graceful Restart in progress, don't originate LSA"); - return 0; + return; } @@ -797,7 +793,7 @@ int ospf6_link_lsa_originate(struct thread *thread) if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) { if (old) ospf6_lsa_purge(old); - return 0; + return; } if (IS_OSPF6_DEBUG_ORIGINATE(LINK)) @@ -812,7 +808,7 @@ int ospf6_link_lsa_originate(struct thread *thread) oi->interface->name); if (old) ospf6_lsa_purge(old); - return 0; + return; } /* prepare buffer */ @@ -860,8 +856,6 @@ int ospf6_link_lsa_originate(struct thread *thread) /* Originate */ ospf6_lsa_originate_interface(lsa, oi); - - return 0; } @@ -1003,7 +997,7 @@ static int ospf6_intra_prefix_lsa_show(struct vty *vty, struct ospf6_lsa *lsa, return 0; } -int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) +void ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) { struct ospf6_area *oa; @@ -1028,7 +1022,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) if (IS_DEBUG_OSPF6_GR) zlog_debug( "Graceful Restart in progress, don't originate LSA"); - return 0; + return; } /* find previous LSA */ @@ -1051,7 +1045,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) oa->lsdb); } } - return 0; + return; } if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) @@ -1127,7 +1121,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) } } ospf6_route_table_delete(route_advertise); - return 0; + return; } /* Neighbor change to FULL, if INTRA-AREA-PREFIX LSA @@ -1212,7 +1206,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) zlog_debug( "Quit to Advertise Intra-Prefix: no route to advertise"); - return 0; + return; } intra_prefix_lsa->prefix_num = htons(prefix_num); @@ -1235,12 +1229,10 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) /* Originate */ ospf6_lsa_originate_area(lsa, oa); - - return 0; } -int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) +void ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) { struct ospf6_interface *oi; @@ -1268,7 +1260,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) if (IS_DEBUG_OSPF6_GR) zlog_debug( "Graceful Restart in progress, don't originate LSA"); - return 0; + return; } /* find previous LSA */ @@ -1279,7 +1271,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) { if (old) ospf6_lsa_purge(old); - return 0; + return; } if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) @@ -1304,7 +1296,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) zlog_debug(" Interface is not DR"); if (old) ospf6_lsa_purge(old); - return 0; + return; } full_count = 0; @@ -1317,7 +1309,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) zlog_debug(" Interface is stub"); if (old) ospf6_lsa_purge(old); - return 0; + return; } /* connected prefix to advertise */ @@ -1406,7 +1398,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) zlog_debug( "Quit to Advertise Intra-Prefix: no route to advertise"); - return 0; + return; } intra_prefix_lsa->prefix_num = htons(prefix_num); @@ -1429,8 +1421,6 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) /* Originate */ ospf6_lsa_originate_area(lsa, oi->area); - - return 0; } static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route, diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index f15bf0b9b..73cc77a56 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -235,14 +235,14 @@ extern char *ospf6_network_lsdesc_lookup(uint32_t router_id, struct ospf6_lsa *lsa); extern int ospf6_router_is_stub_router(struct ospf6_lsa *lsa); -extern int ospf6_router_lsa_originate(struct thread *thread); -extern int ospf6_network_lsa_originate(struct thread *thread); -extern int ospf6_link_lsa_originate(struct thread *thread); -extern int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread); -extern int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread); +extern void ospf6_router_lsa_originate(struct thread *thread); +extern void ospf6_network_lsa_originate(struct thread *thread); +extern void ospf6_link_lsa_originate(struct thread *thread); +extern void ospf6_intra_prefix_lsa_originate_transit(struct thread *thread); +extern void ospf6_intra_prefix_lsa_originate_stub(struct thread *thread); extern void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa); extern void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa); -extern int ospf6_orig_as_external_lsa(struct thread *thread); +extern void ospf6_orig_as_external_lsa(struct thread *thread); extern void ospf6_intra_route_calculation(struct ospf6_area *oa); extern void ospf6_intra_brouter_calculation(struct ospf6_area *oa); extern void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 99d0de39c..740a94ba8 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -829,7 +829,7 @@ struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa) /* ospf6 lsa expiry */ -int ospf6_lsa_expire(struct thread *thread) +void ospf6_lsa_expire(struct thread *thread) { struct ospf6_lsa *lsa; struct ospf6 *ospf6; @@ -848,7 +848,7 @@ int ospf6_lsa_expire(struct thread *thread) } if (CHECK_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY)) - return 0; /* dbexchange will do something ... */ + return; /* dbexchange will do something ... */ ospf6 = ospf6_get_by_lsdb(lsa); assert(ospf6); @@ -860,11 +860,9 @@ int ospf6_lsa_expire(struct thread *thread) /* schedule maxage remover */ ospf6_maxage_remove(ospf6); - - return 0; } -int ospf6_lsa_refresh(struct thread *thread) +void ospf6_lsa_refresh(struct thread *thread) { struct ospf6_lsa *old, *self, *new; struct ospf6_lsdb *lsdb_self; @@ -882,7 +880,7 @@ int ospf6_lsa_refresh(struct thread *thread) zlog_debug("Refresh: could not find self LSA, flush %s", old->name); ospf6_lsa_premature_aging(old); - return 0; + return; } /* Reset age, increment LS sequence number. */ @@ -907,8 +905,6 @@ int ospf6_lsa_refresh(struct thread *thread) ospf6_install_lsa(new); ospf6_flood(NULL, new); - - return 0; } void ospf6_flush_self_originated_lsas_now(struct ospf6 *ospf6) diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index aa1150afc..fea9aba27 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -256,8 +256,8 @@ extern struct ospf6_lsa *ospf6_lsa_copy(struct ospf6_lsa *lsa); extern struct ospf6_lsa *ospf6_lsa_lock(struct ospf6_lsa *lsa); extern struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa); -extern int ospf6_lsa_expire(struct thread *thread); -extern int ospf6_lsa_refresh(struct thread *thread); +extern void ospf6_lsa_expire(struct thread *thread); +extern void ospf6_lsa_refresh(struct thread *thread); extern unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *lsah); extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *lsah); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 7ebfdd26e..6645f83b0 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1905,7 +1905,7 @@ static int ospf6_read_helper(int sockfd, struct ospf6 *ospf6) return OSPF6_READ_CONTINUE; } -int ospf6_receive(struct thread *thread) +void ospf6_receive(struct thread *thread) { int sockfd; struct ospf6 *ospf6; @@ -1922,13 +1922,11 @@ int ospf6_receive(struct thread *thread) count++; switch (ospf6_read_helper(sockfd, ospf6)) { case OSPF6_READ_ERROR: - return 0; + return; case OSPF6_READ_CONTINUE: break; } } - - return 0; } static void ospf6_fill_hdr_checksum(struct ospf6_interface *oi, @@ -2079,7 +2077,7 @@ static uint16_t ospf6_make_hello(struct ospf6_interface *oi, struct stream *s) return length; } -static int ospf6_write(struct thread *thread) +static void ospf6_write(struct thread *thread) { struct ospf6 *ospf6 = THREAD_ARG(thread); struct ospf6_interface *oi; @@ -2096,7 +2094,7 @@ static int ospf6_write(struct thread *thread) if (ospf6->fd < 0) { zlog_warn("ospf6_write failed to send, fd %d", ospf6->fd); - return -1; + return; } node = listhead(ospf6->oi_write_q); @@ -2235,11 +2233,9 @@ static int ospf6_write(struct thread *thread) if (!list_isempty(ospf6->oi_write_q)) thread_add_write(master, ospf6_write, ospf6, ospf6->fd, &ospf6->t_write); - - return 0; } -int ospf6_hello_send(struct thread *thread) +void ospf6_hello_send(struct thread *thread) { struct ospf6_interface *oi; struct ospf6_packet *op; @@ -2252,7 +2248,7 @@ int ospf6_hello_send(struct thread *thread) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND_HDR)) zlog_debug("Unable to send Hello on down interface %s", oi->interface->name); - return 0; + return; } op = ospf6_packet_new(oi->ifmtu); @@ -2264,7 +2260,7 @@ int ospf6_hello_send(struct thread *thread) if (length == OSPF6_HEADER_SIZE) { /* Hello overshooting MTU */ ospf6_packet_free(op); - return 0; + return; } /* Fill OSPF header. */ @@ -2287,8 +2283,6 @@ int ospf6_hello_send(struct thread *thread) &oi->thread_send_hello); OSPF6_MESSAGE_WRITE_ON(oi); - - return 0; } static uint16_t ospf6_make_dbdesc(struct ospf6_neighbor *on, struct stream *s) @@ -2339,7 +2333,7 @@ static uint16_t ospf6_make_dbdesc(struct ospf6_neighbor *on, struct stream *s) return length; } -int ospf6_dbdesc_send(struct thread *thread) +void ospf6_dbdesc_send(struct thread *thread) { struct ospf6_neighbor *on; uint16_t length = OSPF6_HEADER_SIZE; @@ -2353,7 +2347,7 @@ int ospf6_dbdesc_send(struct thread *thread) zlog_debug( "Quit to send DbDesc to neighbor %s state %s", on->name, ospf6_neighbor_state_str[on->state]); - return 0; + return; } /* set next thread if master */ @@ -2381,11 +2375,9 @@ int ospf6_dbdesc_send(struct thread *thread) ospf6_packet_add(on->ospf6_if, op); OSPF6_MESSAGE_WRITE_ON(on->ospf6_if); - - return 0; } -int ospf6_dbdesc_send_newone(struct thread *thread) +void ospf6_dbdesc_send_newone(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; @@ -2431,7 +2423,6 @@ int ospf6_dbdesc_send_newone(struct thread *thread) &on->thread_exchange_done); thread_execute(master, ospf6_dbdesc_send, on, 0); - return 0; } static uint16_t ospf6_make_lsreq(struct ospf6_neighbor *on, struct stream *s) @@ -2508,7 +2499,7 @@ static uint16_t ospf6_make_lsack_neighbor(struct ospf6_neighbor *on, return length; } -int ospf6_lsreq_send(struct thread *thread) +void ospf6_lsreq_send(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_packet *op; @@ -2524,13 +2515,13 @@ int ospf6_lsreq_send(struct thread *thread) zlog_debug("Quit to send LSReq to neighbor %s state %s", on->name, ospf6_neighbor_state_str[on->state]); - return 0; + return; } /* schedule loading_done if request list is empty */ if (on->request_list->count == 0) { thread_add_event(master, loading_done, on, 0, NULL); - return 0; + return; } op = ospf6_packet_new(on->ospf6_if->ifmtu); @@ -2541,7 +2532,7 @@ int ospf6_lsreq_send(struct thread *thread) if (length == OSPF6_HEADER_SIZE) { /* Hello overshooting MTU */ ospf6_packet_free(op); - return 0; + return; } /* Fill OSPF header. */ @@ -2566,8 +2557,6 @@ int ospf6_lsreq_send(struct thread *thread) on->ospf6_if->rxmt_interval, &on->thread_send_lsreq); } - - return 0; } static void ospf6_send_lsupdate(struct ospf6_neighbor *on, @@ -2689,7 +2678,7 @@ static uint16_t ospf6_make_ls_retrans_list(struct ospf6_neighbor *on, return length; } -int ospf6_lsupdate_send_neighbor(struct thread *thread) +void ospf6_lsupdate_send_neighbor(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_packet *op; @@ -2707,7 +2696,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) SEND_HDR)) zlog_debug("Quit to send (neighbor state %s)", ospf6_neighbor_state_str[on->state]); - return 0; + return; } /* first do lsupdate_list */ @@ -2755,7 +2744,6 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) on->ospf6_if->rxmt_interval, &on->thread_send_lsupdate); } - return 0; } int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on, @@ -2826,7 +2814,7 @@ static uint16_t ospf6_make_lsupdate_interface(struct ospf6_interface *oi, return length; } -int ospf6_lsupdate_send_interface(struct thread *thread) +void ospf6_lsupdate_send_interface(struct thread *thread) { struct ospf6_interface *oi; struct ospf6_packet *op; @@ -2843,12 +2831,12 @@ int ospf6_lsupdate_send_interface(struct thread *thread) "Quit to send LSUpdate to interface %s state %s", oi->interface->name, ospf6_interface_state_str[oi->state]); - return 0; + return; } /* if we have nothing to send, return */ if (oi->lsupdate_list->count == 0) - return 0; + return; op = ospf6_packet_new(oi->ifmtu); ospf6_make_header(OSPF6_MESSAGE_TYPE_LSUPDATE, oi, op->s); @@ -2866,11 +2854,9 @@ int ospf6_lsupdate_send_interface(struct thread *thread) thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0, &oi->thread_send_lsupdate); } - - return 0; } -int ospf6_lsack_send_neighbor(struct thread *thread) +void ospf6_lsack_send_neighbor(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_packet *op; @@ -2884,12 +2870,12 @@ int ospf6_lsack_send_neighbor(struct thread *thread) zlog_debug("Quit to send LSAck to neighbor %s state %s", on->name, ospf6_neighbor_state_str[on->state]); - return 0; + return; } /* if we have nothing to send, return */ if (on->lsack_list->count == 0) - return 0; + return; op = ospf6_packet_new(on->ospf6_if->ifmtu); ospf6_make_header(OSPF6_MESSAGE_TYPE_LSACK, on->ospf6_if, op->s); @@ -2898,7 +2884,7 @@ int ospf6_lsack_send_neighbor(struct thread *thread) if (length == OSPF6_HEADER_SIZE) { ospf6_packet_free(op); - return 0; + return; } /* Fill OSPF header. */ @@ -2914,8 +2900,6 @@ int ospf6_lsack_send_neighbor(struct thread *thread) if (on->lsack_list->count > 0) thread_add_event(master, ospf6_lsack_send_neighbor, on, 0, &on->thread_send_lsack); - - return 0; } static uint16_t ospf6_make_lsack_interface(struct ospf6_interface *oi, @@ -2949,7 +2933,7 @@ static uint16_t ospf6_make_lsack_interface(struct ospf6_interface *oi, return length; } -int ospf6_lsack_send_interface(struct thread *thread) +void ospf6_lsack_send_interface(struct thread *thread) { struct ospf6_interface *oi; struct ospf6_packet *op; @@ -2964,12 +2948,12 @@ int ospf6_lsack_send_interface(struct thread *thread) "Quit to send LSAck to interface %s state %s", oi->interface->name, ospf6_interface_state_str[oi->state]); - return 0; + return; } /* if we have nothing to send, return */ if (oi->lsack_list->count == 0) - return 0; + return; op = ospf6_packet_new(oi->ifmtu); ospf6_make_header(OSPF6_MESSAGE_TYPE_LSACK, oi, op->s); @@ -2978,7 +2962,7 @@ int ospf6_lsack_send_interface(struct thread *thread) if (length == OSPF6_HEADER_SIZE) { ospf6_packet_free(op); - return 0; + return; } /* Fill OSPF header. */ ospf6_fill_header(oi, op->s, length); @@ -2999,8 +2983,6 @@ int ospf6_lsack_send_interface(struct thread *thread) if (oi->lsack_list->count > 0) thread_add_event(master, ospf6_lsack_send_interface, oi, 0, &oi->thread_send_lsack); - - return 0; } /* Commands */ diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index 437dd5685..daab98640 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -173,16 +173,16 @@ extern void ospf6_fifo_free(struct ospf6_fifo *fifo); extern int ospf6_iobuf_size(unsigned int size); extern void ospf6_message_terminate(void); -extern int ospf6_receive(struct thread *thread); - -extern int ospf6_hello_send(struct thread *thread); -extern int ospf6_dbdesc_send(struct thread *thread); -extern int ospf6_dbdesc_send_newone(struct thread *thread); -extern int ospf6_lsreq_send(struct thread *thread); -extern int ospf6_lsupdate_send_interface(struct thread *thread); -extern int ospf6_lsupdate_send_neighbor(struct thread *thread); -extern int ospf6_lsack_send_interface(struct thread *thread); -extern int ospf6_lsack_send_neighbor(struct thread *thread); +extern void ospf6_receive(struct thread *thread); + +extern void ospf6_hello_send(struct thread *thread); +extern void ospf6_dbdesc_send(struct thread *thread); +extern void ospf6_dbdesc_send_newone(struct thread *thread); +extern void ospf6_lsreq_send(struct thread *thread); +extern void ospf6_lsupdate_send_interface(struct thread *thread); +extern void ospf6_lsupdate_send_neighbor(struct thread *thread); +extern void ospf6_lsack_send_interface(struct thread *thread); +extern void ospf6_lsack_send_neighbor(struct thread *thread); extern int config_write_ospf6_debug_message(struct vty *); extern void install_element_ospf6_debug_message(void); diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 5d14bfc98..8dca0913d 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -272,7 +272,7 @@ static int need_adjacency(struct ospf6_neighbor *on) return 0; } -int hello_received(struct thread *thread) +void hello_received(struct thread *thread) { struct ospf6_neighbor *on; @@ -290,11 +290,9 @@ int hello_received(struct thread *thread) if (on->state <= OSPF6_NEIGHBOR_DOWN) ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on, OSPF6_NEIGHBOR_EVENT_HELLO_RCVD); - - return 0; } -int twoway_received(struct thread *thread) +void twoway_received(struct thread *thread) { struct ospf6_neighbor *on; @@ -302,7 +300,7 @@ int twoway_received(struct thread *thread) assert(on); if (on->state > OSPF6_NEIGHBOR_INIT) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *2Way-Received*", on->name); @@ -312,7 +310,7 @@ int twoway_received(struct thread *thread) if (!need_adjacency(on)) { ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on, OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD); - return 0; + return; } ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on, @@ -324,11 +322,9 @@ int twoway_received(struct thread *thread) THREAD_OFF(on->thread_send_dbdesc); thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); - - return 0; } -int negotiation_done(struct thread *thread) +void negotiation_done(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; @@ -337,7 +333,7 @@ int negotiation_done(struct thread *thread) assert(on); if (on->state != OSPF6_NEIGHBOR_EXSTART) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *NegotiationDone*", on->name); @@ -380,21 +376,17 @@ int negotiation_done(struct thread *thread) UNSET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXCHANGE, on, OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE); - - return 0; } -static int ospf6_neighbor_last_dbdesc_release(struct thread *thread) +static void ospf6_neighbor_last_dbdesc_release(struct thread *thread) { struct ospf6_neighbor *on = THREAD_ARG(thread); assert(on); memset(&on->dbdesc_last, 0, sizeof(struct ospf6_dbdesc)); - - return 0; } -int exchange_done(struct thread *thread) +void exchange_done(struct thread *thread) { struct ospf6_neighbor *on; @@ -402,7 +394,7 @@ int exchange_done(struct thread *thread) assert(on); if (on->state != OSPF6_NEIGHBOR_EXCHANGE) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *ExchangeDone*", on->name); @@ -428,8 +420,6 @@ int exchange_done(struct thread *thread) thread_add_event(master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq); } - - return 0; } /* Check loading state. */ @@ -453,7 +443,7 @@ void ospf6_check_nbr_loading(struct ospf6_neighbor *on) } } -int loading_done(struct thread *thread) +void loading_done(struct thread *thread) { struct ospf6_neighbor *on; @@ -461,7 +451,7 @@ int loading_done(struct thread *thread) assert(on); if (on->state != OSPF6_NEIGHBOR_LOADING) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *LoadingDone*", on->name); @@ -470,11 +460,9 @@ int loading_done(struct thread *thread) ospf6_neighbor_state_change(OSPF6_NEIGHBOR_FULL, on, OSPF6_NEIGHBOR_EVENT_LOADING_DONE); - - return 0; } -int adj_ok(struct thread *thread) +void adj_ok(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; @@ -507,11 +495,9 @@ int adj_ok(struct thread *thread) ospf6_lsdb_remove(lsa, on->retrans_list); } } - - return 0; } -int seqnumber_mismatch(struct thread *thread) +void seqnumber_mismatch(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; @@ -520,7 +506,7 @@ int seqnumber_mismatch(struct thread *thread) assert(on); if (on->state < OSPF6_NEIGHBOR_EXCHANGE) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *SeqNumberMismatch*", on->name); @@ -544,11 +530,9 @@ int seqnumber_mismatch(struct thread *thread) on->thread_send_dbdesc = NULL; thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); - - return 0; } -int bad_lsreq(struct thread *thread) +void bad_lsreq(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; @@ -557,7 +541,7 @@ int bad_lsreq(struct thread *thread) assert(on); if (on->state < OSPF6_NEIGHBOR_EXCHANGE) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *BadLSReq*", on->name); @@ -582,10 +566,9 @@ int bad_lsreq(struct thread *thread) thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); - return 0; } -int oneway_received(struct thread *thread) +void oneway_received(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; @@ -594,7 +577,7 @@ int oneway_received(struct thread *thread) assert(on); if (on->state < OSPF6_NEIGHBOR_TWOWAY) - return 0; + return; if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *1Way-Received*", on->name); @@ -616,11 +599,9 @@ int oneway_received(struct thread *thread) THREAD_OFF(on->thread_send_lsack); THREAD_OFF(on->thread_exchange_done); THREAD_OFF(on->thread_adj_ok); - - return 0; } -int inactivity_timer(struct thread *thread) +void inactivity_timer(struct thread *thread) { struct ospf6_neighbor *on; @@ -656,8 +637,6 @@ int inactivity_timer(struct thread *thread) on->ospf6_if->dead_interval, &on->inactivity_timer); } - - return 0; } diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 2dd640099..ea4d42415 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -205,16 +205,16 @@ struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, void ospf6_neighbor_delete(struct ospf6_neighbor *on); /* Neighbor event */ -extern int hello_received(struct thread *thread); -extern int twoway_received(struct thread *thread); -extern int negotiation_done(struct thread *thread); -extern int exchange_done(struct thread *thread); -extern int loading_done(struct thread *thread); -extern int adj_ok(struct thread *thread); -extern int seqnumber_mismatch(struct thread *thread); -extern int bad_lsreq(struct thread *thread); -extern int oneway_received(struct thread *thread); -extern int inactivity_timer(struct thread *thread); +extern void hello_received(struct thread *thread); +extern void twoway_received(struct thread *thread); +extern void negotiation_done(struct thread *thread); +extern void exchange_done(struct thread *thread); +extern void loading_done(struct thread *thread); +extern void adj_ok(struct thread *thread); +extern void seqnumber_mismatch(struct thread *thread); +extern void bad_lsreq(struct thread *thread); +extern void oneway_received(struct thread *thread); +extern void inactivity_timer(struct thread *thread); extern void ospf6_check_nbr_loading(struct ospf6_neighbor *on); extern void ospf6_neighbor_init(void); diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 042907d0f..1220c3278 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -970,7 +970,7 @@ int ospf6_redistribute_check(struct ospf6 *ospf6, struct ospf6_route *route, } /* This function performs ABR related processing */ -static int ospf6_abr_task_timer(struct thread *thread) +static void ospf6_abr_task_timer(struct thread *thread) { struct ospf6 *ospf6 = THREAD_ARG(thread); @@ -982,8 +982,6 @@ static int ospf6_abr_task_timer(struct thread *thread) ospf6_abr_task(ospf6); /* if nssa-abr, then scan Type-7 LSDB */ ospf6_abr_nssa_task(ospf6); - - return 0; } void ospf6_schedule_abr_task(struct ospf6 *ospf6) diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index f9c47cbce..2e8e9f2cd 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -605,7 +605,7 @@ static void ospf6_spf_log_database(struct ospf6_area *oa) zlog_debug("%s", buffer); } -static int ospf6_spf_calculation_thread(struct thread *t) +static void ospf6_spf_calculation_thread(struct thread *t) { struct ospf6_area *oa; struct ospf6 *ospf6; @@ -681,7 +681,6 @@ static int ospf6_spf_calculation_thread(struct thread *t) ospf6->last_spf_reason = ospf6->spf_reason; ospf6_reset_spf_reason(ospf6); - return 0; } /* Add schedule for SPF calculation. To avoid frequenst SPF calc, we @@ -1245,7 +1244,7 @@ int ospf6_ase_calculate_route(struct ospf6 *ospf6, struct ospf6_lsa *lsa, return 0; } -static int ospf6_ase_calculate_timer(struct thread *t) +static void ospf6_ase_calculate_timer(struct thread *t) { struct ospf6 *ospf6; struct ospf6_lsa *lsa; @@ -1283,8 +1282,6 @@ static int ospf6_ase_calculate_timer(struct thread *t) ospf6_zebra_gr_disable(ospf6); ospf6->gr_info.finishing_restart = false; } - - return 0; } void ospf6_ase_calculate_timer_add(struct ospf6 *ospf6) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 13f16efa6..e64bf24b6 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -586,7 +586,7 @@ void ospf6_master_init(struct thread_master *master) om6->master = master; } -static int ospf6_maxage_remover(struct thread *thread) +static void ospf6_maxage_remover(struct thread *thread) { struct ospf6 *o = (struct ospf6 *)THREAD_ARG(thread); struct ospf6_area *oa; @@ -603,7 +603,7 @@ static int ospf6_maxage_remover(struct thread *thread) continue; ospf6_maxage_remove(o); - return 0; + return; } } } @@ -627,8 +627,6 @@ static int ospf6_maxage_remover(struct thread *thread) if (reschedule) { ospf6_maxage_remove(o); } - - return 0; } void ospf6_maxage_remove(struct ospf6 *o) diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c index 3ca1e132b..3cfee7d57 100644 --- a/ospfclient/ospfclient.c +++ b/ospfclient/ospfclient.c @@ -82,7 +82,7 @@ struct my_opaque_lsa { * --------------------------------------------------------- */ -static int lsa_delete(struct thread *t) +static void lsa_delete(struct thread *t) { struct ospf_apiclient *oclient; struct in_addr area_id; @@ -93,7 +93,7 @@ static int lsa_delete(struct thread *t) rc = inet_aton(args[6], &area_id); if (rc <= 0) { printf("Address Specified: %s is invalid\n", args[6]); - return rc; + return; } printf("Deleting LSA... "); @@ -102,10 +102,9 @@ static int lsa_delete(struct thread *t) atoi(args[3]), /* opaque type */ atoi(args[4])); /* opaque ID */ printf("done, return code is = %d\n", rc); - return rc; } -static int lsa_inject(struct thread *t) +static void lsa_inject(struct thread *t) { struct ospf_apiclient *cl; struct in_addr ifaddr; @@ -124,13 +123,13 @@ static int lsa_inject(struct thread *t) rc = inet_aton(args[5], &ifaddr); if (rc <= 0) { printf("Ifaddr specified %s is invalid\n", args[5]); - return rc; + return; } rc = inet_aton(args[6], &area_id); if (rc <= 0) { printf("Area ID specified %s is invalid\n", args[6]); - return rc; + return; } lsa_type = atoi(args[2]); opaque_type = atoi(args[3]); @@ -146,14 +145,12 @@ static int lsa_inject(struct thread *t) printf("done, return code is %d\n", rc); counter++; - - return 0; } /* This thread handles asynchronous messages coming in from the OSPF API server */ -static int lsa_read(struct thread *thread) +static void lsa_read(struct thread *thread) { struct ospf_apiclient *oclient; int fd; @@ -173,8 +170,6 @@ static int lsa_read(struct thread *thread) /* Reschedule read thread */ thread_add_read(master, lsa_read, oclient, fd, NULL); - - return 0; } /* --------------------------------------------------------- diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 8e59bd9eb..7aa3a27c6 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -1829,7 +1829,7 @@ void ospf_abr_task(struct ospf *ospf) zlog_debug("ospf_abr_task(): Stop"); } -static int ospf_abr_task_timer(struct thread *thread) +static void ospf_abr_task_timer(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); @@ -1843,8 +1843,6 @@ static int ospf_abr_task_timer(struct thread *thread) ospf_abr_task(ospf); ospf_abr_nssa_task(ospf); /* if nssa-abr, then scan Type-7 LSDB */ - - return 0; } void ospf_schedule_abr_task(struct ospf *ospf) diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index a33ca9577..93e3b9a8e 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -362,12 +362,11 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv) XFREE(MTYPE_OSPF_APISERVER, apiserv); } -int ospf_apiserver_read(struct thread *thread) +void ospf_apiserver_read(struct thread *thread) { struct ospf_apiserver *apiserv; struct msg *msg; int fd; - int rc = -1; enum event event; apiserv = THREAD_ARG(thread); @@ -396,7 +395,7 @@ int ospf_apiserver_read(struct thread *thread) else { zlog_warn("ospf_apiserver_read: Unknown fd(%d)", fd); ospf_apiserver_free(apiserv); - goto out; + return; } /* Read message from fd. */ @@ -408,25 +407,22 @@ int ospf_apiserver_read(struct thread *thread) /* Perform cleanup. */ ospf_apiserver_free(apiserv); - goto out; + return; } if (IS_DEBUG_OSPF_EVENT) msg_print(msg); /* Dispatch to corresponding message handler. */ - rc = ospf_apiserver_handle_msg(apiserv, msg); + ospf_apiserver_handle_msg(apiserv, msg); /* Prepare for next message, add read thread. */ ospf_apiserver_event(event, fd, apiserv); msg_free(msg); - -out: - return rc; } -int ospf_apiserver_sync_write(struct thread *thread) +void ospf_apiserver_sync_write(struct thread *thread) { struct ospf_apiserver *apiserv; struct msg *msg; @@ -455,7 +451,7 @@ int ospf_apiserver_sync_write(struct thread *thread) if (!msg) { zlog_warn( "API: ospf_apiserver_sync_write: No message in Sync-FIFO?"); - return 0; + return; } if (IS_DEBUG_OSPF_EVENT) @@ -485,12 +481,10 @@ out: /* Perform cleanup and disconnect with peer */ ospf_apiserver_free(apiserv); } - - return rc; } -int ospf_apiserver_async_write(struct thread *thread) +void ospf_apiserver_async_write(struct thread *thread) { struct ospf_apiserver *apiserv; struct msg *msg; @@ -519,7 +513,7 @@ int ospf_apiserver_async_write(struct thread *thread) if (!msg) { zlog_warn( "API: ospf_apiserver_async_write: No message in Async-FIFO?"); - return 0; + return; } if (IS_DEBUG_OSPF_EVENT) @@ -549,8 +543,6 @@ out: /* Perform cleanup and disconnect with peer */ ospf_apiserver_free(apiserv); } - - return rc; } @@ -593,7 +585,7 @@ int ospf_apiserver_serv_sock_family(unsigned short port, int family) /* Accept connection request from external applications. For each accepted connection allocate own connection instance. */ -int ospf_apiserver_accept(struct thread *thread) +void ospf_apiserver_accept(struct thread *thread) { int accept_sock; int new_sync_sock; @@ -617,7 +609,7 @@ int ospf_apiserver_accept(struct thread *thread) if (new_sync_sock < 0) { zlog_warn("ospf_apiserver_accept: accept: %s", safe_strerror(errno)); - return -1; + return; } /* Get port address and port number of peer to make reverse connection. @@ -632,7 +624,7 @@ int ospf_apiserver_accept(struct thread *thread) zlog_warn("ospf_apiserver_accept: getpeername: %s", safe_strerror(errno)); close(new_sync_sock); - return -1; + return; } if (IS_DEBUG_OSPF_EVENT) @@ -652,7 +644,7 @@ int ospf_apiserver_accept(struct thread *thread) &peer_async.sin_addr, ntohs(peer_async.sin_port)); close(new_sync_sock); - return -1; + return; } new_async_sock = socket(AF_INET, SOCK_STREAM, 0); @@ -660,7 +652,7 @@ int ospf_apiserver_accept(struct thread *thread) zlog_warn("ospf_apiserver_accept: socket: %s", safe_strerror(errno)); close(new_sync_sock); - return -1; + return; } ret = connect(new_async_sock, (struct sockaddr *)&peer_async, @@ -671,7 +663,7 @@ int ospf_apiserver_accept(struct thread *thread) safe_strerror(errno)); close(new_sync_sock); close(new_async_sock); - return -1; + return; } #ifdef USE_ASYNC_READ @@ -683,7 +675,7 @@ int ospf_apiserver_accept(struct thread *thread) safe_strerror(errno)); close(new_sync_sock); close(new_async_sock); - return -1; + return; } #endif /* USE_ASYNC_READ */ @@ -705,8 +697,6 @@ int ospf_apiserver_accept(struct thread *thread) if (IS_DEBUG_OSPF_EVENT) zlog_debug("API: New apiserv(%p), total#(%d)", (void *)apiserv, apiserver_list->count); - - return 0; } diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h index 544a32a28..3994c8d50 100644 --- a/ospfd/ospf_apiserver.h +++ b/ospfd/ospf_apiserver.h @@ -91,10 +91,10 @@ extern void ospf_apiserver_free(struct ospf_apiserver *apiserv); extern void ospf_apiserver_event(enum event event, int fd, struct ospf_apiserver *apiserv); extern int ospf_apiserver_serv_sock_family(unsigned short port, int family); -extern int ospf_apiserver_accept(struct thread *thread); -extern int ospf_apiserver_read(struct thread *thread); -extern int ospf_apiserver_sync_write(struct thread *thread); -extern int ospf_apiserver_async_write(struct thread *thread); +extern void ospf_apiserver_accept(struct thread *thread); +extern void ospf_apiserver_read(struct thread *thread); +extern void ospf_apiserver_sync_write(struct thread *thread); +extern void ospf_apiserver_async_write(struct thread *thread); extern int ospf_apiserver_send_reply(struct ospf_apiserver *apiserv, uint32_t seqnr, uint8_t rc); diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index db78e6d2d..70581b908 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -279,7 +279,7 @@ void ospf_asbr_status_update(struct ospf *ospf, uint8_t status) /* If there's redistribution configured, we need to refresh external * LSAs in order to install Type-7 and flood to all NSSA Areas */ -static int ospf_asbr_nssa_redist_update_timer(struct thread *thread) +static void ospf_asbr_nssa_redist_update_timer(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); int type; @@ -305,8 +305,6 @@ static int ospf_asbr_nssa_redist_update_timer(struct thread *thread) } ospf_external_lsa_refresh_default(ospf); - - return 0; } void ospf_schedule_asbr_nssa_redist_update(struct ospf *ospf) @@ -1064,7 +1062,7 @@ static void ospf_handle_external_aggr_update(struct ospf *ospf) } } -static int ospf_asbr_external_aggr_process(struct thread *thread) +static void ospf_asbr_external_aggr_process(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); int operation = 0; @@ -1086,8 +1084,6 @@ static int ospf_asbr_external_aggr_process(struct thread *thread) default: break; } - - return OSPF_SUCCESS; } static void ospf_external_aggr_timer(struct ospf *ospf, struct ospf_external_aggr_rt *aggr, diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index e9fb891d7..23c7a1e70 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -564,7 +564,7 @@ static int ospf_ase_compare_tables(struct ospf *ospf, return 0; } -static int ospf_ase_calculate_timer(struct thread *t) +static void ospf_ase_calculate_timer(struct thread *t) { struct ospf *ospf; struct ospf_lsa *lsa; @@ -631,8 +631,6 @@ static int ospf_ase_calculate_timer(struct thread *t) ospf_zebra_gr_disable(ospf); ospf->gr_info.finishing_restart = false; } - - return 0; } void ospf_ase_calculate_schedule(struct ospf *ospf) diff --git a/ospfd/ospf_gr.c b/ospfd/ospf_gr.c index 6bfe48145..ee1ca256e 100644 --- a/ospfd/ospf_gr.c +++ b/ospfd/ospf_gr.c @@ -510,14 +510,12 @@ void ospf_gr_check_adjs(struct ospf *ospf) } /* Handling of grace period expiry. */ -static int ospf_gr_grace_period_expired(struct thread *thread) +static void ospf_gr_grace_period_expired(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); ospf->gr_info.t_grace_period = NULL; ospf_gr_restart_exit(ospf, "grace period has expired"); - - return 0; } /* diff --git a/ospfd/ospf_gr_helper.c b/ospfd/ospf_gr_helper.c index 5eca59175..92236cf44 100644 --- a/ospfd/ospf_gr_helper.c +++ b/ospfd/ospf_gr_helper.c @@ -346,14 +346,13 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa, * Returns: * Nothing */ -static int ospf_handle_grace_timer_expiry(struct thread *thread) +static void ospf_handle_grace_timer_expiry(struct thread *thread) { struct ospf_neighbor *nbr = THREAD_ARG(thread); nbr->gr_helper_info.t_grace_timer = NULL; ospf_gr_helper_exit(nbr, OSPF_GR_HELPER_GRACE_TIMEOUT); - return OSPF_GR_SUCCESS; } /* diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index 1850d946b..97da61034 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -248,7 +248,7 @@ int ospf_dr_election(struct ospf_interface *oi) } -int ospf_hello_timer(struct thread *thread) +void ospf_hello_timer(struct thread *thread) { struct ospf_interface *oi; @@ -263,11 +263,9 @@ int ospf_hello_timer(struct thread *thread) /* Hello timer set. */ OSPF_HELLO_TIMER_ON(oi); - - return 0; } -static int ospf_wait_timer(struct thread *thread) +static void ospf_wait_timer(struct thread *thread) { struct ospf_interface *oi; @@ -278,8 +276,6 @@ static int ospf_wait_timer(struct thread *thread) zlog_debug("ISM[%s]: Timer (Wait timer expire)", IF_NAME(oi)); OSPF_ISM_EVENT_SCHEDULE(oi, ISM_WaitTimer); - - return 0; } /* Hook function called after ospf ISM event is occurred. And vty's @@ -575,7 +571,7 @@ static void ism_change_state(struct ospf_interface *oi, int state) } /* Execute ISM event process. */ -int ospf_ism_event(struct thread *thread) +void ospf_ism_event(struct thread *thread) { int event; int next_state; @@ -601,6 +597,4 @@ int ospf_ism_event(struct thread *thread) /* Make sure timer is set. */ ism_timer_set(oi); - - return 0; } diff --git a/ospfd/ospf_ism.h b/ospfd/ospf_ism.h index 5d0f95aed..35fbd15d0 100644 --- a/ospfd/ospf_ism.h +++ b/ospfd/ospf_ism.h @@ -90,9 +90,9 @@ thread_execute(master, ospf_ism_event, (I), (E)) /* Prototypes. */ -extern int ospf_ism_event(struct thread *); +extern void ospf_ism_event(struct thread *thread); extern void ism_change_status(struct ospf_interface *, int); -extern int ospf_hello_timer(struct thread *thread); +extern void ospf_hello_timer(struct thread *thread); extern int ospf_dr_election(struct ospf_interface *oi); DECLARE_HOOK(ospf_ism_change, diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index 247ceb0a0..9b3498bc1 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -353,7 +353,7 @@ static int ospf_ldp_sync_ism_change(struct ospf_interface *oi, int state, /* * LDP-SYNC holddown timer routines */ -static int ospf_ldp_sync_holddown_timer(struct thread *thread) +static void ospf_ldp_sync_holddown_timer(struct thread *thread) { struct interface *ifp; struct ospf_if_params *params; @@ -375,7 +375,6 @@ static int ospf_ldp_sync_holddown_timer(struct thread *thread) ospf_if_recalculate_output_cost(ifp); } - return 0; } void ospf_ldp_sync_holddown_timer_add(struct interface *ifp) diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index e3ba1f1dd..3eb91d0eb 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -734,7 +734,7 @@ void ospf_router_lsa_body_set(struct stream **s, struct ospf_area *area) stream_putw_at(*s, putp, cnt); } -static int ospf_stub_router_timer(struct thread *t) +static void ospf_stub_router_timer(struct thread *t) { struct ospf_area *area = THREAD_ARG(t); @@ -746,13 +746,11 @@ static int ospf_stub_router_timer(struct thread *t) * clobber an administratively set stub-router state though. */ if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) - return 0; + return; UNSET_FLAG(area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); ospf_router_lsa_update_area(area); - - return 0; } static void ospf_stub_router_check(struct ospf_area *area) @@ -3025,7 +3023,7 @@ int ospf_check_nbr_status(struct ospf *ospf) } -static int ospf_maxage_lsa_remover(struct thread *thread) +static void ospf_maxage_lsa_remover(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); struct ospf_lsa *lsa, *old; @@ -3062,7 +3060,7 @@ static int ospf_maxage_lsa_remover(struct thread *thread) ospf_maxage_lsa_remover, 0); route_unlock_node( rn); /* route_top/route_next */ - return 0; + return; } /* Remove LSA from the LSDB */ @@ -3118,8 +3116,6 @@ static int ospf_maxage_lsa_remover(struct thread *thread) if (reschedule) OSPF_TIMER_ON(ospf->t_maxage, ospf_maxage_lsa_remover, ospf->maxage_delay); - - return 0; } /* This function checks whether an LSA with initial sequence number should be @@ -3275,7 +3271,7 @@ static int ospf_lsa_maxage_walker_remover(struct ospf *ospf, } /* Periodical check of MaxAge LSA. */ -int ospf_lsa_maxage_walker(struct thread *thread) +void ospf_lsa_maxage_walker(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); struct route_node *rn; @@ -3312,7 +3308,6 @@ int ospf_lsa_maxage_walker(struct thread *thread) OSPF_TIMER_ON(ospf->t_maxage_walker, ospf_lsa_maxage_walker, OSPF_LSA_MAXAGE_CHECK_INTERVAL); - return 0; } struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *lsdb, uint8_t type, @@ -3773,7 +3768,7 @@ struct lsa_action { struct ospf_lsa *lsa; }; -static int ospf_lsa_action(struct thread *t) +static void ospf_lsa_action(struct thread *t) { struct lsa_action *data; @@ -3794,7 +3789,6 @@ static int ospf_lsa_action(struct thread *t) ospf_lsa_unlock(&data->lsa); /* Message */ XFREE(MTYPE_OSPF_MESSAGE, data); - return 0; } void ospf_schedule_lsa_flood_area(struct ospf_area *area, struct ospf_lsa *lsa) @@ -3965,7 +3959,7 @@ void ospf_refresher_unregister_lsa(struct ospf *ospf, struct ospf_lsa *lsa) } } -int ospf_lsa_refresh_walker(struct thread *t) +void ospf_lsa_refresh_walker(struct thread *t) { struct list *refresh_list; struct listnode *node, *nnode; @@ -4044,8 +4038,6 @@ int ospf_lsa_refresh_walker(struct thread *t) if (IS_DEBUG_OSPF(lsa, LSA_REFRESH)) zlog_debug("LSA[Refresh]: ospf_lsa_refresh_walker(): end"); - - return 0; } /* Flush the LSAs for the specific area */ diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index d04d11841..4b3be1538 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -308,7 +308,7 @@ extern struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *, uint8_t, extern void ospf_lsa_maxage(struct ospf *, struct ospf_lsa *); extern uint32_t get_metric(uint8_t *); -extern int ospf_lsa_maxage_walker(struct thread *); +extern void ospf_lsa_maxage_walker(struct thread *thread); extern struct ospf_lsa *ospf_lsa_refresh(struct ospf *, struct ospf_lsa *); extern void ospf_external_lsa_refresh_default(struct ospf *); @@ -328,7 +328,7 @@ extern void ospf_schedule_lsa_flush_area(struct ospf_area *, struct ospf_lsa *); extern void ospf_refresher_register_lsa(struct ospf *, struct ospf_lsa *); extern void ospf_refresher_unregister_lsa(struct ospf *, struct ospf_lsa *); -extern int ospf_lsa_refresh_walker(struct thread *); +extern void ospf_lsa_refresh_walker(struct thread *thread); extern void ospf_lsa_maxage_delete(struct ospf *, struct ospf_lsa *); diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index e3cf1cfc8..c538d1a09 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -59,7 +59,7 @@ DEFINE_HOOK(ospf_nsm_change, static void nsm_clear_adj(struct ospf_neighbor *); /* OSPF NSM Timer functions. */ -static int ospf_inactivity_timer(struct thread *thread) +static void ospf_inactivity_timer(struct thread *thread) { struct ospf_neighbor *nbr; @@ -84,11 +84,9 @@ static int ospf_inactivity_timer(struct thread *thread) OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer, nbr->v_inactivity); } - - return 0; } -static int ospf_db_desc_timer(struct thread *thread) +static void ospf_db_desc_timer(struct thread *thread) { struct ospf_neighbor *nbr; @@ -106,8 +104,6 @@ static int ospf_db_desc_timer(struct thread *thread) /* DD Retransmit timer set. */ OSPF_NSM_TIMER_ON(nbr->t_db_desc, ospf_db_desc_timer, nbr->v_db_desc); - - return 0; } /* Hook function called after ospf NSM event is occurred. @@ -776,7 +772,7 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state) } /* Execute NSM event process. */ -int ospf_nsm_event(struct thread *thread) +void ospf_nsm_event(struct thread *thread) { int event; int next_state; @@ -846,8 +842,6 @@ int ospf_nsm_event(struct thread *thread) */ if (nbr->state == NSM_Deleted) ospf_nbr_delete(nbr); - - return 0; } /* Check loading state. */ diff --git a/ospfd/ospf_nsm.h b/ospfd/ospf_nsm.h index 798325f79..0b40b1f42 100644 --- a/ospfd/ospf_nsm.h +++ b/ospfd/ospf_nsm.h @@ -70,7 +70,7 @@ thread_execute(master, ospf_nsm_event, (N), (E)) /* Prototypes. */ -extern int ospf_nsm_event(struct thread *); +extern void ospf_nsm_event(struct thread *); extern void ospf_check_nbr_loading(struct ospf_neighbor *); extern int ospf_db_summary_isempty(struct ospf_neighbor *); extern int ospf_db_summary_count(struct ospf_neighbor *); diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 4670316db..b781c9edc 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -1286,9 +1286,9 @@ out: * Followings are Opaque-LSA origination/refresh management functions. *------------------------------------------------------------------------*/ -static int ospf_opaque_type9_lsa_originate(struct thread *t); -static int ospf_opaque_type10_lsa_originate(struct thread *t); -static int ospf_opaque_type11_lsa_originate(struct thread *t); +static void ospf_opaque_type9_lsa_originate(struct thread *t); +static void ospf_opaque_type10_lsa_originate(struct thread *t); +static void ospf_opaque_type11_lsa_originate(struct thread *t); static void ospf_opaque_lsa_reoriginate_resume(struct list *listtop, void *arg); void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) @@ -1460,10 +1460,9 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) *delay0 = delay; } -static int ospf_opaque_type9_lsa_originate(struct thread *t) +static void ospf_opaque_type9_lsa_originate(struct thread *t) { struct ospf_interface *oi; - int rc; oi = THREAD_ARG(t); oi->t_opaque_lsa_self = NULL; @@ -1472,15 +1471,12 @@ static int ospf_opaque_type9_lsa_originate(struct thread *t) zlog_debug("Timer[Type9-LSA]: Originate Opaque-LSAs for OI %s", IF_NAME(oi)); - rc = opaque_lsa_originate_callback(ospf_opaque_type9_funclist, oi); - - return rc; + opaque_lsa_originate_callback(ospf_opaque_type9_funclist, oi); } -static int ospf_opaque_type10_lsa_originate(struct thread *t) +static void ospf_opaque_type10_lsa_originate(struct thread *t) { struct ospf_area *area; - int rc; area = THREAD_ARG(t); area->t_opaque_lsa_self = NULL; @@ -1490,15 +1486,12 @@ static int ospf_opaque_type10_lsa_originate(struct thread *t) "Timer[Type10-LSA]: Originate Opaque-LSAs for Area %pI4", &area->area_id); - rc = opaque_lsa_originate_callback(ospf_opaque_type10_funclist, area); - - return rc; + opaque_lsa_originate_callback(ospf_opaque_type10_funclist, area); } -static int ospf_opaque_type11_lsa_originate(struct thread *t) +static void ospf_opaque_type11_lsa_originate(struct thread *t) { struct ospf *top; - int rc; top = THREAD_ARG(t); top->t_opaque_lsa_self = NULL; @@ -1507,9 +1500,7 @@ static int ospf_opaque_type11_lsa_originate(struct thread *t) zlog_debug( "Timer[Type11-LSA]: Originate AS-External Opaque-LSAs"); - rc = opaque_lsa_originate_callback(ospf_opaque_type11_funclist, top); - - return rc; + opaque_lsa_originate_callback(ospf_opaque_type11_funclist, top); } static void ospf_opaque_lsa_reoriginate_resume(struct list *listtop, void *arg) @@ -1665,10 +1656,10 @@ struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa) static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi, struct ospf_area *area, uint8_t lsa_type, uint8_t opaque_type); -static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t); -static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t); -static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t); -static int ospf_opaque_lsa_refresh_timer(struct thread *t); +static void ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t); +static void ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t); +static void ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t); +static void ospf_opaque_lsa_refresh_timer(struct thread *t); void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent, uint8_t lsa_type, uint8_t opaque_type) @@ -1679,7 +1670,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent, struct ospf_lsa *lsa; struct opaque_info_per_type *oipt; - int (*func)(struct thread * t) = NULL; + void (*func)(struct thread * t) = NULL; int delay; switch (lsa_type) { @@ -1846,13 +1837,12 @@ static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi, return &lsa; } -static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t) +static void ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t) { struct opaque_info_per_type *oipt; struct ospf_opaque_functab *functab; struct ospf *top; struct ospf_interface *oi; - int rc = -1; oipt = THREAD_ARG(t); @@ -1861,7 +1851,7 @@ static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t) flog_warn( EC_OSPF_LSA, "ospf_opaque_type9_lsa_reoriginate_timer: No associated function?"); - goto out; + return; } oi = (struct ospf_interface *)oipt->owner; @@ -1869,7 +1859,7 @@ static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t) flog_warn( EC_OSPF_LSA, "ospf_opaque_type9_lsa_reoriginate_timer: Something wrong?"); - goto out; + return; } if (!CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE) @@ -1881,8 +1871,7 @@ static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t) oipt->opaque_type); oipt->status = PROC_SUSPEND; - rc = 0; - goto out; + return; } if (IS_DEBUG_OSPF_EVENT) @@ -1890,12 +1879,10 @@ static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t) "Timer[Type9-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for OI (%s)", oipt->opaque_type, IF_NAME(oi)); - rc = (*functab->lsa_originator)(oi); -out: - return rc; + (*functab->lsa_originator)(oi); } -static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) +static void ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) { struct opaque_info_per_type *oipt; struct ospf_opaque_functab *functab; @@ -1903,7 +1890,7 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) struct ospf *top; struct ospf_area *area; struct ospf_interface *oi; - int n, rc = -1; + int n; oipt = THREAD_ARG(t); @@ -1912,7 +1899,7 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) flog_warn( EC_OSPF_LSA, "ospf_opaque_type10_lsa_reoriginate_timer: No associated function?"); - goto out; + return; } area = (struct ospf_area *)oipt->owner; @@ -1920,7 +1907,7 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) flog_warn( EC_OSPF_LSA, "ospf_opaque_type10_lsa_reoriginate_timer: Something wrong?"); - goto out; + return; } /* There must be at least one "opaque-capable, full-state" neighbor. */ @@ -1937,8 +1924,7 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) oipt->opaque_type); oipt->status = PROC_SUSPEND; - rc = 0; - goto out; + return; } if (IS_DEBUG_OSPF_EVENT) @@ -1946,17 +1932,14 @@ static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t) "Timer[Type10-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for Area %pI4", oipt->opaque_type, &area->area_id); - rc = (*functab->lsa_originator)(area); -out: - return rc; + (*functab->lsa_originator)(area); } -static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t) +static void ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t) { struct opaque_info_per_type *oipt; struct ospf_opaque_functab *functab; struct ospf *top; - int rc = -1; oipt = THREAD_ARG(t); @@ -1965,14 +1948,14 @@ static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t) flog_warn( EC_OSPF_LSA, "ospf_opaque_type11_lsa_reoriginate_timer: No associated function?"); - goto out; + return; } if ((top = (struct ospf *)oipt->owner) == NULL) { flog_warn( EC_OSPF_LSA, "ospf_opaque_type11_lsa_reoriginate_timer: Something wrong?"); - goto out; + return; } if (!CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE)) { @@ -1982,8 +1965,7 @@ static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t) oipt->opaque_type); oipt->status = PROC_SUSPEND; - rc = 0; - goto out; + return; } if (IS_DEBUG_OSPF_EVENT) @@ -1991,9 +1973,7 @@ static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t) "Timer[Type11-LSA]: Re-originate Opaque-LSAs (opaque-type=%u).", oipt->opaque_type); - rc = (*functab->lsa_originator)(top); -out: - return rc; + (*functab->lsa_originator)(top); } void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa0) @@ -2064,7 +2044,7 @@ out: return; } -static int ospf_opaque_lsa_refresh_timer(struct thread *t) +static void ospf_opaque_lsa_refresh_timer(struct thread *t) { struct opaque_info_per_id *oipi; struct ospf_opaque_functab *functab; @@ -2079,8 +2059,6 @@ static int ospf_opaque_lsa_refresh_timer(struct thread *t) if ((functab = oipi->opqctl_type->functab) != NULL) if (functab->lsa_refresher != NULL) (*functab->lsa_refresher)(lsa); - - return 0; } void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0) diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index e17e53109..c2bd7a079 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -449,7 +449,7 @@ static int ospf_make_md5_digest(struct ospf_interface *oi, } -static int ospf_ls_req_timer(struct thread *thread) +static void ospf_ls_req_timer(struct thread *thread) { struct ospf_neighbor *nbr; @@ -462,8 +462,6 @@ static int ospf_ls_req_timer(struct thread *thread) /* Set Link State Request retransmission timer. */ OSPF_NSM_TIMER_ON(nbr->t_ls_req, ospf_ls_req_timer, nbr->v_ls_req); - - return 0; } void ospf_ls_req_event(struct ospf_neighbor *nbr) @@ -474,7 +472,7 @@ void ospf_ls_req_event(struct ospf_neighbor *nbr) /* Cyclic timer function. Fist registered in ospf_nbr_new () in ospf_neighbor.c */ -int ospf_ls_upd_timer(struct thread *thread) +void ospf_ls_upd_timer(struct thread *thread) { struct ospf_neighbor *nbr; @@ -530,11 +528,9 @@ int ospf_ls_upd_timer(struct thread *thread) /* Set LS Update retransmission timer. */ OSPF_NSM_TIMER_ON(nbr->t_ls_upd, ospf_ls_upd_timer, nbr->v_ls_upd); - - return 0; } -int ospf_ls_ack_timer(struct thread *thread) +void ospf_ls_ack_timer(struct thread *thread) { struct ospf_interface *oi; @@ -547,8 +543,6 @@ int ospf_ls_ack_timer(struct thread *thread) /* Set LS Ack timer. */ OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack); - - return 0; } #ifdef WANT_OSPF_WRITE_FRAGMENT @@ -625,7 +619,7 @@ static void ospf_write_frags(int fd, struct ospf_packet *op, struct ip *iph, } #endif /* WANT_OSPF_WRITE_FRAGMENT */ -static int ospf_write(struct thread *thread) +static void ospf_write(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); struct ospf_interface *oi; @@ -657,7 +651,7 @@ static int ospf_write(struct thread *thread) zlog_debug( "ospf_write failed to send, fd %d, instance %u", ospf->fd, ospf->oi_running); - return -1; + return; } node = listhead(ospf->oi_write_q); @@ -876,8 +870,6 @@ static int ospf_write(struct thread *thread) if (!list_isempty(ospf->oi_write_q)) thread_add_write(master, ospf_write, ospf, ospf->fd, &ospf->t_write); - - return 0; } /* OSPF Hello message read -- RFC2328 Section 10.5. */ @@ -3215,7 +3207,7 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) } /* Starting point of packet process function. */ -int ospf_read(struct thread *thread) +void ospf_read(struct thread *thread) { struct ospf *ospf; int32_t count = 0; @@ -3232,13 +3224,11 @@ int ospf_read(struct thread *thread) ret = ospf_read_helper(ospf); switch (ret) { case OSPF_READ_ERROR: - return -1; + return; case OSPF_READ_CONTINUE: break; } } - - return 0; } /* Make OSPF header. */ @@ -3747,7 +3737,7 @@ static void ospf_poll_send(struct ospf_nbr_nbma *nbr_nbma) ospf_hello_send_sub(oi, nbr_nbma->addr.s_addr); } -int ospf_poll_timer(struct thread *thread) +void ospf_poll_timer(struct thread *thread) { struct ospf_nbr_nbma *nbr_nbma; @@ -3763,12 +3753,10 @@ int ospf_poll_timer(struct thread *thread) if (nbr_nbma->v_poll > 0) OSPF_POLL_TIMER_ON(nbr_nbma->t_poll, ospf_poll_timer, nbr_nbma->v_poll); - - return 0; } -int ospf_hello_reply_timer(struct thread *thread) +void ospf_hello_reply_timer(struct thread *thread) { struct ospf_neighbor *nbr; @@ -3780,8 +3768,6 @@ int ospf_hello_reply_timer(struct thread *thread) IF_NAME(nbr->oi), &nbr->router_id); ospf_hello_send_sub(nbr->oi, nbr->address.u.prefix4.s_addr); - - return 0; } /* Send OSPF Hello. */ @@ -4124,7 +4110,7 @@ static void ospf_ls_upd_queue_send(struct ospf_interface *oi, } } -static int ospf_ls_upd_send_queue_event(struct thread *thread) +static void ospf_ls_upd_send_queue_event(struct thread *thread) { struct ospf_interface *oi = THREAD_ARG(thread); struct route_node *rn; @@ -4167,8 +4153,6 @@ static int ospf_ls_upd_send_queue_event(struct thread *thread) if (IS_DEBUG_OSPF_EVENT) zlog_debug("ospf_ls_upd_send_queue stop"); - - return 0; } void ospf_ls_upd_send(struct ospf_neighbor *nbr, struct list *update, int flag, @@ -4272,7 +4256,7 @@ static void ospf_ls_ack_send_list(struct ospf_interface *oi, struct list *ack, OSPF_ISM_WRITE_ON(oi->ospf); } -static int ospf_ls_ack_send_event(struct thread *thread) +static void ospf_ls_ack_send_event(struct thread *thread) { struct ospf_interface *oi = THREAD_ARG(thread); @@ -4281,8 +4265,6 @@ static int ospf_ls_ack_send_event(struct thread *thread) while (listcount(oi->ls_ack_direct.ls_ack)) ospf_ls_ack_send_list(oi, oi->ls_ack_direct.ls_ack, oi->ls_ack_direct.dst); - - return 0; } void ospf_ls_ack_send(struct ospf_neighbor *nbr, struct ospf_lsa *lsa) diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index 72b87edaf..cefc9c21b 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -139,7 +139,7 @@ extern struct ospf_packet *ospf_fifo_head(struct ospf_fifo *); extern void ospf_fifo_flush(struct ospf_fifo *); extern void ospf_fifo_free(struct ospf_fifo *); -extern int ospf_read(struct thread *); +extern void ospf_read(struct thread *thread); extern void ospf_hello_send(struct ospf_interface *); extern void ospf_db_desc_send(struct ospf_neighbor *); extern void ospf_db_desc_resend(struct ospf_neighbor *); @@ -152,10 +152,10 @@ extern void ospf_ls_ack_send_delayed(struct ospf_interface *); extern void ospf_ls_retransmit(struct ospf_interface *, struct ospf_lsa *); extern void ospf_ls_req_event(struct ospf_neighbor *); -extern int ospf_ls_upd_timer(struct thread *); -extern int ospf_ls_ack_timer(struct thread *); -extern int ospf_poll_timer(struct thread *); -extern int ospf_hello_reply_timer(struct thread *); +extern void ospf_ls_upd_timer(struct thread *thread); +extern void ospf_ls_ack_timer(struct thread *thread); +extern void ospf_poll_timer(struct thread *thread); +extern void ospf_hello_reply_timer(struct thread *thread); extern const struct message ospf_packet_type_str[]; extern const size_t ospf_packet_type_str_max; diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 8b4d55984..f76340021 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1809,7 +1809,7 @@ void ospf_spf_calculate_areas(struct ospf *ospf, struct route_table *new_table, } /* Worker for SPF calculation scheduler. */ -static int ospf_spf_calculate_schedule_worker(struct thread *thread) +static void ospf_spf_calculate_schedule_worker(struct thread *thread) { struct ospf *ospf = THREAD_ARG(thread); struct route_table *new_table, *new_rtrs; @@ -1929,8 +1929,6 @@ static int ospf_spf_calculate_schedule_worker(struct thread *thread) } ospf_clear_spf_reason_flags(); - - return 0; } /* diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 181cc37f4..e4059d05c 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -470,7 +470,7 @@ int ospf_sr_local_block_release_label(mpls_label_t label) * * @return 1 on success */ -static int sr_start_label_manager(struct thread *start) +static void sr_start_label_manager(struct thread *start) { struct ospf *ospf; @@ -478,8 +478,6 @@ static int sr_start_label_manager(struct thread *start) /* re-attempt to start SR & Label Manager connection */ ospf_sr_start(ospf); - - return 1; } /* Segment Routing starter function */ diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 66b7425a8..389d3647d 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -524,7 +524,7 @@ bool ospf_external_default_routemap_apply_walk(struct ospf *ospf, * Function to originate or flush default after applying * route-map on all ei. */ -static int ospf_external_lsa_default_routemap_timer(struct thread *thread) +static void ospf_external_lsa_default_routemap_timer(struct thread *thread) { struct list *ext_list; struct ospf *ospf = THREAD_ARG(thread); @@ -545,7 +545,7 @@ static int ospf_external_lsa_default_routemap_timer(struct thread *thread) /* Nothing to be done here. */ if (IS_DEBUG_OSPF_DEFAULT_INFO) zlog_debug("Default originate info not present"); - return 0; + return; } /* For all the ei apply route-map */ @@ -570,8 +570,6 @@ static int ospf_external_lsa_default_routemap_timer(struct thread *thread) ospf_external_lsa_refresh(ospf, lsa, default_ei, true, false); else if (!ret && lsa) ospf_external_lsa_flush(ospf, DEFAULT_ROUTE, &default_ei->p, 0); - - return 1; } @@ -1522,7 +1520,7 @@ int ospf_distribute_list_out_unset(struct ospf *ospf, int type, } /* distribute-list update timer. */ -static int ospf_distribute_list_update_timer(struct thread *thread) +static void ospf_distribute_list_update_timer(struct thread *thread) { struct route_node *rn; struct external_info *ei; @@ -1532,7 +1530,7 @@ static int ospf_distribute_list_update_timer(struct thread *thread) struct ospf *ospf = THREAD_ARG(thread); if (ospf == NULL) - return 0; + return; ospf->t_distribute_update = NULL; @@ -1639,8 +1637,6 @@ static int ospf_distribute_list_update_timer(struct thread *thread) } if (default_refresh) ospf_external_lsa_refresh_default(ospf); - - return 0; } /* Update distribute-list and set timer to apply access-list. */ diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index b1bba9eb4..221f6e7e4 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -584,13 +584,11 @@ static void ospf_deferred_shutdown_finish(struct ospf *ospf) } /* Timer thread for G-R */ -static int ospf_deferred_shutdown_timer(struct thread *t) +static void ospf_deferred_shutdown_timer(struct thread *t) { struct ospf *ospf = THREAD_ARG(t); ospf_deferred_shutdown_finish(ospf); - - return 0; } /* Check whether deferred-shutdown must be scheduled, otherwise call diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index 162c53590..b9f2ba3c6 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -92,10 +92,10 @@ struct get_pcep_session_args { /* Internal Functions Called From Main Thread */ static int pcep_ctrl_halt_cb(struct frr_pthread *fpt, void **res); -static int pcep_refine_path_event_cb(struct thread *thread); +static void pcep_refine_path_event_cb(struct thread *thread); /* Internal Functions Called From Controller Thread */ -static int pcep_thread_finish_event_handler(struct thread *thread); +static void pcep_thread_finish_event_handler(struct thread *thread); /* Controller Thread Timer Handler */ static int schedule_thread_timer(struct ctrl_state *ctrl_state, int pcc_id, @@ -108,7 +108,7 @@ static int schedule_thread_timer_with_cb( enum pcep_ctrl_timer_type timer_type, enum pcep_ctrl_timeout_type timeout_type, uint32_t delay, void *payload, struct thread **thread, pcep_ctrl_thread_callback timer_cb); -static int pcep_thread_timer_handler(struct thread *thread); +static void pcep_thread_timer_handler(struct thread *thread); /* Controller Thread Socket read/write Handler */ static int schedule_thread_socket(struct ctrl_state *ctrl_state, int pcc_id, @@ -124,7 +124,7 @@ static int send_to_thread_with_cb(struct ctrl_state *ctrl_state, int pcc_id, enum pcep_ctrl_event_type type, uint32_t sub_type, void *payload, pcep_ctrl_thread_callback event_cb); -static int pcep_thread_event_handler(struct thread *thread); +static void pcep_thread_event_handler(struct thread *thread); static int pcep_thread_event_update_pcc_options(struct ctrl_state *ctrl_state, struct pcc_opts *opts); static int pcep_thread_event_update_pce_options(struct ctrl_state *ctrl_state, @@ -149,7 +149,7 @@ pcep_thread_path_refined_event(struct ctrl_state *ctrl_state, /* Main Thread Event Handler */ static int send_to_main(struct ctrl_state *ctrl_state, int pcc_id, enum pcep_main_event_type type, void *payload); -static int pcep_main_event_handler(struct thread *thread); +static void pcep_main_event_handler(struct thread *thread); /* Helper functions */ static void set_ctrl_state(struct frr_pthread *fpt, @@ -340,7 +340,7 @@ int pcep_ctrl_halt_cb(struct frr_pthread *fpt, void **res) return 0; } -int pcep_refine_path_event_cb(struct thread *thread) +void pcep_refine_path_event_cb(struct thread *thread) { struct pcep_refine_path_event_data *data = THREAD_ARG(thread); assert(data != NULL); @@ -351,7 +351,7 @@ int pcep_refine_path_event_cb(struct thread *thread) path_pcep_refine_path(path); - return send_to_thread(ctrl_state, pcc_id, EV_PATH_REFINED, 0, data); + send_to_thread(ctrl_state, pcc_id, EV_PATH_REFINED, 0, data); } @@ -507,7 +507,7 @@ void pcep_thread_path_refined_event(struct ctrl_state *ctrl_state, /* ------------ Internal Functions Called From Controller Thread ------------ */ -int pcep_thread_finish_event_handler(struct thread *thread) +void pcep_thread_finish_event_handler(struct thread *thread) { int i; struct frr_pthread *fpt = THREAD_ARG(thread); @@ -527,7 +527,6 @@ int pcep_thread_finish_event_handler(struct thread *thread) fpt->data = NULL; atomic_store_explicit(&fpt->running, false, memory_order_relaxed); - return 0; } /* ------------ Controller Thread Timer Handler ------------ */ @@ -566,7 +565,7 @@ int schedule_thread_timer(struct ctrl_state *ctrl_state, int pcc_id, thread, pcep_thread_timer_handler); } -int pcep_thread_timer_handler(struct thread *thread) +void pcep_thread_timer_handler(struct thread *thread) { /* data unpacking */ struct pcep_ctrl_timer_data *data = THREAD_ARG(thread); @@ -579,26 +578,25 @@ int pcep_thread_timer_handler(struct thread *thread) void *param = data->payload; XFREE(MTYPE_PCEP, data); - int ret = 0; struct pcc_state *pcc_state = NULL; switch (timer_type) { case TM_RECONNECT_PCC: pcc_state = pcep_pcc_get_pcc_by_id(ctrl_state->pcc, pcc_id); if (!pcc_state) - return ret; + return; pcep_pcc_reconnect(ctrl_state, pcc_state); break; case TM_TIMEOUT: pcc_state = pcep_pcc_get_pcc_by_id(ctrl_state->pcc, pcc_id); if (!pcc_state) - return ret; + return; pcep_pcc_timeout_handler(ctrl_state, pcc_state, timeout_type, param); break; case TM_CALCULATE_BEST_PCE: /* Previous best disconnect so new best should be synced */ - ret = pcep_pcc_timer_update_best_pce(ctrl_state, pcc_id); + pcep_pcc_timer_update_best_pce(ctrl_state, pcc_id); break; case TM_SESSION_TIMEOUT_PCC: pcc_state = pcep_pcc_get_pcc_by_id(ctrl_state->pcc, pcc_id); @@ -610,11 +608,9 @@ int pcep_thread_timer_handler(struct thread *thread) "Unknown controller timer triggered: %u", timer_type); break; } - - return ret; } -int pcep_thread_pcep_event(struct thread *thread) +void pcep_thread_pcep_event(struct thread *thread) { struct pcep_ctrl_event_data *data = THREAD_ARG(thread); assert(data != NULL); @@ -634,8 +630,6 @@ int pcep_thread_pcep_event(struct thread *thread) } } destroy_pcep_event(event); - - return 0; } /* ------------ Controller Thread Socket Functions ------------ */ @@ -725,7 +719,7 @@ int send_to_thread_with_cb(struct ctrl_state *ctrl_state, int pcc_id, return 0; } -int pcep_thread_event_handler(struct thread *thread) +void pcep_thread_event_handler(struct thread *thread) { /* data unpacking */ struct pcep_ctrl_event_data *data = THREAD_ARG(thread); @@ -738,8 +732,6 @@ int pcep_thread_event_handler(struct thread *thread) void *payload = data->payload; XFREE(MTYPE_PCEP, data); - int ret = 0; - /* Possible sub-type values */ enum pcep_pathd_event_type path_event_type = PCEP_PATH_UNDEFINED; @@ -757,29 +749,26 @@ int pcep_thread_event_handler(struct thread *thread) case EV_UPDATE_PCC_OPTS: assert(payload != NULL); pcc_opts = (struct pcc_opts *)payload; - ret = pcep_thread_event_update_pcc_options(ctrl_state, - pcc_opts); + pcep_thread_event_update_pcc_options(ctrl_state, pcc_opts); break; case EV_UPDATE_PCE_OPTS: assert(payload != NULL); pce_opts = (struct pce_opts *)payload; - ret = pcep_thread_event_update_pce_options(ctrl_state, pcc_id, - pce_opts); + pcep_thread_event_update_pce_options(ctrl_state, pcc_id, + pce_opts); break; case EV_REMOVE_PCC: pce_opts = (struct pce_opts *)payload; - ret = pcep_thread_event_remove_pcc(ctrl_state, pce_opts); - if (ret == 0) { - ret = pcep_pcc_multi_pce_remove_pcc(ctrl_state, - ctrl_state->pcc); - } + if (pcep_thread_event_remove_pcc(ctrl_state, pce_opts) == 0) + pcep_pcc_multi_pce_remove_pcc(ctrl_state, + ctrl_state->pcc); break; case EV_PATHD_EVENT: assert(payload != NULL); path_event_type = (enum pcep_pathd_event_type)sub_type; path = (struct path *)payload; - ret = pcep_thread_event_pathd_event(ctrl_state, path_event_type, - path); + pcep_thread_event_pathd_event(ctrl_state, path_event_type, + path); break; case EV_SYNC_PATH: assert(payload != NULL); @@ -789,14 +778,14 @@ int pcep_thread_event_handler(struct thread *thread) pcep_thread_event_sync_path(ctrl_state, pcc_id, path); break; case EV_SYNC_DONE: - ret = pcep_thread_event_sync_done(ctrl_state, pcc_id); + pcep_thread_event_sync_done(ctrl_state, pcc_id); break; case EV_RESET_PCC_SESSION: pcc_state = pcep_pcc_get_pcc_by_name(ctrl_state->pcc, (const char *)payload); if (pcc_state) { pcep_pcc_disable(ctrl_state, pcc_state); - ret = pcep_pcc_enable(ctrl_state, pcc_state); + pcep_pcc_enable(ctrl_state, pcc_state); } else { flog_warn(EC_PATH_PCEP_RECOVERABLE_INTERNAL_ERROR, "Cannot reset state for PCE: %s", @@ -840,8 +829,6 @@ int pcep_thread_event_handler(struct thread *thread) type); break; } - - return ret; } int pcep_thread_event_update_pcc_options(struct ctrl_state *ctrl_state, @@ -994,7 +981,7 @@ int send_to_main(struct ctrl_state *ctrl_state, int pcc_id, return 0; } -int pcep_main_event_handler(struct thread *thread) +void pcep_main_event_handler(struct thread *thread) { /* data unpacking */ struct pcep_main_event_data *data = THREAD_ARG(thread); @@ -1005,7 +992,7 @@ int pcep_main_event_handler(struct thread *thread) void *payload = data->payload; XFREE(MTYPE_PCEP, data); - return handler(type, pcc_id, payload); + handler(type, pcc_id, payload); } diff --git a/pathd/path_pcep_controller.h b/pathd/path_pcep_controller.h index f55cc0db7..de113feee 100644 --- a/pathd/path_pcep_controller.h +++ b/pathd/path_pcep_controller.h @@ -90,7 +90,7 @@ struct pcep_ctrl_socket_data { void *payload; }; -typedef int (*pcep_ctrl_thread_callback)(struct thread *); +typedef void (*pcep_ctrl_thread_callback)(struct thread *); /* PCC connection information, populated in a thread-safe * manner with pcep_ctrl_get_pcc_info() */ @@ -174,7 +174,7 @@ int pcep_thread_socket_write(void *fpt, void **thread, int fd, void *payload, int pcep_thread_send_ctrl_event(void *fpt, void *payload, pcep_ctrl_thread_callback cb); -int pcep_thread_pcep_event(struct thread *thread); +void pcep_thread_pcep_event(struct thread *thread); int pcep_thread_pcc_count(struct ctrl_state *ctrl_state); /* Called by the PCC to refine a path in the main thread */ int pcep_thread_refine_path(struct ctrl_state *ctrl_state, int pcc_id, diff --git a/pathd/path_pcep_lib.c b/pathd/path_pcep_lib.c index 9fc8c091f..8e3565d72 100644 --- a/pathd/path_pcep_lib.c +++ b/pathd/path_pcep_lib.c @@ -45,8 +45,8 @@ static int pcep_lib_pceplib_socket_read_cb(void *fpt, void **thread, int fd, void *payload); static int pcep_lib_pceplib_socket_write_cb(void *fpt, void **thread, int fd, void *payload); -static int pcep_lib_socket_read_ready(struct thread *thread); -static int pcep_lib_socket_write_ready(struct thread *thread); +static void pcep_lib_socket_read_ready(struct thread *thread); +static void pcep_lib_socket_write_ready(struct thread *thread); /* pceplib pcep_event callbacks */ static void pcep_lib_pceplib_event_cb(void *fpt, pcep_event *event); @@ -241,26 +241,22 @@ int pcep_lib_pceplib_socket_read_cb(void *fpt, void **thread, int fd, /* Callbacks called by path_pcep_controller when a socket is ready to read/write */ -int pcep_lib_socket_write_ready(struct thread *thread) +void pcep_lib_socket_write_ready(struct thread *thread) { struct pcep_ctrl_socket_data *data = THREAD_ARG(thread); assert(data != NULL); - int retval = pceplib_external_socket_write(data->fd, data->payload); + pceplib_external_socket_write(data->fd, data->payload); XFREE(MTYPE_PCEP, data); - - return retval; } -int pcep_lib_socket_read_ready(struct thread *thread) +void pcep_lib_socket_read_ready(struct thread *thread) { struct pcep_ctrl_socket_data *data = THREAD_ARG(thread); assert(data != NULL); - int retval = pceplib_external_socket_read(data->fd, data->payload); + pceplib_external_socket_read(data->fd, data->payload); XFREE(MTYPE_PCEP, data); - - return retval; } /* Callback passed to pceplib when a pcep_event is ready */ diff --git a/pathd/path_ted.c b/pathd/path_ted.c index ff9bc82f3..3440b9339 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -39,8 +39,8 @@ static void path_ted_unregister_vty(void); static uint32_t path_ted_start_importing_igp(const char *daemon_str); static uint32_t path_ted_stop_importing_igp(void); static enum zclient_send_status path_ted_link_state_sync(void); -static int path_ted_timer_handler_sync(struct thread *thread); -static int path_ted_timer_handler_refresh(struct thread *thread); +static void path_ted_timer_handler_sync(struct thread *thread); +static void path_ted_timer_handler_refresh(struct thread *thread); static int path_ted_cli_debug_config_write(struct vty *vty); static int path_ted_cli_debug_set_all(uint32_t flags, bool set); @@ -602,14 +602,14 @@ enum zclient_send_status path_ted_link_state_sync(void) * * @return status */ -int path_ted_timer_handler_sync(struct thread *thread) +void path_ted_timer_handler_sync(struct thread *thread) { /* data unpacking */ struct ted_state *data = THREAD_ARG(thread); assert(data != NULL); /* Retry the sync */ - return path_ted_link_state_sync(); + path_ted_link_state_sync(); } /** @@ -639,10 +639,10 @@ int path_ted_segment_list_refresh(void) * * @return status */ -int path_ted_timer_handler_refresh(struct thread *thread) +void path_ted_timer_handler_refresh(struct thread *thread) { if (!path_ted_is_initialized()) - return MPLS_LABEL_NONE; + return; PATH_TED_DEBUG("%s: PATHD-TED: Refresh sid from current TED", __func__); /* data unpacking */ @@ -651,7 +651,6 @@ int path_ted_timer_handler_refresh(struct thread *thread) assert(data != NULL); srte_policy_update_ted_sid(); - return 0; } /** diff --git a/pathd/pathd.c b/pathd/pathd.c index f56da37b5..be2cfe8b0 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -45,9 +45,9 @@ DEFINE_HOOK(pathd_candidate_removed, (struct srte_candidate * candidate), (candidate)); static void trigger_pathd_candidate_created(struct srte_candidate *candidate); -static int trigger_pathd_candidate_created_timer(struct thread *thread); +static void trigger_pathd_candidate_created_timer(struct thread *thread); static void trigger_pathd_candidate_updated(struct srte_candidate *candidate); -static int trigger_pathd_candidate_updated_timer(struct thread *thread); +static void trigger_pathd_candidate_updated_timer(struct thread *thread); static void trigger_pathd_candidate_removed(struct srte_candidate *candidate); static const char * srte_candidate_metric_name(enum srte_candidate_metric_type type); @@ -1240,11 +1240,11 @@ void trigger_pathd_candidate_created(struct srte_candidate *candidate) (void *)candidate, HOOK_DELAY, &candidate->hook_timer); } -int trigger_pathd_candidate_created_timer(struct thread *thread) +void trigger_pathd_candidate_created_timer(struct thread *thread) { struct srte_candidate *candidate = THREAD_ARG(thread); candidate->hook_timer = NULL; - return hook_call(pathd_candidate_created, candidate); + hook_call(pathd_candidate_created, candidate); } void trigger_pathd_candidate_updated(struct srte_candidate *candidate) @@ -1260,11 +1260,11 @@ void trigger_pathd_candidate_updated(struct srte_candidate *candidate) (void *)candidate, HOOK_DELAY, &candidate->hook_timer); } -int trigger_pathd_candidate_updated_timer(struct thread *thread) +void trigger_pathd_candidate_updated_timer(struct thread *thread) { struct srte_candidate *candidate = THREAD_ARG(thread); candidate->hook_timer = NULL; - return hook_call(pathd_candidate_updated, candidate); + hook_call(pathd_candidate_updated, candidate); } void trigger_pathd_candidate_removed(struct srte_candidate *candidate) diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index 7d05403c3..e7fff4db6 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -473,7 +473,7 @@ static int pim_assert_cancel(struct pim_ifchannel *ch) return pim_assert_do(ch, metric); } -static int on_assert_timer(struct thread *t) +static void on_assert_timer(struct thread *t) { struct pim_ifchannel *ch; struct interface *ifp; @@ -504,8 +504,6 @@ static int on_assert_timer(struct thread *t) ifp->name); } } - - return 0; } static void assert_timer_off(struct pim_ifchannel *ch) diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 0b993ec05..5901ae343 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -157,7 +157,7 @@ static struct bsgrp_node *pim_bsm_new_bsgrp_node(struct route_table *rt, return bsgrp; } -static int pim_on_bs_timer(struct thread *t) +static void pim_on_bs_timer(struct thread *t) { struct route_node *rn; struct bsm_scope *scope; @@ -200,7 +200,6 @@ static int pim_on_bs_timer(struct thread *t) pim_bsm_rpinfos_free(bsgrp_node->partial_bsrp_list); bsgrp_node->pend_rp_cnt = 0; } - return 0; } static void pim_bs_timer_stop(struct bsm_scope *scope) @@ -276,7 +275,7 @@ static bool is_hold_time_elapsed(void *data) return true; } -static int pim_on_g2rp_timer(struct thread *t) +static void pim_on_g2rp_timer(struct thread *t) { struct bsm_rpinfo *bsrp; struct bsm_rpinfo *bsrp_node; @@ -312,14 +311,14 @@ static int pim_on_g2rp_timer(struct thread *t) if (!rn) { zlog_warn("%s: Route node doesn't exist", __func__); - return 0; + return; } rp_info = (struct rp_info *)rn->info; if (!rp_info) { route_unlock_node(rn); - return 0; + return; } if (rp_info->rp_src != RP_SRC_STATIC) { @@ -342,8 +341,6 @@ static int pim_on_g2rp_timer(struct thread *t) &bsgrp_node->group); pim_free_bsgrp_data(bsgrp_node); } - - return 0; } static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index a613c89b7..006928fea 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -644,7 +644,7 @@ static void ifjoin_to_noinfo(struct pim_ifchannel *ch) delete_on_noinfo(ch); } -static int on_ifjoin_expiry_timer(struct thread *t) +static void on_ifjoin_expiry_timer(struct thread *t) { struct pim_ifchannel *ch; @@ -656,11 +656,9 @@ static int on_ifjoin_expiry_timer(struct thread *t) ifjoin_to_noinfo(ch); /* ch may have been deleted */ - - return 0; } -static int on_ifjoin_prune_pending_timer(struct thread *t) +static void on_ifjoin_prune_pending_timer(struct thread *t) { struct pim_ifchannel *ch; int send_prune_echo; /* boolean */ @@ -726,8 +724,6 @@ static int on_ifjoin_prune_pending_timer(struct thread *t) } /* from here ch may have been deleted */ } - - return 0; } static void check_recv_upstream(int is_join, struct interface *recv_ifp, diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 512384d64..34268ecf9 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -40,7 +40,7 @@ #include "pim_zebra.h" static void group_timer_off(struct gm_group *group); -static int pim_igmp_general_query(struct thread *t); +static void pim_igmp_general_query(struct thread *t); /* This socket is used for TXing IGMP packets only, IGMP RX happens * in pim_mroute_msg() @@ -141,7 +141,7 @@ struct gm_sock *pim_igmp_sock_lookup_ifaddr(struct list *igmp_sock_list, return NULL; } -static int pim_igmp_other_querier_expire(struct thread *t) +static void pim_igmp_other_querier_expire(struct thread *t) { struct gm_sock *igmp; @@ -166,8 +166,6 @@ static int pim_igmp_other_querier_expire(struct thread *t) Query, Set Gen. Query. timer) */ pim_igmp_general_query(t); - - return 0; } void pim_igmp_other_querier_timer_on(struct gm_sock *igmp) @@ -705,7 +703,7 @@ void pim_igmp_general_query_off(struct gm_sock *igmp) } /* Issue IGMP general query */ -static int pim_igmp_general_query(struct thread *t) +static void pim_igmp_general_query(struct thread *t) { struct gm_sock *igmp; struct in_addr dst_addr; @@ -759,8 +757,6 @@ static int pim_igmp_general_query(struct thread *t) igmp->querier_query_interval); pim_igmp_general_query_on(igmp); - - return 0; } static void sock_close(struct gm_sock *igmp) @@ -1027,7 +1023,7 @@ static struct gm_sock *igmp_sock_new(int fd, struct in_addr ifaddr, static void igmp_read_on(struct gm_sock *igmp); -static int pim_igmp_read(struct thread *t) +static void pim_igmp_read(struct thread *t) { uint8_t buf[10000]; struct gm_sock *igmp = (struct gm_sock *)THREAD_ARG(t); @@ -1053,7 +1049,6 @@ static int pim_igmp_read(struct thread *t) done: igmp_read_on(igmp); - return 0; } static void igmp_read_on(struct gm_sock *igmp) @@ -1123,7 +1118,7 @@ struct gm_sock *pim_igmp_sock_add(struct list *igmp_sock_list, source records. Source records whose timers are zero (from the previous EXCLUDE mode) are deleted. */ -static int igmp_group_timer(struct thread *t) +static void igmp_group_timer(struct thread *t) { struct gm_group *group; @@ -1157,8 +1152,6 @@ static int igmp_group_timer(struct thread *t) if (listcount(group->group_source_list) < 1) { igmp_group_delete_empty_include(group); } - - return 0; } static void group_timer_off(struct gm_group *group) diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index fafca5a14..87554bc8b 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -118,7 +118,7 @@ void igmp_group_reset_gmi(struct gm_group *group) igmp_group_timer_on(group, group_membership_interval_msec, ifp->name); } -static int igmp_source_timer(struct thread *t) +static void igmp_source_timer(struct thread *t) { struct gm_source *source; struct gm_group *group; @@ -179,8 +179,6 @@ static int igmp_source_timer(struct thread *t) igmp_group_delete_empty_include(group); } } - - return 0; } static void source_timer_off(struct gm_group *group, struct gm_source *source) @@ -1212,7 +1210,7 @@ static int group_retransmit_sources(struct gm_group *group, return num_retransmit_sources_left; } -static int igmp_group_retransmit(struct thread *t) +static void igmp_group_retransmit(struct thread *t) { struct gm_group *group; int num_retransmit_sources_left; @@ -1262,8 +1260,6 @@ static int igmp_group_retransmit(struct thread *t) || (group->group_specific_query_retransmit_count > 0)) { group_retransmit_timer_on(group); } - - return 0; } /* diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index f4ddc1bf6..68f77ad6d 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -930,12 +930,12 @@ int pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS) return 0; } -static int pim_mlag_register_handler(struct thread *thread) +static void pim_mlag_register_handler(struct thread *thread) { uint32_t bit_mask = 0; if (!zclient) - return -1; + return; SET_FLAG(bit_mask, (1 << MLAG_STATUS_UPDATE)); SET_FLAG(bit_mask, (1 << MLAG_MROUTE_ADD)); @@ -952,7 +952,6 @@ static int pim_mlag_register_handler(struct thread *thread) __func__, bit_mask); zclient_send_mlag_register(zclient, bit_mask); - return 0; } void pim_mlag_register(void) @@ -966,17 +965,16 @@ void pim_mlag_register(void) NULL); } -static int pim_mlag_deregister_handler(struct thread *thread) +static void pim_mlag_deregister_handler(struct thread *thread) { if (!zclient) - return -1; + return; if (PIM_DEBUG_MLAG) zlog_debug("%s: Posting Client De-Register to MLAG from PIM", __func__); router->connected_to_mlag = false; zclient_send_mlag_deregister(zclient); - return 0; } void pim_mlag_deregister(void) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 91b997f44..cf9127bc9 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -677,12 +677,11 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf, return 0; } -static int mroute_read(struct thread *t) +static void mroute_read(struct thread *t) { struct pim_instance *pim; static long long count; char buf[10000]; - int result = 0; int cont = 1; int rd; ifindex_t ifindex; @@ -705,7 +704,7 @@ static int mroute_read(struct thread *t) goto done; } - result = pim_mroute_msg(pim, buf, rd, ifindex); + pim_mroute_msg(pim, buf, rd, ifindex); count++; if (count % router->packet_process == 0) @@ -714,8 +713,6 @@ static int mroute_read(struct thread *t) /* Keep reading */ done: mroute_read_on(pim); - - return result; } static void mroute_read_on(struct pim_instance *pim) diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index eb89040d4..7c1c80f71 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -66,7 +66,7 @@ static void pim_msdp_sa_timer_expiry_log(struct pim_msdp_sa *sa, } /* RFC-3618:Sec-5.1 - global active source advertisement timer */ -static int pim_msdp_sa_adv_timer_cb(struct thread *t) +static void pim_msdp_sa_adv_timer_cb(struct thread *t) { struct pim_instance *pim = THREAD_ARG(t); @@ -76,8 +76,8 @@ static int pim_msdp_sa_adv_timer_cb(struct thread *t) pim_msdp_sa_adv_timer_setup(pim, true /* start */); pim_msdp_pkt_sa_tx(pim); - return 0; } + static void pim_msdp_sa_adv_timer_setup(struct pim_instance *pim, bool start) { THREAD_OFF(pim->msdp.sa_adv_timer); @@ -89,7 +89,7 @@ static void pim_msdp_sa_adv_timer_setup(struct pim_instance *pim, bool start) } /* RFC-3618:Sec-5.3 - SA cache state timer */ -static int pim_msdp_sa_state_timer_cb(struct thread *t) +static void pim_msdp_sa_state_timer_cb(struct thread *t) { struct pim_msdp_sa *sa; @@ -100,8 +100,8 @@ static int pim_msdp_sa_state_timer_cb(struct thread *t) } pim_msdp_sa_deref(sa, PIM_MSDP_SAF_PEER); - return 0; } + static void pim_msdp_sa_state_timer_setup(struct pim_msdp_sa *sa, bool start) { THREAD_OFF(sa->sa_state_timer); @@ -873,7 +873,7 @@ static void pim_msdp_peer_timer_expiry_log(struct pim_msdp_peer *mp, } /* RFC-3618:Sec-5.4 - peer hold timer */ -static int pim_msdp_peer_hold_timer_cb(struct thread *t) +static void pim_msdp_peer_hold_timer_cb(struct thread *t) { struct pim_msdp_peer *mp; @@ -884,14 +884,13 @@ static int pim_msdp_peer_hold_timer_cb(struct thread *t) } if (mp->state != PIM_MSDP_ESTABLISHED) { - return 0; + return; } if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_state_chg_log(mp); } pim_msdp_peer_reset_tcp_conn(mp, "ht-expired"); - return 0; } static void pim_msdp_peer_hold_timer_setup(struct pim_msdp_peer *mp, bool start) @@ -906,7 +905,7 @@ static void pim_msdp_peer_hold_timer_setup(struct pim_msdp_peer *mp, bool start) /* RFC-3618:Sec-5.5 - peer keepalive timer */ -static int pim_msdp_peer_ka_timer_cb(struct thread *t) +static void pim_msdp_peer_ka_timer_cb(struct thread *t) { struct pim_msdp_peer *mp; @@ -918,8 +917,8 @@ static int pim_msdp_peer_ka_timer_cb(struct thread *t) pim_msdp_pkt_ka_tx(mp); pim_msdp_peer_ka_timer_setup(mp, true /* start */); - return 0; } + static void pim_msdp_peer_ka_timer_setup(struct pim_msdp_peer *mp, bool start) { THREAD_OFF(mp->ka_timer); @@ -967,7 +966,7 @@ static void pim_msdp_peer_active_connect(struct pim_msdp_peer *mp) } /* RFC-3618:Sec-5.6 - connection retry on active peer */ -static int pim_msdp_peer_cr_timer_cb(struct thread *t) +static void pim_msdp_peer_cr_timer_cb(struct thread *t) { struct pim_msdp_peer *mp; @@ -978,12 +977,12 @@ static int pim_msdp_peer_cr_timer_cb(struct thread *t) } if (mp->state != PIM_MSDP_CONNECTING || PIM_MSDP_PEER_IS_LISTENER(mp)) { - return 0; + return; } pim_msdp_peer_active_connect(mp); - return 0; } + static void pim_msdp_peer_cr_timer_setup(struct pim_msdp_peer *mp, bool start) { THREAD_OFF(mp->cr_timer); diff --git a/pimd/pim_msdp.h b/pimd/pim_msdp.h index d2501adc4..4e1114aff 100644 --- a/pimd/pim_msdp.h +++ b/pimd/pim_msdp.h @@ -240,7 +240,7 @@ void pim_msdp_peer_established(struct pim_msdp_peer *mp); void pim_msdp_peer_pkt_rxed(struct pim_msdp_peer *mp); void pim_msdp_peer_stop_tcp_conn(struct pim_msdp_peer *mp, bool chg_state); void pim_msdp_peer_reset_tcp_conn(struct pim_msdp_peer *mp, const char *rc_str); -int pim_msdp_write(struct thread *thread); +void pim_msdp_write(struct thread *thread); int pim_msdp_config_write(struct pim_instance *pim, struct vty *vty, const char *spaces); bool pim_msdp_peer_config_write(struct vty *vty, struct pim_instance *pim, diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c index 395bbf6f2..03284ffa5 100644 --- a/pimd/pim_msdp_packet.c +++ b/pimd/pim_msdp_packet.c @@ -182,7 +182,7 @@ static void pim_msdp_write_proceed_actions(struct pim_msdp_peer *mp) } } -int pim_msdp_write(struct thread *thread) +void pim_msdp_write(struct thread *thread) { struct pim_msdp_peer *mp; struct stream *s; @@ -199,19 +199,19 @@ int pim_msdp_write(struct thread *thread) zlog_debug("MSDP peer %s pim_msdp_write", mp->key_str); } if (mp->fd < 0) { - return -1; + return; } /* check if TCP connection is established */ if (mp->state != PIM_MSDP_ESTABLISHED) { pim_msdp_connect_check(mp); - return 0; + return; } s = stream_fifo_head(mp->obuf); if (!s) { pim_msdp_write_proceed_actions(mp); - return 0; + return; } sockopt_cork(mp->fd, 1); @@ -237,7 +237,7 @@ int pim_msdp_write(struct thread *thread) } pim_msdp_peer_reset_tcp_conn(mp, "pkt-tx-failed"); - return 0; + return; } if (num != writenum) { @@ -286,8 +286,6 @@ int pim_msdp_write(struct thread *thread) zlog_debug("MSDP peer %s pim_msdp_write wrote %d packets", mp->key_str, work_cnt); } - - return 0; } static void pim_msdp_pkt_send(struct pim_msdp_peer *mp, struct stream *s) @@ -674,7 +672,7 @@ static int pim_msdp_read_packet(struct pim_msdp_peer *mp) return 0; } -int pim_msdp_read(struct thread *thread) +void pim_msdp_read(struct thread *thread) { struct pim_msdp_peer *mp; int rc; @@ -688,13 +686,13 @@ int pim_msdp_read(struct thread *thread) } if (mp->fd < 0) { - return -1; + return; } /* check if TCP connection is established */ if (mp->state != PIM_MSDP_ESTABLISHED) { pim_msdp_connect_check(mp); - return 0; + return; } PIM_MSDP_PEER_READ_ON(mp); @@ -706,32 +704,27 @@ int pim_msdp_read(struct thread *thread) if (stream_get_endp(mp->ibuf) < PIM_MSDP_HEADER_SIZE) { /* start by reading the TLV header */ rc = pim_msdp_read_packet(mp); - if (rc < 0) { - goto pim_msdp_read_end; - } + if (rc < 0) + return; /* Find TLV type and len */ stream_getc(mp->ibuf); len = stream_getw(mp->ibuf); if (len < PIM_MSDP_HEADER_SIZE) { pim_msdp_pkt_rxed_with_fatal_error(mp); - goto pim_msdp_read_end; + return; } /* read complete TLV */ mp->packet_size = len; } rc = pim_msdp_read_packet(mp); - if (rc < 0) { - goto pim_msdp_read_end; - } + if (rc < 0) + return; pim_msdp_pkt_rx(mp); /* reset input buffers and get ready for the next packet */ mp->packet_size = 0; stream_reset(mp->ibuf); - -pim_msdp_read_end: - return 0; } diff --git a/pimd/pim_msdp_packet.h b/pimd/pim_msdp_packet.h index e2c4b0e6b..00324a291 100644 --- a/pimd/pim_msdp_packet.h +++ b/pimd/pim_msdp_packet.h @@ -64,7 +64,7 @@ #define PIM_MSDP_PKT_TYPE_STRLEN 16 void pim_msdp_pkt_ka_tx(struct pim_msdp_peer *mp); -int pim_msdp_read(struct thread *thread); +void pim_msdp_read(struct thread *thread); void pim_msdp_pkt_sa_tx(struct pim_instance *pim); void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa); void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp); diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index 5fff9fca0..facb771c2 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -62,7 +62,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) } /* passive peer socket accept */ -static int pim_msdp_sock_accept(struct thread *thread) +static void pim_msdp_sock_accept(struct thread *thread) { union sockunion su; struct pim_instance *pim = THREAD_ARG(thread); @@ -77,7 +77,7 @@ static int pim_msdp_sock_accept(struct thread *thread) if (accept_sock < 0) { flog_err(EC_LIB_DEVELOPMENT, "accept_sock is negative value %d", accept_sock); - return -1; + return; } pim->msdp.listener.thread = NULL; thread_add_read(router->master, pim_msdp_sock_accept, pim, accept_sock, @@ -88,7 +88,7 @@ static int pim_msdp_sock_accept(struct thread *thread) if (msdp_sock < 0) { flog_err_sys(EC_LIB_SOCKET, "pim_msdp_sock_accept failed (%s)", safe_strerror(errno)); - return -1; + return; } /* see if have peer config for this */ @@ -100,7 +100,7 @@ static int pim_msdp_sock_accept(struct thread *thread) "msdp peer connection refused from %pSU", &su); } close(msdp_sock); - return -1; + return; } if (PIM_DEBUG_MSDP_INTERNAL) { @@ -122,7 +122,6 @@ static int pim_msdp_sock_accept(struct thread *thread) set_nonblocking(mp->fd); pim_msdp_update_sock_send_buffer_size(mp->fd); pim_msdp_peer_established(mp); - return 0; } /* global listener for the MSDP well know TCP port */ diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 6e3d2739e..84b532d34 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -200,7 +200,7 @@ static void update_dr_priority(struct pim_neighbor *neigh, } } -static int on_neighbor_timer(struct thread *t) +static void on_neighbor_timer(struct thread *t) { struct pim_neighbor *neigh; struct interface *ifp; @@ -226,8 +226,6 @@ static int on_neighbor_timer(struct thread *t) router's own DR Priority changes. */ pim_if_dr_election(ifp); // neighbor times out - - return 0; } void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) @@ -252,7 +250,7 @@ void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) neigh->holdtime, &neigh->t_expire_timer); } -static int on_neighbor_jp_timer(struct thread *t) +static void on_neighbor_jp_timer(struct thread *t) { struct pim_neighbor *neigh = THREAD_ARG(t); struct pim_rpf rpf; @@ -269,8 +267,6 @@ static int on_neighbor_jp_timer(struct thread *t) thread_add_timer(router->master, on_neighbor_jp_timer, neigh, router->t_periodic, &neigh->jp_timer); - - return 0; } static void pim_neighbor_start_jp_timer(struct pim_neighbor *neigh) diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 93ccfd78d..5cc0d63e3 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -42,7 +42,7 @@ #include "pim_errors.h" #include "pim_bsm.h" -static int on_pim_hello_send(struct thread *t); +static void on_pim_hello_send(struct thread *t); static const char *pim_pim_msgtype2str(enum pim_msg_type type) { @@ -326,7 +326,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len) static void pim_sock_read_on(struct interface *ifp); -static int pim_sock_read(struct thread *t) +static void pim_sock_read(struct thread *t) { struct interface *ifp, *orig_ifp; struct pim_interface *pim_ifp; @@ -398,8 +398,6 @@ done: if (result) { ++pim_ifp->pim_ifstat_hello_recvfail; } - - return result; } static void pim_sock_read_on(struct interface *ifp) @@ -745,7 +743,7 @@ static void hello_resched(struct interface *ifp) /* Periodic hello timer */ -static int on_pim_hello_send(struct thread *t) +static void on_pim_hello_send(struct thread *t) { struct pim_interface *pim_ifp; struct interface *ifp; @@ -761,7 +759,7 @@ static int on_pim_hello_send(struct thread *t) /* * Send hello */ - return pim_hello_send(ifp, PIM_IF_DEFAULT_HOLDTIME(pim_ifp)); + pim_hello_send(ifp, PIM_IF_DEFAULT_HOLDTIME(pim_ifp)); } /* diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index abd95e648..596b06cb3 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -315,19 +315,16 @@ static int ssmpingd_read_msg(struct ssmpingd_sock *ss) return 0; } -static int ssmpingd_sock_read(struct thread *t) +static void ssmpingd_sock_read(struct thread *t) { struct ssmpingd_sock *ss; - int result; ss = THREAD_ARG(t); - result = ssmpingd_read_msg(ss); + ssmpingd_read_msg(ss); /* Keep reading */ ssmpingd_read_on(ss); - - return result; } static void ssmpingd_read_on(struct ssmpingd_sock *ss) diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index a410a1c2c..ae6282316 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -302,7 +302,7 @@ void pim_upstream_send_join(struct pim_upstream *up) pim_jp_agg_single_upstream_send(&up->rpf, up, 1 /* join */); } -static int on_join_timer(struct thread *t) +static void on_join_timer(struct thread *t) { struct pim_upstream *up; @@ -312,14 +312,14 @@ static int on_join_timer(struct thread *t) if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: up %s RPF is not present", __func__, up->sg_str); - return 0; + return; } /* * In the case of a HFR we will not ahve anyone to send this to. */ if (PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) - return 0; + return; /* * Don't send the join if the outgoing interface is a loopback @@ -330,8 +330,6 @@ static int on_join_timer(struct thread *t) pim_upstream_send_join(up); join_timer_start(up); - - return 0; } static void join_timer_stop(struct pim_upstream *up) @@ -1482,7 +1480,7 @@ struct pim_upstream *pim_upstream_keep_alive_timer_proc( return up; } -static int pim_upstream_keep_alive_timer(struct thread *t) +static void pim_upstream_keep_alive_timer(struct thread *t) { struct pim_upstream *up; @@ -1491,10 +1489,9 @@ static int pim_upstream_keep_alive_timer(struct thread *t) /* pull the stats and re-check */ if (pim_upstream_sg_running_proc(up)) /* kat was restarted because of new activity */ - return 0; + return; pim_upstream_keep_alive_timer_proc(up); - return 0; } void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) @@ -1516,15 +1513,15 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) } /* MSDP on RP needs to know if a source is registerable to this RP */ -static int pim_upstream_msdp_reg_timer(struct thread *t) +static void pim_upstream_msdp_reg_timer(struct thread *t) { struct pim_upstream *up = THREAD_ARG(t); struct pim_instance *pim = up->channel_oil->pim; /* source is no longer active - pull the SA from MSDP's cache */ pim_msdp_sa_local_del(pim, &up->sg); - return 1; } + void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up) { THREAD_OFF(up->t_msdp_reg_timer); @@ -1702,7 +1699,7 @@ const char *pim_reg_state2str(enum pim_reg_state reg_state, char *state_str, return state_str; } -static int pim_upstream_register_stop_timer(struct thread *t) +static void pim_upstream_register_stop_timer(struct thread *t) { struct pim_interface *pim_ifp; struct pim_instance *pim; @@ -1735,7 +1732,7 @@ static int pim_upstream_register_stop_timer(struct thread *t) zlog_debug("%s: up %s RPF is not present", __func__, up->sg_str); up->reg_state = PIM_REG_NOINFO; - return 0; + return; } pim_ifp = up->rpf.source_nexthop.interface->info; @@ -1745,7 +1742,7 @@ static int pim_upstream_register_stop_timer(struct thread *t) "%s: Interface: %s is not configured for pim", __func__, up->rpf.source_nexthop.interface->name); - return 0; + return; } up->reg_state = PIM_REG_JOIN_PENDING; pim_upstream_start_register_stop_timer(up, 1); @@ -1757,15 +1754,13 @@ static int pim_upstream_register_stop_timer(struct thread *t) zlog_debug( "%s: Stop sending the register, because I am the RP and we haven't seen a packet in a while", __func__); - return 0; + return; } pim_null_register_send(up); break; case PIM_REG_NOINFO: break; } - - return 0; } void pim_upstream_start_register_stop_timer(struct pim_upstream *up, diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 39a1a32a5..5e55b9f9c 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -184,11 +184,10 @@ void pim_vxlan_update_sg_reg_state(struct pim_instance *pim, pim_vxlan_del_work(vxlan_sg); } -static int pim_vxlan_work_timer_cb(struct thread *t) +static void pim_vxlan_work_timer_cb(struct thread *t) { pim_vxlan_do_reg_work(); pim_vxlan_work_timer_setup(true /* start */); - return 0; } /* global 1second timer used for periodic processing */ diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 11b13db31..8be930aeb 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -382,7 +382,7 @@ void pim_scan_oil(struct pim_instance *pim) pim_upstream_mroute_iif_update(c_oil, __func__); } -static int on_rpf_cache_refresh(struct thread *t) +static void on_rpf_cache_refresh(struct thread *t) { struct pim_instance *pim = THREAD_ARG(t); @@ -394,7 +394,6 @@ static int on_rpf_cache_refresh(struct thread *t) // It is called as part of pim_neighbor_add // pim_rp_setup (); - return 0; } void sched_rpf_cache_refresh(struct pim_instance *pim) diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index b169335a3..3cdf596ae 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -41,17 +41,17 @@ static struct zclient *zlookup = NULL; struct thread *zlookup_read; static void zclient_lookup_sched(struct zclient *zlookup, int delay); -static int zclient_lookup_read_pipe(struct thread *thread); +static void zclient_lookup_read_pipe(struct thread *thread); /* Connect to zebra for nexthop lookup. */ -static int zclient_lookup_connect(struct thread *t) +static void zclient_lookup_connect(struct thread *t) { struct zclient *zlookup; zlookup = THREAD_ARG(t); if (zlookup->sock >= 0) { - return 0; + return; } if (zclient_socket_connect(zlookup) < 0) { @@ -73,12 +73,11 @@ static int zclient_lookup_connect(struct thread *t) if (zlookup->sock < 0) { /* Since last connect failed, retry within 10 secs */ zclient_lookup_sched(zlookup, 10); - return -1; + return; } thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, &zlookup_read); - return 0; } /* Schedule connection with delay. */ @@ -381,7 +380,7 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, return zclient_read_nexthop(pim, zlookup, nexthop_tab, tab_size, addr); } -int zclient_lookup_read_pipe(struct thread *thread) +void zclient_lookup_read_pipe(struct thread *thread) { struct zclient *zlookup = THREAD_ARG(thread); struct pim_instance *pim = pim_get_pim_instance(VRF_DEFAULT); @@ -391,8 +390,6 @@ int zclient_lookup_read_pipe(struct thread *thread) zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l); thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, &zlookup_read); - - return 1; } int zclient_lookup_nexthop(struct pim_instance *pim, diff --git a/pimd/pim_zpthread.c b/pimd/pim_zpthread.c index 518b02474..a34293108 100644 --- a/pimd/pim_zpthread.c +++ b/pimd/pim_zpthread.c @@ -140,7 +140,7 @@ static void pim_mlag_zebra_check_for_buffer_flush(uint32_t curr_msg_type, * Thsi thread reads the clients data from the Gloabl queue and encodes with * protobuf and pass on to the MLAG socket. */ -static int pim_mlag_zthread_handler(struct thread *event) +static void pim_mlag_zthread_handler(struct thread *event) { struct stream *read_s; uint32_t wr_count = 0; @@ -155,7 +155,7 @@ static int pim_mlag_zthread_handler(struct thread *event) __func__, wr_count); if (wr_count == 0) - return 0; + return; for (wr_count = 0; wr_count < PIM_MLAG_POST_LIMIT; wr_count++) { /* FIFO is empty,wait for teh message to be add */ @@ -207,8 +207,6 @@ stream_failure: if (wr_count >= PIM_MLAG_POST_LIMIT) pim_mlag_signal_zpthread(); - - return 0; } diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 8fd64f287..1269f25b3 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -789,7 +789,7 @@ int rip_enable_if_delete(struct rip *rip, const char *ifname) } /* Join to multicast group and send request to the interface. */ -static int rip_interface_wakeup(struct thread *t) +static void rip_interface_wakeup(struct thread *t) { struct interface *ifp; struct rip_interface *ri; @@ -804,7 +804,7 @@ static int rip_interface_wakeup(struct thread *t) flog_err_sys(EC_LIB_SOCKET, "multicast join failed, interface %s not running", ifp->name); - return 0; + return; } /* Set running flag. */ @@ -812,8 +812,6 @@ static int rip_interface_wakeup(struct thread *t) /* Send RIP request to the interface. */ rip_request_interface(ifp); - - return 0; } static void rip_connect_set(struct interface *ifp, int set) diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 12c4edd43..8febb436e 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -67,15 +67,13 @@ struct rip_peer *rip_peer_lookup_next(struct rip *rip, struct in_addr *addr) } /* RIP peer is timeout. */ -static int rip_peer_timeout(struct thread *t) +static void rip_peer_timeout(struct thread *t) { struct rip_peer *peer; peer = THREAD_ARG(t); listnode_delete(peer->rip->peer_list, peer); rip_peer_free(peer); - - return 0; } /* Get RIP peer. At the same time update timeout thread. */ diff --git a/ripd/ripd.c b/ripd/ripd.c index 8bfb20030..2a05f30bc 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -65,7 +65,7 @@ DEFINE_MTYPE_STATIC(RIPD, RIP_DISTANCE, "RIP distance"); /* Prototypes. */ static void rip_output_process(struct connected *, struct sockaddr_in *, int, uint8_t); -static int rip_triggered_update(struct thread *); +static void rip_triggered_update(struct thread *); static int rip_update_jitter(unsigned long); static void rip_distance_table_node_cleanup(struct route_table *table, struct route_node *node); @@ -136,7 +136,7 @@ struct rip *rip_info_get_instance(const struct rip_info *rinfo) } /* RIP route garbage collect timer. */ -static int rip_garbage_collect(struct thread *t) +static void rip_garbage_collect(struct thread *t) { struct rip_info *rinfo; struct route_node *rp; @@ -158,8 +158,6 @@ static int rip_garbage_collect(struct thread *t) /* Free RIP routing information. */ rip_info_free(rinfo); - - return 0; } static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo); @@ -304,14 +302,12 @@ struct rip_info *rip_ecmp_delete(struct rip *rip, struct rip_info *rinfo) } /* Timeout RIP routes. */ -static int rip_timeout(struct thread *t) +static void rip_timeout(struct thread *t) { struct rip_info *rinfo = THREAD_ARG(t); struct rip *rip = rip_info_get_instance(rinfo); rip_ecmp_delete(rip, rinfo); - - return 0; } static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo) @@ -1718,7 +1714,7 @@ static void rip_request_process(struct rip_packet *packet, int size, } /* First entry point of RIP packet. */ -static int rip_read(struct thread *t) +static void rip_read(struct thread *t) { struct rip *rip = THREAD_ARG(t); int sock; @@ -1750,7 +1746,7 @@ static int rip_read(struct thread *t) if (len < 0) { zlog_info("recvfrom failed (VRF %s): %s", rip->vrf_name, safe_strerror(errno)); - return len; + return; } /* Check is this packet comming from myself? */ @@ -1758,7 +1754,7 @@ static int rip_read(struct thread *t) if (IS_RIP_DEBUG_PACKET) zlog_debug("ignore packet comes from myself (VRF %s)", rip->vrf_name); - return -1; + return; } /* Which interface is this packet comes from. */ @@ -1779,7 +1775,7 @@ static int rip_read(struct thread *t) "rip_read: cannot find interface for packet from %pI4 port %d (VRF %s)", &from.sin_addr, ntohs(from.sin_port), rip->vrf_name); - return -1; + return; } p.family = AF_INET; @@ -1793,7 +1789,7 @@ static int rip_read(struct thread *t) "rip_read: cannot find connected address for packet from %pI4 port %d on interface %s (VRF %s)", &from.sin_addr, ntohs(from.sin_port), ifp->name, rip->vrf_name); - return -1; + return; } /* Packet length check. */ @@ -1801,13 +1797,13 @@ static int rip_read(struct thread *t) zlog_warn("packet size %d is smaller than minimum size %d", len, RIP_PACKET_MINSIZ); rip_peer_bad_packet(rip, &from); - return len; + return; } if (len > RIP_PACKET_MAXSIZ) { zlog_warn("packet size %d is larger than max size %d", len, RIP_PACKET_MAXSIZ); rip_peer_bad_packet(rip, &from); - return len; + return; } /* Packet alignment check. */ @@ -1815,7 +1811,7 @@ static int rip_read(struct thread *t) zlog_warn("packet size %d is wrong for RIP packet alignment", len); rip_peer_bad_packet(rip, &from); - return len; + return; } /* Set RTE number. */ @@ -1829,7 +1825,7 @@ static int rip_read(struct thread *t) zlog_info("version 0 with command %d received.", packet->command); rip_peer_bad_packet(rip, &from); - return -1; + return; } /* Dump RIP packet. */ @@ -1850,7 +1846,7 @@ static int rip_read(struct thread *t) zlog_debug("RIP is not enabled on interface %s.", ifp->name); rip_peer_bad_packet(rip, &from); - return -1; + return; } /* RIP Version check. RFC2453, 4.6 and 5.1 */ @@ -1864,7 +1860,7 @@ static int rip_read(struct thread *t) " packet's v%d doesn't fit to if version spec", packet->version); rip_peer_bad_packet(rip, &from); - return -1; + return; } /* RFC2453 5.2 If the router is not configured to authenticate RIP-2 @@ -1879,7 +1875,7 @@ static int rip_read(struct thread *t) packet->version); ripd_notif_send_auth_type_failure(ifp->name); rip_peer_bad_packet(rip, &from); - return -1; + return; } /* RFC: @@ -1915,7 +1911,7 @@ static int rip_read(struct thread *t) "RIPv1 dropped because authentication enabled"); ripd_notif_send_auth_type_failure(ifp->name); rip_peer_bad_packet(rip, &from); - return -1; + return; } } else if (ri->auth_type != RIP_NO_AUTH) { const char *auth_desc; @@ -1928,7 +1924,7 @@ static int rip_read(struct thread *t) "RIPv2 authentication failed: no auth RTE in packet"); ripd_notif_send_auth_type_failure(ifp->name); rip_peer_bad_packet(rip, &from); - return -1; + return; } /* First RTE must be an Authentication Family RTE */ @@ -1938,7 +1934,7 @@ static int rip_read(struct thread *t) "RIPv2 dropped because authentication enabled"); ripd_notif_send_auth_type_failure(ifp->name); rip_peer_bad_packet(rip, &from); - return -1; + return; } /* Check RIPv2 authentication. */ @@ -1974,7 +1970,7 @@ static int rip_read(struct thread *t) auth_desc); ripd_notif_send_auth_failure(ifp->name); rip_peer_bad_packet(rip, &from); - return -1; + return; } } @@ -2004,8 +2000,6 @@ static int rip_read(struct thread *t) rip_peer_bad_packet(rip, &from); break; } - - return len; } /* Write routing table entry to the stream and return next index of @@ -2501,7 +2495,7 @@ static void rip_update_process(struct rip *rip, int route_type) } /* RIP's periodical timer. */ -static int rip_update(struct thread *t) +static void rip_update(struct thread *t) { struct rip *rip = THREAD_ARG(t); @@ -2518,8 +2512,6 @@ static int rip_update(struct thread *t) /* Register myself. */ rip_event(rip, RIP_UPDATE_EVENT, 0); - - return 0; } /* Walk down the RIP routing table then clear changed flag. */ @@ -2545,7 +2537,7 @@ static void rip_clear_changed_flag(struct rip *rip) } /* Triggered update interval timer. */ -static int rip_triggered_interval(struct thread *t) +static void rip_triggered_interval(struct thread *t) { struct rip *rip = THREAD_ARG(t); @@ -2553,11 +2545,10 @@ static int rip_triggered_interval(struct thread *t) rip->trigger = 0; rip_triggered_update(t); } - return 0; } /* Execute triggered update. */ -static int rip_triggered_update(struct thread *t) +static void rip_triggered_update(struct thread *t) { struct rip *rip = THREAD_ARG(t); int interval; @@ -2586,8 +2577,6 @@ static int rip_triggered_update(struct thread *t) thread_add_timer(master, rip_triggered_interval, rip, interval, &rip->t_triggered_interval); - - return 0; } /* Withdraw redistributed route. */ diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index a6d379fda..57bc40f00 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -601,7 +601,7 @@ int ripng_enable_if_delete(struct ripng *ripng, const char *ifname) } /* Wake up interface. */ -static int ripng_interface_wakeup(struct thread *t) +static void ripng_interface_wakeup(struct thread *t) { struct interface *ifp; struct ripng_interface *ri; @@ -616,7 +616,7 @@ static int ripng_interface_wakeup(struct thread *t) flog_err_sys(EC_LIB_SOCKET, "multicast join failed, interface %s not running", ifp->name); - return 0; + return; } /* Set running flag. */ @@ -624,8 +624,6 @@ static int ripng_interface_wakeup(struct thread *t) /* Send RIP request to the interface. */ ripng_request(ifp); - - return 0; } static void ripng_connect_set(struct interface *ifp, int set) diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 554b1d68f..010fdda89 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -75,15 +75,13 @@ struct ripng_peer *ripng_peer_lookup_next(struct ripng *ripng, /* RIPng peer is timeout. * Garbage collector. **/ -static int ripng_peer_timeout(struct thread *t) +static void ripng_peer_timeout(struct thread *t) { struct ripng_peer *peer; peer = THREAD_ARG(t); listnode_delete(peer->ripng->peer_list, peer); ripng_peer_free(peer); - - return 0; } /* Get RIPng peer. At the same time update timeout thread. */ diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 27cffd432..e103cdc3a 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -61,7 +61,7 @@ void ripng_output_process(struct interface *, struct sockaddr_in6 *, int); static void ripng_instance_enable(struct ripng *ripng, struct vrf *vrf, int sock); static void ripng_instance_disable(struct ripng *ripng); -int ripng_triggered_update(struct thread *); +static void ripng_triggered_update(struct thread *); static void ripng_if_rmap_update(struct if_rmap_ctx *ctx, struct if_rmap *if_rmap); @@ -423,7 +423,7 @@ static int ripng_lladdr_check(struct interface *ifp, struct in6_addr *addr) } /* RIPng route garbage collect timer. */ -static int ripng_garbage_collect(struct thread *t) +static void ripng_garbage_collect(struct thread *t) { struct ripng_info *rinfo; struct agg_node *rp; @@ -445,8 +445,6 @@ static int ripng_garbage_collect(struct thread *t) /* Free RIPng routing information. */ ripng_info_free(rinfo); - - return 0; } static void ripng_timeout_update(struct ripng *ripng, struct ripng_info *rinfo); @@ -602,14 +600,12 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng, } /* Timeout RIPng routes. */ -static int ripng_timeout(struct thread *t) +static void ripng_timeout(struct thread *t) { struct ripng_info *rinfo = THREAD_ARG(t); struct ripng *ripng = ripng_info_get_instance(rinfo); ripng_ecmp_delete(ripng, rinfo); - - return 0; } static void ripng_timeout_update(struct ripng *ripng, struct ripng_info *rinfo) @@ -1301,7 +1297,7 @@ static void ripng_request_process(struct ripng_packet *packet, int size, } /* First entry point of reading RIPng packet. */ -static int ripng_read(struct thread *thread) +static void ripng_read(struct thread *thread) { struct ripng *ripng = THREAD_ARG(thread); int len; @@ -1330,7 +1326,7 @@ static int ripng_read(struct thread *thread) if (len < 0) { zlog_warn("RIPng recvfrom failed (VRF %s): %s.", ripng->vrf_name, safe_strerror(errno)); - return len; + return; } /* Check RTE boundary. RTE size (Packet length - RIPng header size @@ -1339,7 +1335,7 @@ static int ripng_read(struct thread *thread) zlog_warn("RIPng invalid packet size %d from %pI6 (VRF %s)", len, &from.sin6_addr, ripng->vrf_name); ripng_peer_bad_packet(ripng, &from); - return 0; + return; } packet = (struct ripng_packet *)STREAM_DATA(ripng->ibuf); @@ -1361,7 +1357,7 @@ static int ripng_read(struct thread *thread) zlog_warn( "RIPng packet comes from unknown interface %d (VRF %s)", ifindex, ripng->vrf_name); - return 0; + return; } /* Packet version mismatch checking. */ @@ -1370,7 +1366,7 @@ static int ripng_read(struct thread *thread) "RIPng packet version %d doesn't fit to my version %d (VRF %s)", packet->version, ripng->version, ripng->vrf_name); ripng_peer_bad_packet(ripng, &from); - return 0; + return; } /* Process RIPng packet. */ @@ -1387,7 +1383,6 @@ static int ripng_read(struct thread *thread) ripng_peer_bad_packet(ripng, &from); break; } - return 0; } /* Walk down the RIPng routing table then clear changed flag. */ @@ -1410,7 +1405,7 @@ static void ripng_clear_changed_flag(struct ripng *ripng) /* Regular update of RIPng route. Send all routing formation to RIPng enabled interface. */ -static int ripng_update(struct thread *t) +static void ripng_update(struct thread *t) { struct ripng *ripng = THREAD_ARG(t); struct interface *ifp; @@ -1455,12 +1450,10 @@ static int ripng_update(struct thread *t) /* Reset flush event. */ ripng_event(ripng, RIPNG_UPDATE_EVENT, 0); - - return 0; } /* Triggered update interval timer. */ -static int ripng_triggered_interval(struct thread *t) +static void ripng_triggered_interval(struct thread *t) { struct ripng *ripng = THREAD_ARG(t); @@ -1468,11 +1461,10 @@ static int ripng_triggered_interval(struct thread *t) ripng->trigger = 0; ripng_triggered_update(t); } - return 0; } /* Execute triggered update. */ -int ripng_triggered_update(struct thread *t) +void ripng_triggered_update(struct thread *t) { struct ripng *ripng = THREAD_ARG(t); struct interface *ifp; @@ -1518,8 +1510,6 @@ int ripng_triggered_update(struct thread *t) thread_add_timer(master, ripng_triggered_interval, ripng, interval, &ripng->t_triggered_interval); - - return 0; } /* Write routing table entry to the stream and return next index of diff --git a/sharpd/sharp_logpump.c b/sharpd/sharp_logpump.c index 322d802b8..ad1051f22 100644 --- a/sharpd/sharp_logpump.c +++ b/sharpd/sharp_logpump.c @@ -43,7 +43,7 @@ static struct vty *lp_vty; extern struct thread_master *master; -static int logpump_done(struct thread *thread) +static void logpump_done(struct thread *thread) { double x; @@ -67,7 +67,6 @@ static int logpump_done(struct thread *thread) frr_pthread_stop(lpt, NULL); frr_pthread_destroy(lpt); lpt = NULL; - return 0; } static void *logpump_run(void *arg) diff --git a/tests/helpers/c/main.c b/tests/helpers/c/main.c index 64ecab913..ca6b18ecd 100644 --- a/tests/helpers/c/main.c +++ b/tests/helpers/c/main.c @@ -47,13 +47,12 @@ DEFUN (daemon_exit, } static int timer_count; -static int test_timer(struct thread *thread) +static void test_timer(struct thread *thread) { int *count = THREAD_ARG(thread); printf("run %d of timer\n", (*count)++); thread_add_timer(master, test_timer, count, 5, NULL); - return 0; } static void test_timer_init(void) diff --git a/tests/lib/test_grpc.cpp b/tests/lib/test_grpc.cpp index 0aa1bbb7e..88372f45a 100644 --- a/tests/lib/test_grpc.cpp +++ b/tests/lib/test_grpc.cpp @@ -79,7 +79,7 @@ static const struct frr_yang_module_info *const staticd_yang_modules[] = { &frr_staticd_info, &frr_vrf_info, }; -static int grpc_thread_stop(struct thread *thread); +static void grpc_thread_stop(struct thread *thread); static void _err_print(const void *cookie, const char *errstr) { @@ -499,7 +499,7 @@ void *grpc_client_test_start(void *arg) return NULL; } -static int grpc_thread_start(struct thread *thread) +static void grpc_thread_start(struct thread *thread) { struct frr_pthread_attr client = { .start = grpc_client_test_start, @@ -509,11 +509,9 @@ static int grpc_thread_start(struct thread *thread) auto pth = frr_pthread_new(&client, "GRPC Client thread", "grpc"); frr_pthread_run(pth, NULL); frr_pthread_wait_running(pth); - - return 0; } -static int grpc_thread_stop(struct thread *thread) +static void grpc_thread_stop(struct thread *thread) { std::cout << __func__ << ": frr_pthread_stop_all" << std::endl; frr_pthread_stop_all(); diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c index d516ed0de..466f9a7d9 100644 --- a/tests/lib/test_heavy_thread.c +++ b/tests/lib/test_heavy_thread.c @@ -70,7 +70,7 @@ static void slow_func(struct vty *vty, const char *str, const int i) printf("%s did %d, x = %g\n", str, i, x); } -static int clear_something(struct thread *thread) +static void clear_something(struct thread *thread) { struct work_state *ws = THREAD_ARG(thread); @@ -84,14 +84,13 @@ static int clear_something(struct thread *thread) if (thread_should_yield(thread)) { thread_add_timer_msec(master, clear_something, ws, 0, NULL); - return 0; + return; } } /* All done! */ XFREE(MTYPE_TMP, ws->str); XFREE(MTYPE_TMP, ws); - return 0; } DEFUN (clear_foo, diff --git a/tests/lib/test_segv.c b/tests/lib/test_segv.c index 494a162a4..92c9f7a2e 100644 --- a/tests/lib/test_segv.c +++ b/tests/lib/test_segv.c @@ -62,10 +62,9 @@ void func3(void) func2(6, buf); } -static int threadfunc(struct thread *thread) +static void threadfunc(struct thread *thread) { func3(); - return 0; } int main(void) diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c index 1756d87a6..4172ca300 100644 --- a/tests/lib/test_timer_correctness.c +++ b/tests/lib/test_timer_correctness.c @@ -76,7 +76,7 @@ static void terminate_test(void) exit(exit_code); } -static int timer_func(struct thread *thread) +static void timer_func(struct thread *thread) { int rv; @@ -90,8 +90,6 @@ static int timer_func(struct thread *thread) timers_pending--; if (!timers_pending) terminate_test(); - - return 0; } static int cmp_timeval(const void *a, const void *b) diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c index f9d634b6a..c1dd07b89 100644 --- a/tests/lib/test_timer_performance.c +++ b/tests/lib/test_timer_performance.c @@ -35,9 +35,8 @@ struct thread_master *master; -static int dummy_func(struct thread *thread) +static void dummy_func(struct thread *thread) { - return 0; } int main(int argc, char **argv) diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index f91803337..dae1e4894 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -681,8 +681,8 @@ struct vrrp_vrouter *vrrp_lookup(const struct interface *ifp, uint8_t vrid) /* Forward decls */ static void vrrp_change_state(struct vrrp_router *r, int to); -static int vrrp_adver_timer_expire(struct thread *thread); -static int vrrp_master_down_timer_expire(struct thread *thread); +static void vrrp_adver_timer_expire(struct thread *thread); +static void vrrp_master_down_timer_expire(struct thread *thread); /* * Finds the first connected address of the appropriate family on a VRRP @@ -983,7 +983,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, /* * Read and process next IPvX datagram. */ -static int vrrp_read(struct thread *thread) +static void vrrp_read(struct thread *thread) { struct vrrp_router *r = thread->arg; @@ -1045,8 +1045,6 @@ done: if (resched) thread_add_read(master, vrrp_read, r, r->sock_rx, &r->t_read); - - return 0; } /* @@ -1480,7 +1478,7 @@ static void vrrp_change_state(struct vrrp_router *r, int to) /* * Called when Adver_Timer expires. */ -static int vrrp_adver_timer_expire(struct thread *thread) +static void vrrp_adver_timer_expire(struct thread *thread) { struct vrrp_router *r = thread->arg; @@ -1503,14 +1501,12 @@ static int vrrp_adver_timer_expire(struct thread *thread) r->vr->vrid, family2str(r->family), vrrp_state_names[r->fsm.state]); } - - return 0; } /* * Called when Master_Down_Timer expires. */ -static int vrrp_master_down_timer_expire(struct thread *thread) +static void vrrp_master_down_timer_expire(struct thread *thread) { struct vrrp_router *r = thread->arg; @@ -1522,8 +1518,6 @@ static int vrrp_master_down_timer_expire(struct thread *thread) r->vr->advertisement_interval * CS2MS, &r->t_adver_timer); vrrp_change_state(r, VRRP_STATE_MASTER); - - return 0; } /* diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 0d9734a75..4f50da380 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -201,7 +201,7 @@ static const struct option longopts[] = { {NULL, 0, NULL, 0}}; static int try_connect(struct daemon *dmn); -static int wakeup_send_echo(struct thread *t_wakeup); +static void wakeup_send_echo(struct thread *t_wakeup); static void try_restart(struct daemon *dmn); static void phase_check(void); static void restart_done(struct daemon *dmn); @@ -350,7 +350,7 @@ static struct timeval *time_elapsed(struct timeval *result, return result; } -static int restart_kill(struct thread *t_kill) +static void restart_kill(struct thread *t_kill) { struct restart_info *restart = THREAD_ARG(t_kill); struct timeval delay; @@ -364,7 +364,6 @@ static int restart_kill(struct thread *t_kill) restart->kills++; thread_add_timer(master, restart_kill, restart, gs.restart_timeout, &restart->t_kill); - return 0; } static struct restart_info *find_child(pid_t child) @@ -546,7 +545,7 @@ static int run_job(struct restart_info *restart, const char *cmdtype, FUZZY(gs.period), &(DMN)->t_wakeup); \ } while (0); -static int wakeup_down(struct thread *t_wakeup) +static void wakeup_down(struct thread *t_wakeup) { struct daemon *dmn = THREAD_ARG(t_wakeup); @@ -555,10 +554,9 @@ static int wakeup_down(struct thread *t_wakeup) SET_WAKEUP_DOWN(dmn); if ((dmn->connect_tries > 1) && (dmn->state != DAEMON_UP)) try_restart(dmn); - return 0; } -static int wakeup_init(struct thread *t_wakeup) +static void wakeup_init(struct thread *t_wakeup) { struct daemon *dmn = THREAD_ARG(t_wakeup); @@ -570,7 +568,6 @@ static int wakeup_init(struct thread *t_wakeup) dmn->state = DAEMON_DOWN; } phase_check(); - return 0; } static void restart_done(struct daemon *dmn) @@ -609,7 +606,7 @@ static void daemon_down(struct daemon *dmn, const char *why) phase_check(); } -static int handle_read(struct thread *t_read) +static void handle_read(struct thread *t_read) { struct daemon *dmn = THREAD_ARG(t_read); static const char resp[sizeof(PING_TOKEN) + 4] = PING_TOKEN "\n"; @@ -624,16 +621,16 @@ static int handle_read(struct thread *t_read) if (ERRNO_IO_RETRY(errno)) { /* Pretend it never happened. */ SET_READ_HANDLER(dmn); - return 0; + return; } snprintf(why, sizeof(why), "unexpected read error: %s", safe_strerror(errno)); daemon_down(dmn, why); - return 0; + return; } if (rc == 0) { daemon_down(dmn, "read returned EOF"); - return 0; + return; } if (!dmn->echo_sent.tv_sec) { char why[sizeof(buf) + 100]; @@ -641,7 +638,7 @@ static int handle_read(struct thread *t_read) "unexpected read returns %d bytes: %.*s", (int)rc, (int)rc, buf); daemon_down(dmn, why); - return 0; + return; } /* We are expecting an echo response: is there any chance that the @@ -653,7 +650,7 @@ static int handle_read(struct thread *t_read) "read returned bad echo response of %d bytes (expecting %u): %.*s", (int)rc, (unsigned int)sizeof(resp), (int)rc, buf); daemon_down(dmn, why); - return 0; + return; } time_elapsed(&delay, &dmn->echo_sent); @@ -677,8 +674,6 @@ static int handle_read(struct thread *t_read) SET_READ_HANDLER(dmn); thread_cancel(&dmn->t_wakeup); SET_WAKEUP_ECHO(dmn); - - return 0; } /* @@ -732,7 +727,7 @@ static void daemon_up(struct daemon *dmn, const char *why) phase_check(); } -static int check_connect(struct thread *t_write) +static void check_connect(struct thread *t_write) { struct daemon *dmn = THREAD_ARG(t_write); int sockerr; @@ -745,7 +740,7 @@ static int check_connect(struct thread *t_write) safe_strerror(errno)); daemon_down(dmn, "getsockopt failed checking connection success"); - return 0; + return; } if ((reslen == sizeof(sockerr)) && sockerr) { char why[100]; @@ -754,14 +749,13 @@ static int check_connect(struct thread *t_write) "getsockopt reports that connection attempt failed: %s", safe_strerror(sockerr)); daemon_down(dmn, why); - return 0; + return; } daemon_up(dmn, "delayed connect succeeded"); - return 0; } -static int wakeup_connect_hanging(struct thread *t_wakeup) +static void wakeup_connect_hanging(struct thread *t_wakeup) { struct daemon *dmn = THREAD_ARG(t_wakeup); char why[100]; @@ -770,7 +764,6 @@ static int wakeup_connect_hanging(struct thread *t_wakeup) snprintf(why, sizeof(why), "connection attempt timed out after %ld seconds", gs.timeout); daemon_down(dmn, why); - return 0; } /* Making connection to protocol daemon. */ @@ -846,14 +839,13 @@ static int try_connect(struct daemon *dmn) return 1; } -static int phase_hanging(struct thread *t_hanging) +static void phase_hanging(struct thread *t_hanging) { gs.t_phase_hanging = NULL; flog_err(EC_WATCHFRR_CONNECTION, "Phase [%s] hanging for %ld seconds, aborting phased restart", phase_str[gs.phase], PHASE_TIMEOUT); gs.phase = PHASE_NONE; - return 0; } static void set_phase(restart_phase_t new_phase) @@ -971,7 +963,7 @@ static void try_restart(struct daemon *dmn) run_job(&gs.restart, "restart", gs.restart_command, 0, 1); } -static int wakeup_unresponsive(struct thread *t_wakeup) +static void wakeup_unresponsive(struct thread *t_wakeup) { struct daemon *dmn = THREAD_ARG(t_wakeup); @@ -984,26 +976,24 @@ static int wakeup_unresponsive(struct thread *t_wakeup) SET_WAKEUP_UNRESPONSIVE(dmn); try_restart(dmn); } - return 0; } -static int wakeup_no_answer(struct thread *t_wakeup) +static void wakeup_no_answer(struct thread *t_wakeup) { struct daemon *dmn = THREAD_ARG(t_wakeup); dmn->t_wakeup = NULL; dmn->state = DAEMON_UNRESPONSIVE; if (dmn->ignore_timeout) - return 0; + return; flog_err(EC_WATCHFRR_CONNECTION, "%s state -> unresponsive : no response yet to ping sent %ld seconds ago", dmn->name, gs.timeout); SET_WAKEUP_UNRESPONSIVE(dmn); try_restart(dmn); - return 0; } -static int wakeup_send_echo(struct thread *t_wakeup) +static void wakeup_send_echo(struct thread *t_wakeup) { static const char echocmd[] = "echo " PING_TOKEN; ssize_t rc; @@ -1022,7 +1012,6 @@ static int wakeup_send_echo(struct thread *t_wakeup) thread_add_timer(master, wakeup_no_answer, dmn, gs.timeout, &dmn->t_wakeup); } - return 0; } bool check_all_up(void) @@ -1099,10 +1088,9 @@ static char *translate_blanks(const char *cmd, const char *blankstr) return res; } -static int startup_timeout(struct thread *t_wakeup) +static void startup_timeout(struct thread *t_wakeup) { daemon_send_ready(1); - return 0; } #ifdef GNU_LINUX diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 3b02128c9..ce3c8d4b1 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -176,16 +176,16 @@ enum fpm_nl_events { /* * Prototypes. */ -static int fpm_process_event(struct thread *t); +static void fpm_process_event(struct thread *t); static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx); -static int fpm_lsp_send(struct thread *t); -static int fpm_lsp_reset(struct thread *t); -static int fpm_nhg_send(struct thread *t); -static int fpm_nhg_reset(struct thread *t); -static int fpm_rib_send(struct thread *t); -static int fpm_rib_reset(struct thread *t); -static int fpm_rmac_send(struct thread *t); -static int fpm_rmac_reset(struct thread *t); +static void fpm_lsp_send(struct thread *t); +static void fpm_lsp_reset(struct thread *t); +static void fpm_nhg_send(struct thread *t); +static void fpm_nhg_reset(struct thread *t); +static void fpm_rib_send(struct thread *t); +static void fpm_rib_reset(struct thread *t); +static void fpm_rmac_send(struct thread *t); +static void fpm_rmac_reset(struct thread *t); /* * CLI. @@ -419,7 +419,7 @@ static struct cmd_node fpm_node = { /* * FPM functions. */ -static int fpm_connect(struct thread *t); +static void fpm_connect(struct thread *t); static void fpm_reconnect(struct fpm_nl_ctx *fnc) { @@ -458,7 +458,7 @@ static void fpm_reconnect(struct fpm_nl_ctx *fnc) &fnc->t_connect); } -static int fpm_read(struct thread *t) +static void fpm_read(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); ssize_t rv; @@ -471,7 +471,7 @@ static int fpm_read(struct thread *t) /* Schedule next read. */ thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, &fnc->t_read); - return 0; + return; } if (rv == 0) { atomic_fetch_add_explicit(&fnc->counters.connection_closes, 1, @@ -481,7 +481,7 @@ static int fpm_read(struct thread *t) zlog_debug("%s: connection closed", __func__); FPM_RECONNECT(fnc); - return 0; + return; } if (rv == -1) { atomic_fetch_add_explicit(&fnc->counters.connection_errors, 1, @@ -489,7 +489,7 @@ static int fpm_read(struct thread *t) zlog_warn("%s: connection failure: %s", __func__, strerror(errno)); FPM_RECONNECT(fnc); - return 0; + return; } stream_reset(fnc->ibuf); @@ -499,11 +499,9 @@ static int fpm_read(struct thread *t) thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, &fnc->t_read); - - return 0; } -static int fpm_write(struct thread *t) +static void fpm_write(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); socklen_t statuslen; @@ -530,7 +528,7 @@ static int fpm_write(struct thread *t) memory_order_relaxed); FPM_RECONNECT(fnc); - return 0; + return; } fnc->connecting = false; @@ -584,7 +582,7 @@ static int fpm_write(struct thread *t) strerror(errno)); FPM_RECONNECT(fnc); - return 0; + return; } /* Account all bytes sent. */ @@ -603,13 +601,11 @@ static int fpm_write(struct thread *t) stream_pulldown(fnc->obuf); thread_add_write(fnc->fthread->master, fpm_write, fnc, fnc->socket, &fnc->t_write); - return 0; + return; } - - return 0; } -static int fpm_connect(struct thread *t) +static void fpm_connect(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); struct sockaddr_in *sin = (struct sockaddr_in *)&fnc->addr; @@ -624,7 +620,7 @@ static int fpm_connect(struct thread *t) strerror(errno)); thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, &fnc->t_connect); - return 0; + return; } set_nonblocking(sock); @@ -650,7 +646,7 @@ static int fpm_connect(struct thread *t) strerror(errno)); thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, &fnc->t_connect); - return 0; + return; } fnc->connecting = (errno == EINPROGRESS); @@ -670,8 +666,6 @@ static int fpm_connect(struct thread *t) if (!fnc->connecting) thread_add_timer(zrouter.master, fpm_lsp_reset, fnc, 0, &fnc->t_lspreset); - - return 0; } /** @@ -893,7 +887,7 @@ static int fpm_lsp_send_cb(struct hash_bucket *bucket, void *arg) return HASHWALK_CONTINUE; } -static int fpm_lsp_send(struct thread *t) +static void fpm_lsp_send(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); @@ -918,8 +912,6 @@ static int fpm_lsp_send(struct thread *t) thread_add_timer(zrouter.master, fpm_lsp_send, fnc, 0, &fnc->t_lspwalk); } - - return 0; } /* @@ -955,7 +947,7 @@ static int fpm_nhg_send_cb(struct hash_bucket *bucket, void *arg) return HASHWALK_CONTINUE; } -static int fpm_nhg_send(struct thread *t) +static void fpm_nhg_send(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); struct fpm_nhg_arg fna; @@ -979,14 +971,12 @@ static int fpm_nhg_send(struct thread *t) } else /* Otherwise reschedule next hop group again. */ thread_add_timer(zrouter.master, fpm_nhg_send, fnc, 0, &fnc->t_nhgwalk); - - return 0; } /** * Send all RIB installed routes to the connected data plane. */ -static int fpm_rib_send(struct thread *t) +static void fpm_rib_send(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); rib_dest_t *dest; @@ -1020,7 +1010,7 @@ static int fpm_rib_send(struct thread *t) thread_add_timer(zrouter.master, fpm_rib_send, fnc, 1, &fnc->t_ribwalk); - return 0; + return; } /* Mark as sent. */ @@ -1037,8 +1027,6 @@ static int fpm_rib_send(struct thread *t) /* Schedule next event: RMAC reset. */ thread_add_event(zrouter.master, fpm_rmac_reset, fnc, 0, &fnc->t_rmacreset); - - return 0; } /* @@ -1092,7 +1080,7 @@ static void fpm_enqueue_l3vni_table(struct hash_bucket *bucket, void *arg) hash_iterate(zl3vni->rmac_table, fpm_enqueue_rmac_table, zl3vni); } -static int fpm_rmac_send(struct thread *t) +static void fpm_rmac_send(struct thread *t) { struct fpm_rmac_arg fra; @@ -1105,8 +1093,6 @@ static int fpm_rmac_send(struct thread *t) /* RMAC walk completed. */ if (fra.complete) WALK_FINISH(fra.fnc, FNE_RMAC_FINISHED); - - return 0; } /* @@ -1120,7 +1106,7 @@ static void fpm_nhg_reset_cb(struct hash_bucket *bucket, void *arg) UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_FPM); } -static int fpm_nhg_reset(struct thread *t) +static void fpm_nhg_reset(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); @@ -1128,8 +1114,6 @@ static int fpm_nhg_reset(struct thread *t) /* Schedule next step: send next hop groups. */ thread_add_event(zrouter.master, fpm_nhg_send, fnc, 0, &fnc->t_nhgwalk); - - return 0; } /* @@ -1142,7 +1126,7 @@ static void fpm_lsp_reset_cb(struct hash_bucket *bucket, void *arg) UNSET_FLAG(lsp->flags, LSP_FLAG_FPM); } -static int fpm_lsp_reset(struct thread *t) +static void fpm_lsp_reset(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); @@ -1151,14 +1135,12 @@ static int fpm_lsp_reset(struct thread *t) /* Schedule next step: send LSPs */ thread_add_event(zrouter.master, fpm_lsp_send, fnc, 0, &fnc->t_lspwalk); - - return 0; } /** * Resets the RIB FPM flags so we send all routes again. */ -static int fpm_rib_reset(struct thread *t) +static void fpm_rib_reset(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); rib_dest_t *dest; @@ -1180,8 +1162,6 @@ static int fpm_rib_reset(struct thread *t) /* Schedule next step: send RIB routes. */ thread_add_event(zrouter.master, fpm_rib_send, fnc, 0, &fnc->t_ribwalk); - - return 0; } /* @@ -1201,7 +1181,7 @@ static void fpm_unset_l3vni_table(struct hash_bucket *bucket, void *arg) hash_iterate(zl3vni->rmac_table, fpm_unset_rmac_table, zl3vni); } -static int fpm_rmac_reset(struct thread *t) +static void fpm_rmac_reset(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); @@ -1210,11 +1190,9 @@ static int fpm_rmac_reset(struct thread *t) /* Schedule next event: send RMAC entries. */ thread_add_event(zrouter.master, fpm_rmac_send, fnc, 0, &fnc->t_rmacwalk); - - return 0; } -static int fpm_process_queue(struct thread *t) +static void fpm_process_queue(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); struct zebra_dplane_ctx *ctx; @@ -1269,14 +1247,12 @@ static int fpm_process_queue(struct thread *t) */ if (dplane_provider_out_ctx_queue_len(fnc->prov) > 0) dplane_provider_work_ready(); - - return 0; } /** * Handles external (e.g. CLI, data plane or others) events. */ -static int fpm_process_event(struct thread *t) +static void fpm_process_event(struct thread *t) { struct fpm_nl_ctx *fnc = THREAD_ARG(t); int event = THREAD_VAL(t); @@ -1338,8 +1314,6 @@ static int fpm_process_event(struct thread *t) zlog_debug("%s: unhandled event %d", __func__, event); break; } - - return 0; } /* diff --git a/zebra/interface.c b/zebra/interface.c index 2e13cfd55..5d1080fd7 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -64,7 +64,7 @@ DEFINE_HOOK(zebra_if_config_wr, (struct vty * vty, struct interface *ifp), static void if_down_del_nbr_connected(struct interface *ifp); -static int if_zebra_speed_update(struct thread *thread) +static void if_zebra_speed_update(struct thread *thread) { struct interface *ifp = THREAD_ARG(thread); struct zebra_if *zif = ifp->info; @@ -81,7 +81,7 @@ static int if_zebra_speed_update(struct thread *thread) * note that loopback & virtual interfaces can return 0 as speed */ if (error < 0) - return 1; + return; if (new_speed != ifp->speed) { zlog_info("%s: %s old speed: %u new speed: %u", __func__, @@ -96,8 +96,6 @@ static int if_zebra_speed_update(struct thread *thread) &zif->speed_update); thread_ignore_late_timer(zif->speed_update); } - - return 1; } static void zebra_if_node_destroy(route_table_delegate_t *delegate, diff --git a/zebra/irdp.h b/zebra/irdp.h index c1ea34f3a..19f549cc5 100644 --- a/zebra/irdp.h +++ b/zebra/irdp.h @@ -144,10 +144,10 @@ struct Adv { extern void irdp_if_init(void); extern int irdp_sock_init(void); extern int irdp_config_write(struct vty *, struct interface *); -extern int irdp_send_thread(struct thread *t_advert); +extern void irdp_send_thread(struct thread *t_advert); extern void irdp_advert_off(struct interface *ifp); extern void process_solicit(struct interface *ifp); -extern int irdp_read_raw(struct thread *r); +extern void irdp_read_raw(struct thread *r); extern void send_packet(struct interface *ifp, struct stream *s, uint32_t dst, struct prefix *p, uint32_t ttl); diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index f141b7271..43478c98f 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -205,7 +205,7 @@ static void irdp_advertisement(struct interface *ifp, struct prefix *p) stream_free(s); } -int irdp_send_thread(struct thread *t_advert) +void irdp_send_thread(struct thread *t_advert) { uint32_t timer, tmp; struct interface *ifp = THREAD_ARG(t_advert); @@ -216,7 +216,7 @@ int irdp_send_thread(struct thread *t_advert) struct connected *ifc; if (!irdp) - return 0; + return; irdp->flags &= ~IF_SOLICIT; @@ -246,7 +246,6 @@ int irdp_send_thread(struct thread *t_advert) irdp->t_advertise = NULL; thread_add_timer(zrouter.master, irdp_send_thread, ifp, timer, &irdp->t_advertise); - return 0; } void irdp_advert_off(struct interface *ifp) diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 5601b13a9..c27d97ba7 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -224,7 +224,7 @@ static int irdp_recvmsg(int sock, uint8_t *buf, int size, int *ifindex) return ret; } -int irdp_read_raw(struct thread *r) +void irdp_read_raw(struct thread *r) { struct interface *ifp; struct zebra_if *zi; @@ -243,22 +243,22 @@ int irdp_read_raw(struct thread *r) ifp = if_lookup_by_index(ifindex, VRF_DEFAULT); if (!ifp) - return ret; + return; zi = ifp->info; if (!zi) - return ret; + return; irdp = zi->irdp; if (!irdp) - return ret; + return; if (!(irdp->flags & IF_ACTIVE)) { if (irdp->flags & IF_DEBUG_MISC) zlog_debug("IRDP: RX ICMP for disabled interface %s", ifp->name); - return 0; + return; } if (irdp->flags & IF_DEBUG_PACKET) { @@ -269,8 +269,6 @@ int irdp_read_raw(struct thread *r) } parse_irdp_packet(buf, ret, ifp); - - return ret; } void send_packet(struct interface *ifp, struct stream *s, uint32_t dst, diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 84c15a2a9..23e7098d0 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -418,7 +418,7 @@ static int dplane_netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id, return 0; } -static int kernel_read(struct thread *thread) +static void kernel_read(struct thread *thread) { struct zebra_ns *zns = (struct zebra_ns *)THREAD_ARG(thread); struct zebra_dplane_info dp_info; @@ -431,8 +431,6 @@ static int kernel_read(struct thread *thread) thread_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock, &zns->t_netlink); - - return 0; } /* diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index b9228072e..53b7a21d3 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -1292,7 +1292,7 @@ static void rtmsg_debug(struct rt_msghdr *rtm) #endif /* RTAX_MAX */ /* Kernel routing table and interface updates via routing socket. */ -static int kernel_read(struct thread *thread) +static void kernel_read(struct thread *thread) { int sock; int nbytes; @@ -1356,11 +1356,11 @@ static int kernel_read(struct thread *thread) if (errno != EAGAIN && errno != EWOULDBLOCK) flog_err_sys(EC_LIB_SOCKET, "routing socket error: %s", safe_strerror(errno)); - return 0; + return; } if (nbytes == 0) - return 0; + return; thread_add_read(zrouter.master, kernel_read, NULL, sock, NULL); @@ -1377,7 +1377,7 @@ static int kernel_read(struct thread *thread) zlog_debug( "kernel_read: rtm->rtm_msglen %d, nbytes %d, type %d", rtm->rtm_msglen, nbytes, rtm->rtm_type); - return -1; + return; } switch (rtm->rtm_type) { @@ -1403,7 +1403,6 @@ static int kernel_read(struct thread *thread) zlog_debug("Unprocessed RTM_type: %d", rtm->rtm_type); break; } - return 0; } /* Make routing socket. */ diff --git a/zebra/main.c b/zebra/main.c index 079751af0..9deafb532 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -213,7 +213,7 @@ static void sigint(void) * Final shutdown step for the zebra main thread. This is run after all * async update processing has completed. */ -int zebra_finalize(struct thread *dummy) +void zebra_finalize(struct thread *dummy) { zlog_info("Zebra final shutdown"); diff --git a/zebra/rib.h b/zebra/rib.h index ae1fce727..c6f3528ce 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -432,7 +432,7 @@ extern struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, extern void rib_update(enum rib_update_event event); extern void rib_update_table(struct route_table *table, enum rib_update_event event, int rtype); -extern int rib_sweep_route(struct thread *t); +extern void rib_sweep_route(struct thread *t); extern void rib_sweep_table(struct route_table *table); extern void rib_close_table(struct route_table *table); extern void rib_init(void); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 3bbee83d7..2ce507294 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -471,7 +471,7 @@ no_more_opts: zif->ra_sent++; } -static int rtadv_timer(struct thread *thread) +static void rtadv_timer(struct thread *thread) { struct zebra_vrf *zvrf = THREAD_ARG(thread); struct vrf *vrf; @@ -534,8 +534,6 @@ static int rtadv_timer(struct thread *thread) } } } - - return 0; } static void rtadv_process_solicit(struct interface *ifp) @@ -774,7 +772,7 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len, return; } -static int rtadv_read(struct thread *thread) +static void rtadv_read(struct thread *thread) { int sock; int len; @@ -797,12 +795,10 @@ static int rtadv_read(struct thread *thread) flog_err_sys(EC_LIB_SOCKET, "RA/RS recv failed, socket %u error %s", sock, safe_strerror(errno)); - return len; + return; } rtadv_process_packet(buf, (unsigned)len, ifindex, hoplimit, &from, zvrf); - - return 0; } static int rtadv_make_socket(ns_id_t ns_id) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 9f9270db9..1967345d2 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -539,7 +539,7 @@ DECLARE_DLIST(zns_info_list, struct dplane_zns_info, link); #define DPLANE_PROV_UNLOCK(p) pthread_mutex_unlock(&((p)->dp_mutex)) /* Prototypes */ -static int dplane_thread_loop(struct thread *event); +static void dplane_thread_loop(struct thread *event); static void dplane_info_from_zns(struct zebra_dplane_info *ns_info, struct zebra_ns *zns); static enum zebra_dplane_result lsp_update_internal(struct zebra_lsp *lsp, @@ -4864,7 +4864,7 @@ static void dplane_info_from_zns(struct zebra_dplane_info *ns_info, * Callback when an OS (netlink) incoming event read is ready. This runs * in the dplane pthread. */ -static int dplane_incoming_read(struct thread *event) +static void dplane_incoming_read(struct thread *event) { struct dplane_zns_info *zi = THREAD_ARG(event); @@ -4873,8 +4873,6 @@ static int dplane_incoming_read(struct thread *event) /* Re-start read task */ thread_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, zi->info.sock, &zi->t_read); - - return 0; } #endif /* HAVE_NETLINK */ @@ -5595,7 +5593,7 @@ done: * final zebra shutdown. * This runs in the dplane pthread context. */ -static int dplane_check_shutdown_status(struct thread *event) +static void dplane_check_shutdown_status(struct thread *event) { struct dplane_zns_info *zi; @@ -5627,8 +5625,6 @@ static int dplane_check_shutdown_status(struct thread *event) */ thread_add_event(zrouter.master, zebra_finalize, NULL, 0, NULL); } - - return 0; } /* @@ -5662,7 +5658,7 @@ void zebra_dplane_finish(void) * pthread can look for other pending work - such as i/o work on behalf of * providers. */ -static int dplane_thread_loop(struct thread *event) +static void dplane_thread_loop(struct thread *event) { struct dplane_ctx_q work_list; struct dplane_ctx_q error_list; @@ -5682,7 +5678,7 @@ static int dplane_thread_loop(struct thread *event) /* Check for zebra shutdown */ if (!zdplane_info.dg_run) - goto done; + return; /* Dequeue some incoming work from zebra (if any) onto the temporary * working list. @@ -5848,9 +5844,6 @@ static int dplane_thread_loop(struct thread *event) (zdplane_info.dg_results_cb)(&work_list); TAILQ_INIT(&work_list); - -done: - return 0; } /* diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index d3791f3e5..e38766bc6 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -383,7 +383,7 @@ static char *zebra_evpn_zebra_mac_flag_dump(struct zebra_mac *mac, char *buf, return buf; } -static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) +static void zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) { struct zebra_vrf *zvrf = NULL; struct zebra_mac *mac = NULL; @@ -396,15 +396,15 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) /* since this is asynchronous we need sanity checks*/ zvrf = vrf_info_lookup(mac->zevpn->vrf_id); if (!zvrf) - return 0; + return; zevpn = zebra_evpn_lookup(mac->zevpn->vni); if (!zevpn) - return 0; + return; mac = zebra_evpn_mac_lookup(zevpn, &mac->macaddr); if (!mac) - return 0; + return; if (IS_ZEBRA_DEBUG_VXLAN) { char mac_buf[MAC_BUF_SIZE]; @@ -445,7 +445,7 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) if (zebra_evpn_mac_send_add_to_client(zevpn->vni, &mac->macaddr, mac->flags, mac->loc_seq, mac->es)) - return -1; + return; /* Process all neighbors associated with this MAC. */ zebra_evpn_process_neigh_on_local_mac_change(zevpn, mac, 0, @@ -457,8 +457,6 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) /* Install the entry. */ zebra_evpn_rem_mac_install(zevpn, mac, false /* was_static */); } - - return 0; } static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, @@ -1470,7 +1468,7 @@ void zebra_evpn_mac_send_add_del_to_client(struct zebra_mac *mac, * external neighmgr daemon to probe existing hosts to independently * establish their presence on the ES. */ -static int zebra_evpn_mac_hold_exp_cb(struct thread *t) +static void zebra_evpn_mac_hold_exp_cb(struct thread *t) { struct zebra_mac *mac; bool old_bgp_ready; @@ -1483,7 +1481,7 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) * flag */ if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_ES_PEER_ACTIVE)) - return 0; + return; old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(mac->flags); old_static = zebra_evpn_mac_is_static(mac); @@ -1514,8 +1512,6 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) if (old_bgp_ready != new_bgp_ready) zebra_evpn_mac_send_add_del_to_client(mac, old_bgp_ready, new_bgp_ready); - - return 0; } static inline void zebra_evpn_mac_start_hold_timer(struct zebra_mac *mac) diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index af4629e41..50eecd31d 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -2131,7 +2131,7 @@ static void zebra_evpn_mh_advertise_svi_mac(void) zebra_evpn_acc_vl_adv_svi_mac_all(); } -static int zebra_evpn_es_df_delay_exp_cb(struct thread *t) +static void zebra_evpn_es_df_delay_exp_cb(struct thread *t) { struct zebra_evpn_es *es; @@ -2141,8 +2141,6 @@ static int zebra_evpn_es_df_delay_exp_cb(struct thread *t) zlog_debug("es %s df-delay expired", es->esi_str); zebra_evpn_es_run_df_election(es, __func__); - - return 0; } /* currently there is no global config to turn on MH instead we use @@ -3860,15 +3858,13 @@ void zebra_evpn_mh_uplink_oper_update(struct zebra_if *zif) new_protodown); } -static int zebra_evpn_mh_startup_delay_exp_cb(struct thread *t) +static void zebra_evpn_mh_startup_delay_exp_cb(struct thread *t) { if (IS_ZEBRA_DEBUG_EVPN_MH_ES) zlog_debug("startup-delay expired"); zebra_evpn_mh_update_protodown(ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY, false /* set */); - - return 0; } static void zebra_evpn_mh_startup_delay_timer_start(const char *rc) diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index c3218d0f9..f557e6638 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -411,7 +411,7 @@ void zebra_evpn_sync_neigh_static_chg(struct zebra_neigh *n, bool old_n_static, * external neighmgr daemon to probe existing hosts to independently * establish their presence on the ES. */ -static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) +static void zebra_evpn_neigh_hold_exp_cb(struct thread *t) { struct zebra_neigh *n; bool old_bgp_ready; @@ -424,7 +424,7 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) * flag */ if (!CHECK_FLAG(n->flags, ZEBRA_NEIGH_ES_PEER_ACTIVE)) - return 0; + return; old_bgp_ready = zebra_evpn_neigh_is_ready_for_bgp(n); old_n_static = zebra_evpn_neigh_is_static(n); @@ -448,8 +448,6 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) if (old_bgp_ready != new_bgp_ready) zebra_evpn_neigh_send_add_del_to_client(n, old_bgp_ready, new_bgp_ready); - - return 0; } static inline void zebra_evpn_neigh_start_hold_timer(struct zebra_neigh *n) @@ -1092,7 +1090,7 @@ static int zebra_evpn_ip_inherit_dad_from_mac(struct zebra_vrf *zvrf, return 0; } -static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) +static void zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) { struct zebra_vrf *zvrf = NULL; struct zebra_neigh *nbr = NULL; @@ -1103,15 +1101,15 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) /* since this is asynchronous we need sanity checks*/ zvrf = vrf_info_lookup(nbr->zevpn->vrf_id); if (!zvrf) - return 0; + return; zevpn = zebra_evpn_lookup(nbr->zevpn->vni); if (!zevpn) - return 0; + return; nbr = zebra_evpn_neigh_lookup(zevpn, &nbr->ip); if (!nbr) - return 0; + return; if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( @@ -1135,8 +1133,6 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) } else if (!!CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_REMOTE)) { zebra_evpn_rem_neigh_install(zevpn, nbr, false /*was_static*/); } - - return 0; } static void zebra_evpn_dup_addr_detect_for_neigh( diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 43958fdfd..6766c752a 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -284,8 +284,8 @@ static struct zfpm_glob *zfpm_g = &zfpm_glob_space; static int zfpm_trigger_update(struct route_node *rn, const char *reason); -static int zfpm_read_cb(struct thread *thread); -static int zfpm_write_cb(struct thread *thread); +static void zfpm_read_cb(struct thread *thread); +static void zfpm_write_cb(struct thread *thread); static void zfpm_set_state(enum zfpm_state state, const char *reason); static void zfpm_start_connect_timer(const char *reason); @@ -518,7 +518,7 @@ static inline void zfpm_connect_off(void) * Callback for actions to be taken when the connection to the FPM * comes up. */ -static int zfpm_conn_up_thread_cb(struct thread *thread) +static void zfpm_conn_up_thread_cb(struct thread *thread) { struct route_node *rnode; struct zfpm_rnodes_iter *iter; @@ -559,14 +559,13 @@ static int zfpm_conn_up_thread_cb(struct thread *thread) zfpm_rnodes_iter_pause(iter); thread_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb, NULL, 0, &zfpm_g->t_conn_up); - return 0; + return; } zfpm_g->stats.t_conn_up_finishes++; done: zfpm_rnodes_iter_cleanup(iter); - return 0; } /* @@ -635,7 +634,7 @@ static void zfpm_connect_check(void) * Callback that is invoked to clean up state after the TCP connection * to the FPM goes down. */ -static int zfpm_conn_down_thread_cb(struct thread *thread) +static void zfpm_conn_down_thread_cb(struct thread *thread) { struct route_node *rnode; struct zfpm_rnodes_iter *iter; @@ -686,7 +685,7 @@ static int zfpm_conn_down_thread_cb(struct thread *thread) zfpm_g->t_conn_down = NULL; thread_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, NULL, 0, &zfpm_g->t_conn_down); - return 0; + return; } zfpm_g->stats.t_conn_down_finishes++; @@ -696,7 +695,6 @@ static int zfpm_conn_down_thread_cb(struct thread *thread) * Start the process of connecting to the FPM again. */ zfpm_start_connect_timer("cleanup complete"); - return 0; } /* @@ -740,7 +738,7 @@ static void zfpm_connection_down(const char *detail) /* * zfpm_read_cb */ -static int zfpm_read_cb(struct thread *thread) +static void zfpm_read_cb(struct thread *thread) { size_t already; struct stream *ibuf; @@ -754,7 +752,7 @@ static int zfpm_read_cb(struct thread *thread) */ if (zfpm_g->state == ZFPM_STATE_CONNECTING) { zfpm_connect_check(); - return 0; + return; } assert(zfpm_g->state == ZFPM_STATE_ESTABLISHED); @@ -778,7 +776,7 @@ static int zfpm_read_cb(struct thread *thread) zfpm_connection_down(buffer); } else zfpm_connection_down("closed socket in read"); - return 0; + return; } if (nbyte != (ssize_t)(FPM_MSG_HDR_LEN - already)) @@ -793,7 +791,7 @@ static int zfpm_read_cb(struct thread *thread) if (!fpm_msg_hdr_ok(hdr)) { zfpm_connection_down("invalid message header"); - return 0; + return; } msg_len = fpm_msg_len(hdr); @@ -816,7 +814,7 @@ static int zfpm_read_cb(struct thread *thread) zfpm_connection_down(buffer); } else zfpm_connection_down("failed to read message"); - return 0; + return; } if (nbyte != (ssize_t)(msg_len - already)) @@ -830,7 +828,6 @@ static int zfpm_read_cb(struct thread *thread) done: zfpm_read_on(); - return 0; } static bool zfpm_updates_pending(void) @@ -1171,7 +1168,7 @@ static void zfpm_build_updates(void) /* * zfpm_write_cb */ -static int zfpm_write_cb(struct thread *thread) +static void zfpm_write_cb(struct thread *thread) { struct stream *s; int num_writes; @@ -1183,7 +1180,7 @@ static int zfpm_write_cb(struct thread *thread) */ if (zfpm_g->state == ZFPM_STATE_CONNECTING) { zfpm_connect_check(); - return 0; + return; } assert(zfpm_g->state == ZFPM_STATE_ESTABLISHED); @@ -1217,7 +1214,7 @@ static int zfpm_write_cb(struct thread *thread) break; zfpm_connection_down("failed to write to socket"); - return 0; + return; } if (bytes_written != bytes_to_write) { @@ -1248,14 +1245,12 @@ static int zfpm_write_cb(struct thread *thread) if (zfpm_writes_pending()) zfpm_write_on(); - - return 0; } /* * zfpm_connect_cb */ -static int zfpm_connect_cb(struct thread *t) +static void zfpm_connect_cb(struct thread *t) { int sock, ret; struct sockaddr_in serv; @@ -1267,7 +1262,7 @@ static int zfpm_connect_cb(struct thread *t) zlog_err("Failed to create socket for connect(): %s", strerror(errno)); zfpm_g->stats.connect_no_sock++; - return 0; + return; } set_nonblocking(sock); @@ -1295,7 +1290,7 @@ static int zfpm_connect_cb(struct thread *t) if (ret >= 0) { zfpm_g->sock = sock; zfpm_connection_up("connect succeeded"); - return 1; + return; } if (errno == EINPROGRESS) { @@ -1304,7 +1299,7 @@ static int zfpm_connect_cb(struct thread *t) zfpm_write_on(); zfpm_set_state(ZFPM_STATE_CONNECTING, "async connect in progress"); - return 0; + return; } zlog_info("can't connect to FPM %d: %s", sock, safe_strerror(errno)); @@ -1314,7 +1309,6 @@ static int zfpm_connect_cb(struct thread *t) * Restart timer for retrying connection. */ zfpm_start_connect_timer("connect() failed"); - return 0; } /* @@ -1663,7 +1657,7 @@ static void zfpm_iterate_rmac_table(struct hash_bucket *bucket, void *args) /* * struct zfpm_statsimer_cb */ -static int zfpm_stats_timer_cb(struct thread *t) +static void zfpm_stats_timer_cb(struct thread *t) { zfpm_g->t_stats = NULL; @@ -1685,8 +1679,6 @@ static int zfpm_stats_timer_cb(struct thread *t) zfpm_stats_reset(&zfpm_g->stats); zfpm_start_stats_timer(); - - return 0; } /* diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c index b153ac1d8..56d0df569 100644 --- a/zebra/zebra_gr.c +++ b/zebra/zebra_gr.c @@ -51,7 +51,7 @@ * Forward declaration. */ static struct zserv *zebra_gr_find_stale_client(struct zserv *client); -static int32_t zebra_gr_route_stale_delete_timer_expiry(struct thread *thread); +static void zebra_gr_route_stale_delete_timer_expiry(struct thread *thread); static int32_t zebra_gr_delete_stale_routes(struct client_gr_info *info); static void zebra_gr_process_client_stale_routes(struct zserv *client, vrf_id_t vrf_id); @@ -444,7 +444,7 @@ void zread_client_capabilities(ZAPI_HANDLER_ARGS) * Delete all the stale routes that have not been refreshed * post restart. */ -static int32_t zebra_gr_route_stale_delete_timer_expiry(struct thread *thread) +static void zebra_gr_route_stale_delete_timer_expiry(struct thread *thread) { struct client_gr_info *info; int32_t cnt = 0; @@ -478,7 +478,6 @@ static int32_t zebra_gr_route_stale_delete_timer_expiry(struct thread *thread) info->current_afi = 0; zebra_gr_delete_stale_client(info); } - return 0; } diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index 40a2c94e2..2042f9403 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -52,8 +52,8 @@ uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT]; static bool test_mlag_in_progress; static int zebra_mlag_signal_write_thread(void); -static int zebra_mlag_terminate_pthread(struct thread *event); -static int zebra_mlag_post_data_from_main_thread(struct thread *thread); +static void zebra_mlag_terminate_pthread(struct thread *event); +static void zebra_mlag_post_data_from_main_thread(struct thread *thread); static void zebra_mlag_publish_process_state(struct zserv *client, zebra_message_types_t msg_type); @@ -148,7 +148,7 @@ void zebra_mlag_process_mlag_data(uint8_t *data, uint32_t len) * This thread reads the clients data from the Global queue and encodes with * protobuf and pass on to the MLAG socket. */ -static int zebra_mlag_client_msg_handler(struct thread *event) +static void zebra_mlag_client_msg_handler(struct thread *event) { struct stream *s; uint32_t wr_count = 0; @@ -209,7 +209,6 @@ static int zebra_mlag_client_msg_handler(struct thread *event) */ if (wr_count >= ZEBRA_MLAG_POST_LIMIT) zebra_mlag_signal_write_thread(); - return 0; } /* @@ -309,7 +308,7 @@ static void zebra_mlag_publish_process_state(struct zserv *client, * main thread, because for that access was needed for clients list. * so instead of forcing the locks, messages will be posted from main thread. */ -static int zebra_mlag_post_data_from_main_thread(struct thread *thread) +static void zebra_mlag_post_data_from_main_thread(struct thread *thread) { struct stream *s = THREAD_ARG(thread); struct stream *zebra_s = NULL; @@ -319,7 +318,7 @@ static int zebra_mlag_post_data_from_main_thread(struct thread *thread) uint32_t msg_len = 0; if (!s) - return -1; + return; STREAM_GETL(s, msg_type); if (IS_ZEBRA_DEBUG_MLAG) @@ -356,12 +355,11 @@ static int zebra_mlag_post_data_from_main_thread(struct thread *thread) } stream_free(s); - return 0; + return; stream_failure: stream_free(s); if (zebra_s) stream_free(zebra_s); - return 0; } /* @@ -394,7 +392,7 @@ static void zebra_mlag_spawn_pthread(void) * all clients are un-registered for MLAG Updates, terminate the * MLAG write thread */ -static int zebra_mlag_terminate_pthread(struct thread *event) +static void zebra_mlag_terminate_pthread(struct thread *event) { if (IS_ZEBRA_DEBUG_MLAG) zlog_debug("Zebra MLAG write thread terminate called"); @@ -403,7 +401,7 @@ static int zebra_mlag_terminate_pthread(struct thread *event) if (IS_ZEBRA_DEBUG_MLAG) zlog_debug( "Zebra MLAG: still some clients are interested"); - return 0; + return; } frr_pthread_stop(zrouter.mlag_info.zebra_pth_mlag, NULL); @@ -419,7 +417,6 @@ static int zebra_mlag_terminate_pthread(struct thread *event) * Send Notification to clean private data */ hook_call(zebra_mlag_private_cleanup_data); - return 0; } /* diff --git a/zebra/zebra_mlag_private.c b/zebra/zebra_mlag_private.c index b1bba831d..50a290b9e 100644 --- a/zebra/zebra_mlag_private.c +++ b/zebra/zebra_mlag_private.c @@ -48,8 +48,8 @@ static struct thread_master *zmlag_master; static int mlag_socket; -static int zebra_mlag_connect(struct thread *thread); -static int zebra_mlag_read(struct thread *thread); +static void zebra_mlag_connect(struct thread *thread); +static void zebra_mlag_read(struct thread *thread); /* * Write the data to MLAGD @@ -72,7 +72,7 @@ static void zebra_mlag_sched_read(void) &zrouter.mlag_info.t_read); } -static int zebra_mlag_read(struct thread *thread) +static void zebra_mlag_read(struct thread *thread) { static uint32_t mlag_rd_buf_offset; uint32_t *msglen; @@ -98,13 +98,13 @@ static int zebra_mlag_read(struct thread *thread) mlag_socket); close(mlag_socket); zebra_mlag_handle_process_state(MLAG_DOWN); - return -1; + return; } mlag_rd_buf_offset += data_len; if (data_len != (ssize_t)(ZEBRA_MLAG_LEN_SIZE - curr_len)) { /* Try again later */ zebra_mlag_sched_read(); - return 0; + return; } curr_len = ZEBRA_MLAG_LEN_SIZE; } @@ -136,13 +136,13 @@ static int zebra_mlag_read(struct thread *thread) mlag_socket); close(mlag_socket); zebra_mlag_handle_process_state(MLAG_DOWN); - return -1; + return; } mlag_rd_buf_offset += data_len; if (data_len != (ssize_t)(tot_len - curr_len)) { /* Try again later */ zebra_mlag_sched_read(); - return 0; + return; } } @@ -162,10 +162,9 @@ static int zebra_mlag_read(struct thread *thread) zebra_mlag_reset_read_buffer(); mlag_rd_buf_offset = 0; zebra_mlag_sched_read(); - return 0; } -static int zebra_mlag_connect(struct thread *thread) +static void zebra_mlag_connect(struct thread *thread) { struct sockaddr_un svr = {0}; @@ -178,7 +177,7 @@ static int zebra_mlag_connect(struct thread *thread) mlag_socket = socket(svr.sun_family, SOCK_STREAM, 0); if (mlag_socket < 0) - return -1; + return; if (connect(mlag_socket, (struct sockaddr *)&svr, sizeof(svr)) == -1) { if (IS_ZEBRA_DEBUG_MLAG) @@ -189,7 +188,7 @@ static int zebra_mlag_connect(struct thread *thread) zrouter.mlag_info.timer_running = true; thread_add_timer(zmlag_master, zebra_mlag_connect, NULL, 10, &zrouter.mlag_info.t_read); - return 0; + return; } set_nonblocking(mlag_socket); @@ -204,7 +203,6 @@ static int zebra_mlag_connect(struct thread *thread) * Connection is established with MLAGD, post to clients */ zebra_mlag_handle_process_state(MLAG_UP); - return 0; } /* diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 8cc7724f0..7cb190689 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -61,11 +61,11 @@ struct zebra_netns_info { unsigned int retries; }; -static int zebra_ns_ready_read(struct thread *t); +static void zebra_ns_ready_read(struct thread *t); static void zebra_ns_notify_create_context_from_entry_name(const char *name); static int zebra_ns_continue_read(struct zebra_netns_info *zns_info, int stop_retry); -static int zebra_ns_notify_read(struct thread *t); +static void zebra_ns_notify_read(struct thread *t); static struct vrf *vrf_handler_create(struct vty *vty, const char *vrfname) { @@ -231,17 +231,17 @@ static bool zebra_ns_notify_is_default_netns(const char *name) return false; } -static int zebra_ns_ready_read(struct thread *t) +static void zebra_ns_ready_read(struct thread *t) { struct zebra_netns_info *zns_info = THREAD_ARG(t); const char *netnspath; int err, stop_retry = 0; if (!zns_info) - return 0; + return; if (!zns_info->netnspath) { XFREE(MTYPE_NETNS_MISC, zns_info); - return 0; + return; } netnspath = zns_info->netnspath; if (--zns_info->retries == 0) @@ -249,34 +249,40 @@ static int zebra_ns_ready_read(struct thread *t) frr_with_privs(&zserv_privs) { err = ns_switch_to_netns(netnspath); } - if (err < 0) - return zebra_ns_continue_read(zns_info, stop_retry); + if (err < 0) { + zebra_ns_continue_read(zns_info, stop_retry); + return; + } /* go back to default ns */ frr_with_privs(&zserv_privs) { err = ns_switchback_to_initial(); } - if (err < 0) - return zebra_ns_continue_read(zns_info, stop_retry); + if (err < 0) { + zebra_ns_continue_read(zns_info, stop_retry); + return; + } /* check default name is not already set */ if (strmatch(VRF_DEFAULT_NAME, basename(netnspath))) { zlog_warn("NS notify : NS %s is already default VRF.Cancel VRF Creation", basename(netnspath)); - return zebra_ns_continue_read(zns_info, 1); + zebra_ns_continue_read(zns_info, 1); + return; } if (zebra_ns_notify_is_default_netns(basename(netnspath))) { zlog_warn( "NS notify : NS %s is default VRF. Ignore VRF creation", basename(netnspath)); - return zebra_ns_continue_read(zns_info, 1); + zebra_ns_continue_read(zns_info, 1); + return; } /* success : close fd and create zns context */ zebra_ns_notify_create_context_from_entry_name(basename(netnspath)); - return zebra_ns_continue_read(zns_info, 1); + zebra_ns_continue_read(zns_info, 1); } -static int zebra_ns_notify_read(struct thread *t) +static void zebra_ns_notify_read(struct thread *t) { int fd_monitor = THREAD_FD(t); struct inotify_event *event; @@ -290,7 +296,7 @@ static int zebra_ns_notify_read(struct thread *t) flog_err_sys(EC_ZEBRA_NS_NOTIFY_READ, "NS notify read: failed to read (%s)", safe_strerror(errno)); - return 0; + return; } for (event = (struct inotify_event *)buf; (char *)event < &buf[len]; event = (struct inotify_event *)((char *)event + sizeof(*event) @@ -329,7 +335,6 @@ static int zebra_ns_notify_read(struct thread *t) thread_add_timer_msec(zrouter.master, zebra_ns_ready_read, (void *)netnsinfo, 0, NULL); } - return 0; } void zebra_ns_notify_parse(void) diff --git a/zebra/zebra_opaque.c b/zebra/zebra_opaque.c index 244f16302..0a98194ac 100644 --- a/zebra/zebra_opaque.c +++ b/zebra/zebra_opaque.c @@ -106,7 +106,7 @@ static const char LOG_NAME[] = "Zebra Opaque"; /* Prototypes */ /* Main event loop, processing incoming message queue */ -static int process_messages(struct thread *event); +static void process_messages(struct thread *event); static int handle_opq_registration(const struct zmsghdr *hdr, struct stream *msg); static int handle_opq_unregistration(const struct zmsghdr *hdr, @@ -270,7 +270,7 @@ uint32_t zebra_opaque_enqueue_batch(struct stream_fifo *batch) /* * Pthread event loop, process the incoming message queue. */ -static int process_messages(struct thread *event) +static void process_messages(struct thread *event) { struct stream_fifo fifo; struct stream *msg; @@ -335,8 +335,6 @@ done: /* This will also free any leftover messages, in the shutdown case */ stream_fifo_deinit(&fifo); - - return 0; } /* diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 32edb78c7..68e5c391c 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -100,7 +100,7 @@ static ptm_lib_handle_t *ptm_hdl; struct zebra_ptm_cb ptm_cb; static int zebra_ptm_socket_init(void); -int zebra_ptm_sock_read(struct thread *); +void zebra_ptm_sock_read(struct thread *thread); static void zebra_ptm_install_commands(void); static int zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt); void zebra_bfd_peer_replay_req(void); @@ -168,12 +168,12 @@ void zebra_ptm_finish(void) close(ptm_cb.ptm_sock); } -static int zebra_ptm_flush_messages(struct thread *thread) +static void zebra_ptm_flush_messages(struct thread *thread) { ptm_cb.t_write = NULL; if (ptm_cb.ptm_sock == -1) - return -1; + return; errno = 0; @@ -187,7 +187,7 @@ static int zebra_ptm_flush_messages(struct thread *thread) ptm_cb.t_timer = NULL; thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time, &ptm_cb.t_timer); - return -1; + return; case BUFFER_PENDING: ptm_cb.t_write = NULL; thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, @@ -196,8 +196,6 @@ static int zebra_ptm_flush_messages(struct thread *thread) case BUFFER_EMPTY: break; } - - return 0; } static int zebra_ptm_send_message(char *data, int size) @@ -226,7 +224,7 @@ static int zebra_ptm_send_message(char *data, int size) return 0; } -int zebra_ptm_connect(struct thread *t) +void zebra_ptm_connect(struct thread *t) { int init = 0; @@ -255,8 +253,6 @@ int zebra_ptm_connect(struct thread *t) } else if (ptm_cb.reconnect_time >= ZEBRA_PTM_RECONNECT_TIME_MAX) { ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_INITIAL; } - - return (errno); } DEFUN (zebra_ptm_enable, @@ -649,7 +645,7 @@ static int zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt) } } -int zebra_ptm_sock_read(struct thread *thread) +void zebra_ptm_sock_read(struct thread *thread) { int sock; int rc; @@ -658,7 +654,7 @@ int zebra_ptm_sock_read(struct thread *thread) sock = THREAD_FD(thread); if (sock == -1) - return -1; + return; /* PTM communicates in CSV format */ do { @@ -679,14 +675,12 @@ int zebra_ptm_sock_read(struct thread *thread) thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time, &ptm_cb.t_timer); - return -1; + return; } ptm_cb.t_read = NULL; thread_add_read(zrouter.master, zebra_ptm_sock_read, NULL, ptm_cb.ptm_sock, &ptm_cb.t_read); - - return 0; } /* BFD peer/dst register/update */ diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h index 88c9bccb4..f8e843cc7 100644 --- a/zebra/zebra_ptm.h +++ b/zebra/zebra_ptm.h @@ -74,7 +74,7 @@ struct zebra_ptm_cb { void zebra_ptm_init(void); void zebra_ptm_finish(void); -int zebra_ptm_connect(struct thread *t); +void zebra_ptm_connect(struct thread *t); void zebra_ptm_write(struct vty *vty); int zebra_ptm_get_enable_state(void); diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index 57276974c..7d1153f21 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -47,7 +47,7 @@ DEFINE_HOOK(pw_uninstall, (struct zebra_pw * pw), (pw)); static int zebra_pw_enabled(struct zebra_pw *); static void zebra_pw_install(struct zebra_pw *); static void zebra_pw_uninstall(struct zebra_pw *); -static int zebra_pw_install_retry(struct thread *); +static void zebra_pw_install_retry(struct thread *thread); static int zebra_pw_check_reachability(const struct zebra_pw *); static void zebra_pw_update_status(struct zebra_pw *, int); @@ -226,14 +226,12 @@ void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus) zebra_pw_update_status(pw, pwstatus); } -static int zebra_pw_install_retry(struct thread *thread) +static void zebra_pw_install_retry(struct thread *thread) { struct zebra_pw *pw = THREAD_ARG(thread); pw->install_retry_timer = NULL; zebra_pw_install(pw); - - return 0; } static void zebra_pw_update_status(struct zebra_pw *pw, int status) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index eb9b80fce..c386fc487 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -3948,7 +3948,7 @@ static void rib_update_ctx_fini(struct rib_update_ctx **ctx) XFREE(MTYPE_RIB_UPDATE_CTX, *ctx); } -static int rib_update_handler(struct thread *thread) +static void rib_update_handler(struct thread *thread) { struct rib_update_ctx *ctx; @@ -3960,8 +3960,6 @@ static int rib_update_handler(struct thread *thread) rib_update_handle_vrf(ctx->vrf_id, ctx->event, ZEBRA_ROUTE_ALL); rib_update_ctx_fini(&ctx); - - return 0; } /* @@ -4055,7 +4053,7 @@ void rib_sweep_table(struct route_table *table) } /* Sweep all RIB tables. */ -int rib_sweep_route(struct thread *t) +void rib_sweep_route(struct thread *t) { struct vrf *vrf; struct zebra_vrf *zvrf; @@ -4070,8 +4068,6 @@ int rib_sweep_route(struct thread *t) zebra_router_sweep_route(); zebra_router_sweep_nhgs(); - - return 0; } /* Remove specific by protocol routes from 'table'. */ @@ -4181,7 +4177,7 @@ done: * Handle results from the dataplane system. Dequeue update context * structs, dispatch to appropriate internal handlers. */ -static int rib_process_dplane_results(struct thread *thread) +static void rib_process_dplane_results(struct thread *thread) { struct zebra_dplane_ctx *ctx; struct dplane_ctx_q ctxlist; @@ -4349,8 +4345,6 @@ static int rib_process_dplane_results(struct thread *thread) } } while (1); - - return 0; } /* diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 908c13f3d..e99cb7611 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -1638,7 +1638,7 @@ static void zebra_route_map_process_update_cb(char *rmap_name) zebra_nht_rm_update(rmap_name); } -static int zebra_route_map_update_timer(struct thread *thread) +static void zebra_route_map_update_timer(struct thread *thread) { if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("Event driven route-map update triggered"); @@ -1655,7 +1655,6 @@ static int zebra_route_map_update_timer(struct thread *thread) * 1) VRF Aware <sigh> * 2) Route-map aware */ - return 0; } static void zebra_route_map_set_delay_timer(uint32_t value) diff --git a/zebra/zserv.c b/zebra/zserv.c index f3f69661c..630c76c98 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -216,7 +216,7 @@ static void zserv_client_fail(struct zserv *client) * allows us to expose information about input and output queues to the user in * terms of number of packets rather than size of data. */ -static int zserv_write(struct thread *thread) +static void zserv_write(struct thread *thread) { struct zserv *client = THREAD_ARG(thread); struct stream *msg; @@ -232,7 +232,7 @@ static int zserv_write(struct thread *thread) (uint32_t)monotime(NULL), memory_order_relaxed); zserv_client_event(client, ZSERV_CLIENT_WRITE); - return 0; + return; case BUFFER_EMPTY: break; } @@ -268,7 +268,7 @@ static int zserv_write(struct thread *thread) (uint32_t)monotime(NULL), memory_order_relaxed); zserv_client_event(client, ZSERV_CLIENT_WRITE); - return 0; + return; case BUFFER_EMPTY: break; } @@ -279,14 +279,13 @@ static int zserv_write(struct thread *thread) atomic_store_explicit(&client->last_write_time, (uint32_t)monotime(NULL), memory_order_relaxed); - return 0; + return; zwrite_fail: flog_warn(EC_ZEBRA_CLIENT_WRITE_FAILED, "%s: could not write to %s [fd = %d], closing.", __func__, zebra_route_string(client->proto), client->sock); zserv_client_fail(client); - return 0; } /* @@ -311,7 +310,7 @@ zwrite_fail: * * Any failure in any of these actions is handled by terminating the client. */ -static int zserv_read(struct thread *thread) +static void zserv_read(struct thread *thread) { struct zserv *client = THREAD_ARG(thread); int sock; @@ -453,12 +452,11 @@ static int zserv_read(struct thread *thread) stream_fifo_free(cache); - return 0; + return; zread_fail: stream_fifo_free(cache); zserv_client_fail(client); - return -1; } static void zserv_client_event(struct zserv *client, @@ -495,7 +493,7 @@ static void zserv_client_event(struct zserv *client, * rely on the read thread to handle queuing this task enough times to process * everything on the input queue. */ -static int zserv_process_messages(struct thread *thread) +static void zserv_process_messages(struct thread *thread) { struct zserv *client = THREAD_ARG(thread); struct stream *msg; @@ -529,8 +527,6 @@ static int zserv_process_messages(struct thread *thread) /* Reschedule ourselves if necessary */ if (need_resched) zserv_event(client, ZSERV_PROCESS_MESSAGES); - - return 0; } int zserv_send_message(struct zserv *client, struct stream *msg) @@ -714,12 +710,11 @@ void zserv_close_client(struct zserv *client) * already have been closed and the thread will most likely have died, but its * resources still need to be cleaned up. */ -static int zserv_handle_client_fail(struct thread *thread) +static void zserv_handle_client_fail(struct thread *thread) { struct zserv *client = THREAD_ARG(thread); zserv_close_client(client); - return 0; } /* @@ -853,7 +848,7 @@ void zserv_release_client(struct zserv *client) /* * Accept socket connection. */ -static int zserv_accept(struct thread *thread) +static void zserv_accept(struct thread *thread) { int accept_sock; int client_sock; @@ -871,7 +866,7 @@ static int zserv_accept(struct thread *thread) if (client_sock < 0) { flog_err_sys(EC_LIB_SOCKET, "Can't accept zebra socket: %s", safe_strerror(errno)); - return -1; + return; } /* Make client socket non-blocking. */ @@ -879,8 +874,6 @@ static int zserv_accept(struct thread *thread) /* Create new zebra client. */ zserv_client_create(client_sock); - - return 0; } void zserv_close(void) diff --git a/zebra/zserv.h b/zebra/zserv.h index 203670ac1..7a5be001b 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -379,7 +379,7 @@ void zserv_log_message(const char *errmsg, struct stream *msg, struct zmsghdr *hdr); /* TODO */ -__attribute__((__noreturn__)) int zebra_finalize(struct thread *event); +__attribute__((__noreturn__)) void zebra_finalize(struct thread *event); /* * Graceful restart functions. |