diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2022-02-22 19:04:25 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2022-02-23 19:56:04 -0500 | 
| commit | cc9f21da2218d95567eff1501482ce58e6600f54 (patch) | |
| tree | d579c9754161d874bad6eb09c67821b65fb559ca /ldpd | |
| parent | eaba619fc183f68a456b3918f449185b3b477426 (diff) | |
*: 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>
Diffstat (limited to 'ldpd')
| -rw-r--r-- | ldpd/accept.c | 19 | ||||
| -rw-r--r-- | ldpd/adjacency.c | 16 | ||||
| -rw-r--r-- | ldpd/control.c | 24 | ||||
| -rw-r--r-- | ldpd/interface.c | 14 | ||||
| -rw-r--r-- | ldpd/lde.c | 18 | ||||
| -rw-r--r-- | ldpd/lde.h | 2 | ||||
| -rw-r--r-- | ldpd/lde_lib.c | 5 | ||||
| -rw-r--r-- | ldpd/ldpd.c | 30 | ||||
| -rw-r--r-- | ldpd/ldpd.h | 11 | ||||
| -rw-r--r-- | ldpd/ldpe.c | 21 | ||||
| -rw-r--r-- | ldpd/ldpe.h | 6 | ||||
| -rw-r--r-- | ldpd/neighbor.c | 37 | ||||
| -rw-r--r-- | ldpd/packet.c | 80 | 
13 files changed, 98 insertions, 185 deletions
diff --git a/ldpd/accept.c b/ldpd/accept.c index e8d3976ee9..2999a35c06 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 d390e70ad0..bbc8a277a6 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 3b77765952..376f488bd1 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 5e04eab1b3..af6e8fd7ec 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 55fa806d4d..9d1daabbe9 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 dee6f3fcb9..bcb1e1ccaa 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 33bb6c0fc7..1ade3c5378 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 92cf24bd5d..a78d2b25d6 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 616c390e50..fd0097ca5e 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 31f8026e3f..29abd420e5 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 0f650a86d3..ddb0e0d970 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 e884b3ebfc..867ad92e47 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 56af16d280..707878ca9f 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);  }  | 
