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 /nhrpd | |
| 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 'nhrpd')
| -rw-r--r-- | nhrpd/netlink_arp.c | 4 | ||||
| -rw-r--r-- | nhrpd/nhrp_cache.c | 9 | ||||
| -rw-r--r-- | nhrpd/nhrp_event.c | 19 | ||||
| -rw-r--r-- | nhrpd/nhrp_multicast.c | 4 | ||||
| -rw-r--r-- | nhrpd/nhrp_nhs.c | 20 | ||||
| -rw-r--r-- | nhrpd/nhrp_packet.c | 7 | ||||
| -rw-r--r-- | nhrpd/nhrp_peer.c | 13 | ||||
| -rw-r--r-- | nhrpd/nhrp_shortcut.c | 9 | ||||
| -rw-r--r-- | nhrpd/vici.c | 19 | 
9 files changed, 36 insertions, 68 deletions
diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 3658cb16bb..cd7fb7aed4 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 3823464a73..81d9bb255f 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 206b2caccf..e46a6d17cb 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 d8372ae8a8..89be13b60d 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 3733910a63..63eaf1e394 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 fd77533c89..2407a8d366 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 51cae44bd1..67d12cbcf3 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 244273cd58..71b6dd8702 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 8fce828663..56adde406e 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;  | 
