[Git][NTPsec/ntpsec][master] Split out the payload part of the recvbuf structure.

Eric S. Raymond gitlab at mg.gitlab.com
Sat Dec 5 13:38:56 UTC 2015


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
175b58dc by Eric S. Raymond at 2015-12-05T08:36:30Z
Split out the payload part of the recvbuf structure.

No logic changes.  Narrows the interface of the protocol machine's
receive hook.

- - - - -


9 changed files:

- include/ntpd.h
- include/recvbuff.h
- libntp/recvbuff.c
- ntpd/ntp_control.c
- ntpd/ntp_io.c
- ntpd/ntp_monitor.c
- ntpd/ntp_peer.c
- ntpd/ntp_proto.c
- ntpd/ntpd.c


Changes:

=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -64,7 +64,7 @@ extern	u_short ctlpeerstatus	(struct peer *);
 extern	bool	ctlsettrap	(sockaddr_u *, struct interface *, int, int);
 extern	u_short ctlsysstatus	(void);
 extern	void	init_control	(void);
-extern	void	process_control (struct recvbuf *, int);
+extern	void	process_control (struct payload *, int);
 extern	void	report_event	(int, struct peer *, const char *);
 extern	int	mprintf_event	(int, struct peer *, const char *, ...)
 			NTP_PRINTF(3, 4);
@@ -161,14 +161,14 @@ extern 	int	freq_cnt;
 extern	void	init_mon	(void);
 extern	void	mon_start	(int);
 extern	void	mon_stop	(int);
-extern	u_short	ntp_monitor	(struct recvbuf *, u_short);
+extern	u_short	ntp_monitor	(struct payload *, u_short);
 extern	void	mon_clearinterface(endpt *interface);
 
 /* ntp_peer.c */
 extern	void	init_peer	(void);
 extern	struct peer *findexistingpeer(sockaddr_u *, const char *,
 				      struct peer *, int, uint8_t);
-extern	struct peer *findpeer	(struct recvbuf *, int, int *);
+extern	struct peer *findpeer	(struct payload *, int, int *);
 extern	struct peer *findpeerbyassoc(associd_t);
 extern  void	set_peerdstaddr	(struct peer *, endpt *);
 extern	struct peer *newpeer	(sockaddr_u *, const char *,
@@ -186,7 +186,7 @@ extern	void	refresh_all_peerinterfaces(void);
 extern	void	unpeer		(struct peer *);
 extern	void	clear_all	(void);
 extern	int	score_all	(struct peer *);
-extern	struct peer *findmanycastpeer(struct recvbuf *);
+extern	struct peer *findmanycastpeer(struct payload *);
 extern	void	peer_cleanup	(void);
 
 /* ntp_crypto.c */
@@ -217,7 +217,7 @@ extern struct value tai_leap;
 
 /* ntp_proto.c */
 extern	void	transmit	(struct peer *);
-extern	void	receive 	(struct recvbuf *);
+extern	void	receive 	(struct payload *);
 extern	void	peer_clear	(struct peer *, const char *);
 extern	void 	process_packet	(struct peer *, struct pkt *, u_int);
 extern	void	clock_select	(void);


=====================================
include/recvbuff.h
=====================================
--- a/include/recvbuff.h
+++ b/include/recvbuff.h
@@ -44,10 +44,7 @@ extern HANDLE	get_recv_buff_event(void);
 #define	RX_BUFF_SIZE	1000		/* hail Mary */
 
 
-typedef struct recvbuf recvbuf_t;
-
-struct recvbuf {
-	recvbuf_t *	link;	/* next in list */
+struct payload {
 	union {
 		sockaddr_u	X_recv_srcaddr;	/* where packet came from */
 		void *		X_recv_srcclock;
@@ -63,7 +60,6 @@ struct recvbuf {
 	SOCKET		fd;		/* fd on which it was received */
 	int		msg_flags;	/* Flags received about the packet */
 	l_fp		recv_time;	/* time of arrival */
-	void		(*receiver)(struct recvbuf *); /* callback */
 	size_t		recv_length;	/* number of octets received */
 	union {
 		struct pkt	X_recv_pkt;
@@ -71,7 +67,15 @@ struct recvbuf {
 	} recv_space;
 #define	recv_pkt		recv_space.X_recv_pkt
 #define	recv_buffer		recv_space.X_recv_buffer
-	int used;		/* reference count */
+};
+
+typedef struct recvbuf recvbuf_t;
+
+struct recvbuf {
+	recvbuf_t *	link;	/* next in list */
+	struct payload	payload;
+	void		(*receiver)(struct payload *); /* callback */
+	int		used;		/* reference count */
 };
 
 extern	void	init_recvbuff(int);


=====================================
libntp/recvbuff.c
=====================================
--- a/libntp/recvbuff.c
+++ b/libntp/recvbuff.c
@@ -276,7 +276,7 @@ purge_recv_buffers_for_fd(
 	     rbufp != NULL;
 	     rbufp = next) {
 		next = rbufp->link;
-		if (rbufp->fd == fd) {
+		if (rbufp->payload.fd == fd) {
 			UNLINK_MID_FIFO(punlinked, full_recv_fifo,
 					rbufp, link, recvbuf_t);
 			INSIST(punlinked == rbufp);


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -37,7 +37,7 @@ struct ctl_proc {
 	/* Only one flag.  Authentication required or not. */
 #define NOAUTH	0
 #define AUTH	1
-	void (*handler) (struct recvbuf *, int); /* handle request */
+	void (*handler) (struct payload *, int); /* handle request */
 };
 
 
@@ -73,33 +73,33 @@ static	void	ctl_putclock	(int, struct refclockstat *, int);
 static	const struct ctl_var *ctl_getitem(const struct ctl_var *,
 					  char **);
 static	u_short	count_var	(const struct ctl_var *);
-static	void	control_unspec	(struct recvbuf *, int);
-static	void	read_status	(struct recvbuf *, int);
+static	void	control_unspec	(struct payload *, int);
+static	void	read_status	(struct payload *, int);
 static	void	read_sysvars	(void);
 static	void	read_peervars	(void);
-static	void	read_variables	(struct recvbuf *, int);
-static	void	write_variables (struct recvbuf *, int);
-static	void	read_clockstatus(struct recvbuf *, int);
-static	void	write_clockstatus(struct recvbuf *, int);
-static	void	set_trap	(struct recvbuf *, int);
-static	void	save_config	(struct recvbuf *, int);
-static	void	configure	(struct recvbuf *, int);
+static	void	read_variables	(struct payload *, int);
+static	void	write_variables (struct payload *, int);
+static	void	read_clockstatus(struct payload *, int);
+static	void	write_clockstatus(struct payload *, int);
+static	void	set_trap	(struct payload *, int);
+static	void	save_config	(struct payload *, int);
+static	void	configure	(struct payload *, int);
 static	void	send_mru_entry	(mon_entry *, int);
 static	void	send_random_tag_value(int);
-static	void	read_mru_list	(struct recvbuf *, int);
+static	void	read_mru_list	(struct payload *, int);
 static	void	send_ifstats_entry(endpt *, u_int);
-static	void	read_ifstats	(struct recvbuf *);
+static	void	read_ifstats	(struct payload *);
 static	void	sockaddrs_from_restrict_u(sockaddr_u *,	sockaddr_u *,
 					  restrict_u *, int);
 static	void	send_restrict_entry(restrict_u *, int, u_int);
 static	void	send_restrict_list(restrict_u *, int, u_int *);
-static	void	read_addr_restrictions(struct recvbuf *);
-static	void	read_ordlist	(struct recvbuf *, int);
+static	void	read_addr_restrictions(struct payload *);
+static	void	read_ordlist	(struct payload *, int);
 static	uint32_t	derive_nonce	(sockaddr_u *, uint32_t, uint32_t);
-static	void	generate_nonce	(struct recvbuf *, char *, size_t);
-static	int	validate_nonce	(const char *, struct recvbuf *);
-static	void	req_nonce	(struct recvbuf *, int);
-static	void	unset_trap	(struct recvbuf *, int);
+static	void	generate_nonce	(struct payload *, char *, size_t);
+static	int	validate_nonce	(const char *, struct payload *);
+static	void	req_nonce	(struct payload *, int);
+static	void	unset_trap	(struct payload *, int);
 static	struct ctl_trap *ctlfindtrap(sockaddr_u *,
 				     struct interface *);
 
@@ -796,7 +796,7 @@ ctl_error(
  */
 void
 save_config(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -821,7 +821,7 @@ save_config(
 		NLOG(NLOG_SYSINFO)
 			msyslog(LOG_NOTICE,
 				"saveconfig from %s rejected due to nomodify restriction",
-				stoa(&rbufp->recv_srcaddr));
+				stoa(&payload->recv_srcaddr));
 		sys_restricted++;
 		return;
 	}
@@ -835,7 +835,7 @@ save_config(
 		NLOG(NLOG_SYSINFO)
 			msyslog(LOG_NOTICE,
 				"saveconfig from %s rejected, no saveconfigdir",
-				stoa(&rbufp->recv_srcaddr));
+				stoa(&payload->recv_srcaddr));
 		return;
 	}
 
@@ -873,7 +873,7 @@ save_config(
 		ctl_flushpkt(0);
 		msyslog(LOG_NOTICE,
 			"saveconfig with path from %s rejected",
-			stoa(&rbufp->recv_srcaddr));
+			stoa(&payload->recv_srcaddr));
 		return;
 	}
 
@@ -893,13 +893,13 @@ save_config(
 			 filename);
 		msyslog(LOG_ERR,
 			"saveconfig %s from %s failed", filename,
-			stoa(&rbufp->recv_srcaddr));
+			stoa(&payload->recv_srcaddr));
 	} else {
 		snprintf(reply, sizeof(reply),
 			 "Configuration saved to %s", filename);
 		msyslog(LOG_NOTICE,
 			"Configuration saved to %s (requested by %s)",
-			fullpath, stoa(&rbufp->recv_srcaddr));
+			fullpath, stoa(&payload->recv_srcaddr));
 		/*
 		 * save the output filename in system variable
 		 * savedconfig, retrieved with:
@@ -927,7 +927,7 @@ save_config(
  */
 void
 process_control(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -945,19 +945,19 @@ process_control(
 	 * Save the addresses for error responses
 	 */
 	numctlreq++;
-	rmt_addr = &rbufp->recv_srcaddr;
-	lcl_inter = rbufp->dstaddr;
-	pkt = (struct ntp_control *)&rbufp->recv_pkt;
+	rmt_addr = &payload->recv_srcaddr;
+	lcl_inter = payload->dstaddr;
+	pkt = (struct ntp_control *)&payload->recv_pkt;
 
 	/*
 	 * If the length is less than required for the header, or
 	 * it is a response or a fragment, ignore this.
 	 */
-	if (rbufp->recv_length < (int)CTL_HEADER_LEN
+	if (payload->recv_length < (int)CTL_HEADER_LEN
 	    || (CTL_RESPONSE | CTL_MORE | CTL_ERROR) & pkt->r_m_e_op
 	    || pkt->offset != 0) {
 		DPRINTF(1, ("invalid format in control packet\n"));
-		if (rbufp->recv_length < (int)CTL_HEADER_LEN)
+		if (payload->recv_length < (int)CTL_HEADER_LEN)
 			numctltooshort++;
 		if (CTL_RESPONSE & pkt->r_m_e_op)
 			numctlinputresp++;
@@ -1001,16 +1001,16 @@ process_control(
 	datapt = rpkt.u.data;
 	dataend = &rpkt.u.data[CTL_MAX_DATA_LEN];
 
-	if ((rbufp->recv_length & 0x3) != 0)
+	if ((payload->recv_length & 0x3) != 0)
 		DPRINTF(3, ("Control packet length %zd unrounded\n",
-			    rbufp->recv_length));
+			    payload->recv_length));
 
 	/*
 	 * We're set up now. Make sure we've got at least enough
 	 * incoming data space to match the count.
 	 */
-	req_data = rbufp->recv_length - CTL_HEADER_LEN;
-	if (req_data < req_count || rbufp->recv_length & 0x3) {
+	req_data = payload->recv_length - CTL_HEADER_LEN;
+	if (req_data < req_count || payload->recv_length & 0x3) {
 		ctl_error(CERR_BADFMT);
 		numctldatatooshort++;
 		return;
@@ -1020,21 +1020,21 @@ process_control(
 	/* round up proper len to a 8 octet boundary */
 
 	properlen = (properlen + 7) & ~7;
-	maclen = rbufp->recv_length - properlen;
-	if ((rbufp->recv_length & 3) == 0 &&
+	maclen = payload->recv_length - properlen;
+	if ((payload->recv_length & 3) == 0 &&
 	    maclen >= MIN_MAC_LEN && maclen <= MAX_MAC_LEN &&
 	    sys_authenticate) {
 		res_authenticate = true;
 		pkid = (void *)((char *)pkt + properlen);
 		res_keyid = ntohl(*pkid);
 		DPRINTF(3, ("recv_len %zd, properlen %d, wants auth with keyid %08x, MAC length=%zu\n",
-			    rbufp->recv_length, properlen, res_keyid,
+			    payload->recv_length, properlen, res_keyid,
 			    maclen));
 
 		if (!authistrusted(res_keyid))
 			DPRINTF(3, ("invalid keyid %08x\n", res_keyid));
 		else if (authdecrypt(res_keyid, (uint32_t *)pkt,
-				     rbufp->recv_length - maclen,
+				     payload->recv_length - maclen,
 				     maclen)) {
 			res_authokay = true;
 			DPRINTF(3, ("authenticated okay\n"));
@@ -1063,7 +1063,7 @@ process_control(
 				ctl_error(CERR_PERMISSION);
 				return;
 			}
-			(cc->handler)(rbufp, restrict_mask);
+			(cc->handler)(payload, restrict_mask);
 			return;
 		}
 	}
@@ -2900,13 +2900,13 @@ ctl_getitem(
 /*ARGSUSED*/
 static void
 control_unspec(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
 	struct peer *peer;
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 
 	/*
@@ -2934,7 +2934,7 @@ control_unspec(
 /*ARGSUSED*/
 static void
 read_status(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -2944,7 +2944,7 @@ read_status(
 	/* a_st holds association ID, status pairs alternating */
 	u_short a_st[CTL_MAX_DATA_LEN / sizeof(u_short)];
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 #ifdef DEBUG
 	if (debug > 2)
@@ -3112,11 +3112,11 @@ read_sysvars(void)
 /*ARGSUSED*/
 static void
 read_variables(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 
 	if (res_associd)
@@ -3133,7 +3133,7 @@ read_variables(
 /*ARGSUSED*/
 static void
 write_variables(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -3146,7 +3146,7 @@ write_variables(
 	const char *t;
 	char *tt;
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 
 	val = 0;
@@ -3232,7 +3232,7 @@ write_variables(
  *		generic runtime reconfiguration.
  */
 static void configure(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -3258,7 +3258,7 @@ static void configure(
 		NLOG(NLOG_SYSINFO)
 			msyslog(LOG_NOTICE,
 				"runtime config from %s rejected due to nomodify restriction",
-				stoa(&rbufp->recv_srcaddr));
+				stoa(&payload->recv_srcaddr));
 		sys_restricted++;
 		return;
 	}
@@ -3275,7 +3275,7 @@ static void configure(
 		ctl_flushpkt(0);
 		msyslog(LOG_NOTICE,
 			"runtime config from %s rejected: request too long",
-			stoa(&rbufp->recv_srcaddr));
+			stoa(&payload->recv_srcaddr));
 		return;
 	}
 
@@ -3300,13 +3300,13 @@ static void configure(
 	DPRINTF(1, ("Got Remote Configuration Command: %s\n",
 		remote_config.buffer));
 	msyslog(LOG_NOTICE, "%s config: %s",
-		stoa(&rbufp->recv_srcaddr),
+		stoa(&payload->recv_srcaddr),
 		remote_config.buffer);
 
 	if (replace_nl)
 		remote_config.buffer[data_count - 1] = '\n';
 
-	config_remotely(&rbufp->recv_srcaddr);
+	config_remotely(&payload->recv_srcaddr);
 
 	/*
 	 * Check if errors were reported. If not, output 'Config
@@ -3329,7 +3329,7 @@ static void configure(
 	if (remote_config.no_errors > 0)
 		msyslog(LOG_NOTICE, "%d error in %s config",
 			remote_config.no_errors,
-			stoa(&rbufp->recv_srcaddr));
+			stoa(&payload->recv_srcaddr));
 }
 
 
@@ -3382,18 +3382,18 @@ static uint32_t derive_nonce(
  * generate_nonce - generate client-address-specific nonce string.
  */
 static void generate_nonce(
-	struct recvbuf *	rbufp,
+	struct payload *	payload,
 	char *			nonce,
 	size_t			nonce_octets
 	)
 {
 	uint32_t derived;
 
-	derived = derive_nonce(&rbufp->recv_srcaddr,
-			       rbufp->recv_time.l_ui,
-			       rbufp->recv_time.l_uf);
+	derived = derive_nonce(&payload->recv_srcaddr,
+			       payload->recv_time.l_ui,
+			       payload->recv_time.l_uf);
 	snprintf(nonce, nonce_octets, "%08x%08x%08x",
-		 rbufp->recv_time.l_ui, rbufp->recv_time.l_uf, derived);
+		 payload->recv_time.l_ui, payload->recv_time.l_uf, derived);
 }
 
 
@@ -3405,7 +3405,7 @@ static void generate_nonce(
  */
 static int validate_nonce(
 	const char *		pnonce,
-	struct recvbuf *	rbufp
+	struct payload *	payload
 	)
 {
 	u_int	ts_i;
@@ -3420,7 +3420,7 @@ static int validate_nonce(
 
 	ts.l_ui = (uint32_t)ts_i;
 	ts.l_uf = (uint32_t)ts_f;
-	derived = derive_nonce(&rbufp->recv_srcaddr, ts.l_ui, ts.l_uf);
+	derived = derive_nonce(&payload->recv_srcaddr, ts.l_ui, ts.l_uf);
 	intercept_get_systime(__func__, &now_delta);
 	L_SUB(&now_delta, &ts);
 
@@ -3645,7 +3645,7 @@ send_mru_entry(
  *			entry.
  */
 static void read_mru_list(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -3690,7 +3690,7 @@ static void read_mru_list(
 		NLOG(NLOG_SYSINFO)
 			msyslog(LOG_NOTICE,
 				"mrulist from %s rejected due to nomrulist restriction",
-				stoa(&rbufp->recv_srcaddr));
+				stoa(&payload->recv_srcaddr));
 		sys_restricted++;
 		return;
 	}
@@ -3776,7 +3776,7 @@ static void read_mru_list(
 	if (NULL == pnonce)
 		return;
 
-	nonce_valid = validate_nonce(pnonce, rbufp);
+	nonce_valid = validate_nonce(pnonce, payload);
 	free(pnonce);
 	if (!nonce_valid)
 		return;
@@ -3841,7 +3841,7 @@ static void read_mru_list(
 	 * send up to limit= entries in up to frags= datagrams
 	 */
 	intercept_get_systime(__func__, &now);
-	generate_nonce(rbufp, buf, sizeof(buf));
+	generate_nonce(payload, buf, sizeof(buf));
 	ctl_putunqstr("nonce", buf, strlen(buf));
 	prior_mon = NULL;
 	for (count = 0;
@@ -4013,13 +4013,13 @@ send_ifstats_entry(
  */
 static void
 read_ifstats(
-	struct recvbuf *	rbufp
+	struct payload *	payload
 	)
 {
 	u_int	ifidx;
 	endpt *	la;
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 
 	/*
 	 * loop over [0..sys_ifnum] searching ep_list for each
@@ -4172,12 +4172,12 @@ send_restrict_list(
  */
 static void
 read_addr_restrictions(
-	struct recvbuf *	rbufp
+	struct payload *	payload
 )
 {
 	u_int idx;
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 
 	idx = 0;
 	send_restrict_list(restrictlist4, false, &idx);
@@ -4191,7 +4191,7 @@ read_addr_restrictions(
  */
 static void
 read_ordlist(
-	struct recvbuf *	rbufp,
+	struct payload *	payload,
 	int			restrict_mask
 	)
 {
@@ -4202,7 +4202,7 @@ read_ordlist(
 	struct ntp_control *	cpkt;
 	u_short			qdata_octets;
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 
 	/*
@@ -4216,16 +4216,16 @@ read_ordlist(
 	 * which are access control lists.  Other request data return
 	 * CERR_UNKNOWNVAR.
 	 */
-	cpkt = (struct ntp_control *)&rbufp->recv_pkt;
+	cpkt = (struct ntp_control *)&payload->recv_pkt;
 	qdata_octets = ntohs(cpkt->count);
 	if (0 == qdata_octets || (ifstatint8_ts == qdata_octets &&
 	    !memcmp(ifstats_s, cpkt->u.data, ifstatint8_ts))) {
-		read_ifstats(rbufp);
+		read_ifstats(payload);
 		return;
 	}
 	if (a_r_chars == qdata_octets &&
 	    !memcmp(addr_rst_s, cpkt->u.data, a_r_chars)) {
-		read_addr_restrictions(rbufp);
+		read_addr_restrictions(payload);
 		return;
 	}
 	ctl_error(CERR_UNKNOWNVAR);
@@ -4236,7 +4236,7 @@ read_ordlist(
  * req_nonce - CTL_OP_REQ_NONCE for ntpq -c mrulist prerequisite.
  */
 static void req_nonce(
-	struct recvbuf *	rbufp,
+	struct payload *	payload,
 	int			restrict_mask
 	)
 {
@@ -4244,7 +4244,7 @@ static void req_nonce(
 
 	UNUSED_ARG(restrict_mask);
 
-	generate_nonce(rbufp, buf, sizeof(buf));
+	generate_nonce(payload, buf, sizeof(buf));
 	ctl_putunqstr("nonce", buf, strlen(buf));
 	ctl_flushpkt(0);
 }
@@ -4256,12 +4256,12 @@ static void req_nonce(
 /*ARGSUSED*/
 static void
 read_clockstatus(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
 #ifndef REFCLOCK
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 	/*
 	 * If no refclock support, no data to return
@@ -4279,7 +4279,7 @@ read_clockstatus(
 	struct ctl_var *	kv;
 	struct refclockstat	cs;
 
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 
 	if (res_associd != 0) {
@@ -4368,11 +4368,11 @@ read_clockstatus(
 /*ARGSUSED*/
 static void
 write_clockstatus(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
-	UNUSED_ARG(rbufp);
+	UNUSED_ARG(payload);
 	UNUSED_ARG(restrict_mask);
 
 	ctl_error(CERR_PERMISSION);
@@ -4388,7 +4388,7 @@ write_clockstatus(
  */
 static void
 set_trap(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -4413,7 +4413,7 @@ set_trap(
 	 * Call ctlsettrap() to do the work.  Return
 	 * an error if it can't assign the trap.
 	 */
-	if (!ctlsettrap(&rbufp->recv_srcaddr, rbufp->dstaddr, traptype,
+	if (!ctlsettrap(&payload->recv_srcaddr, payload->dstaddr, traptype,
 			(int)res_version))
 		ctl_error(CERR_NORESOURCE);
 	ctl_flushpkt(0);
@@ -4425,7 +4425,7 @@ set_trap(
  */
 static void
 unset_trap(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int restrict_mask
 	)
 {
@@ -4444,7 +4444,7 @@ unset_trap(
 	/*
 	 * Call ctlclrtrap() to clear this out.
 	 */
-	if (!ctlclrtrap(&rbufp->recv_srcaddr, rbufp->dstaddr, traptype))
+	if (!ctlclrtrap(&payload->recv_srcaddr, payload->dstaddr, traptype))
 		ctl_error(CERR_BADASSOC);
 	ctl_flushpkt(0);
 }


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -3471,26 +3471,26 @@ read_network_packet(
 		return (buflen);
 	}
 
-	fromlen = sizeof(rb->recv_srcaddr);
+	fromlen = sizeof(rb->payload.recv_srcaddr);
 
 #ifndef USE_PACKET_TIMESTAMP
 	rb->recv_length = recvfrom(fd, (char *)&rb->recv_space,
 				   sizeof(rb->recv_space), 0,
 				   &rb->recv_srcaddr.sa, &fromlen);
 #else
-	iovec.iov_base        = &rb->recv_space;
-	iovec.iov_len         = sizeof(rb->recv_space);
-	msghdr.msg_name       = &rb->recv_srcaddr;
+	iovec.iov_base        = &rb->payload.recv_space;
+	iovec.iov_len         = sizeof(rb->payload.recv_space);
+	msghdr.msg_name       = &rb->payload.recv_srcaddr;
 	msghdr.msg_namelen    = fromlen;
 	msghdr.msg_iov        = &iovec;
 	msghdr.msg_iovlen     = 1;
 	msghdr.msg_control    = (void *)&control;
 	msghdr.msg_controllen = sizeof(control);
 	msghdr.msg_flags      = 0;
-	rb->recv_length       = recvmsg(fd, &msghdr, 0);
+	rb->payload.recv_length       = recvmsg(fd, &msghdr, 0);
 #endif
 
-	buflen = rb->recv_length;
+	buflen = rb->payload.recv_length;
 
 	if (buflen == 0 || (buflen == -1 &&
 	    (EWOULDBLOCK == errno
@@ -3502,7 +3502,7 @@ read_network_packet(
 		return (buflen);
 	} else if (buflen < 0) {
 		msyslog(LOG_ERR, "recvfrom(%s) fd=%d: %m",
-			stoa(&rb->recv_srcaddr), fd);
+			stoa(&rb->payload.recv_srcaddr), fd);
 		DPRINTF(5, ("read_network_packet: fd=%d dropped (bad recvfrom)\n",
 			    fd));
 		freerecvbuf(rb);
@@ -3524,7 +3524,7 @@ read_network_packet(
 			!IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&itf->sin))
 			));
 
-		if (   IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&rb->recv_srcaddr))
+		if (   IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&rb->payload.recv_srcaddr))
 		    && !IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&itf->sin))
 		   ) {
 			packets_dropped++;
@@ -3539,13 +3539,13 @@ read_network_packet(
 	 * Got one.  Mark how and when it got here,
 	 * put it on the full list and do bookkeeping.
 	 */
-	rb->dstaddr = itf;
-	rb->fd = fd;
+	rb->payload.dstaddr = itf;
+	rb->payload.fd = fd;
 #ifdef USE_PACKET_TIMESTAMP
 	/* pick up a network time stamp if possible */
 	ts = fetch_timestamp(rb, &msghdr, ts);
 #endif
-	rb->recv_time = ts;
+	rb->payload.recv_time = ts;
 	rb->receiver = receive;
 
 	add_full_recv_buffer(rb);


=====================================
ntpd/ntp_monitor.c
=====================================
--- a/ntpd/ntp_monitor.c
+++ b/ntpd/ntp_monitor.c
@@ -305,7 +305,7 @@ mon_clearinterface(
  */
 u_short
 ntp_monitor(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	u_short	flags
 	)
 {
@@ -326,8 +326,8 @@ ntp_monitor(
 	if (mon_enabled == MON_OFF)
 		return ~(RES_LIMITED | RES_KOD) & flags;
 
-	pkt = &rbufp->recv_pkt;
-	hash = MON_HASH(&rbufp->recv_srcaddr);
+	pkt = &payload->recv_pkt;
+	hash = MON_HASH(&payload->recv_srcaddr);
 	mode = PKT_MODE(pkt->li_vn_mode);
 	version = PKT_VERSION(pkt->li_vn_mode);
 	mon = mon_hash[hash];
@@ -338,17 +338,17 @@ ntp_monitor(
 	 */
 
 	for (; mon != NULL; mon = mon->hash_next)
-		if (SOCK_EQ(&mon->rmtadr, &rbufp->recv_srcaddr))
+		if (SOCK_EQ(&mon->rmtadr, &payload->recv_srcaddr))
 			break;
 
 	if (mon != NULL) {
-		interval_fp = rbufp->recv_time;
+		interval_fp = payload->recv_time;
 		L_SUB(&interval_fp, &mon->last);
 		/* add one-half second to round up */
 		L_ADDUF(&interval_fp, 0x80000000);
 		interval = interval_fp.l_i;
-		mon->last = rbufp->recv_time;
-		NSRCPORT(&mon->rmtadr) = NSRCPORT(&rbufp->recv_srcaddr);
+		mon->last = payload->recv_time;
+		NSRCPORT(&mon->rmtadr) = NSRCPORT(&payload->recv_srcaddr);
 		mon->count++;
 		restrict_mask = flags;
 		mon->vn_mode = VN_MODE(version, mode);
@@ -439,7 +439,7 @@ ntp_monitor(
 		oldest = TAIL_DLIST(mon_mru_list, mru);
 		oldest_age = 0;		/* silence uninit warning */
 		if (oldest != NULL) {
-			interval_fp = rbufp->recv_time;
+			interval_fp = payload->recv_time;
 			L_SUB(&interval_fp, &oldest->last);
 			/* add one-half second to round up */
 			L_ADDUF(&interval_fp, 0x80000000);
@@ -470,17 +470,17 @@ ntp_monitor(
 	 */
 	mru_entries++;
 	mru_peakentries = max(mru_peakentries, mru_entries);
-	mon->last = rbufp->recv_time;
+	mon->last = payload->recv_time;
 	mon->first = mon->last;
 	mon->count = 1;
 	mon->flags = ~(RES_LIMITED | RES_KOD) & flags;
 	mon->leak = 0;
-	memcpy(&mon->rmtadr, &rbufp->recv_srcaddr, sizeof(mon->rmtadr));
+	memcpy(&mon->rmtadr, &payload->recv_srcaddr, sizeof(mon->rmtadr));
 	mon->vn_mode = VN_MODE(version, mode);
-	mon->lcladr = rbufp->dstaddr;
-	mon->cast_flags = (uint8_t)(((rbufp->dstaddr->flags &
-	    INT_MCASTOPEN) && rbufp->fd == mon->lcladr->fd) ? MDF_MCAST
-	    : rbufp->fd == mon->lcladr->bfd ? MDF_BCAST : MDF_UCAST);
+	mon->lcladr = payload->dstaddr;
+	mon->cast_flags = (uint8_t)(((payload->dstaddr->flags &
+	    INT_MCASTOPEN) && payload->fd == mon->lcladr->fd) ? MDF_MCAST
+	    : payload->fd == mon->lcladr->bfd ? MDF_BCAST : MDF_UCAST);
 
 	/*
 	 * Drop him into front of the hash table. Also put him on top of


=====================================
ntpd/ntp_peer.c
=====================================
--- a/ntpd/ntp_peer.c
+++ b/ntpd/ntp_peer.c
@@ -275,7 +275,7 @@ findexistingpeer(
  */
 struct peer *
 findpeer(
-	struct recvbuf *rbufp,
+	struct payload *payload,
 	int		pkt_mode,
 	int *		action
 	)
@@ -287,7 +287,7 @@ findpeer(
 	l_fp		pkt_org;
 
 	findpeer_calls++;
-	srcaddr = &rbufp->recv_srcaddr;
+	srcaddr = &payload->recv_srcaddr;
 	hash = NTP_HASH_ADDR(srcaddr);
 	for (p = peer_hash[hash]; p != NULL; p = p->adr_link) {
 		if (ADDR_PORT_EQ(srcaddr, &p->srcaddr)) {
@@ -310,10 +310,10 @@ findpeer(
 			 */
 			if (MODE_SERVER == pkt_mode &&
 			    AM_PROCPKT == *action) {
-				pkt = &rbufp->recv_pkt;
+				pkt = &payload->recv_pkt;
 				NTOHL_FP(&pkt->org, &pkt_org);
 				if (!L_ISEQU(&p->aorg, &pkt_org) &&
-				    findmanycastpeer(rbufp))
+				    findmanycastpeer(payload))
 					*action = AM_ERR;
 			}
 
@@ -337,12 +337,12 @@ findpeer(
 	 */
 	if (NULL == p) {
 		*action = MATCH_ASSOC(NO_PEER, pkt_mode);
-	} else if (p->dstaddr != rbufp->dstaddr) {
-		set_peerdstaddr(p, rbufp->dstaddr);
-		if (p->dstaddr == rbufp->dstaddr) {
+	} else if (p->dstaddr != payload->dstaddr) {
+		set_peerdstaddr(p, payload->dstaddr);
+		if (p->dstaddr == payload->dstaddr) {
 			DPRINTF(1, ("Changed %s local address to match response\n",
 				    stoa(&p->srcaddr)));
-			return findpeer(rbufp, pkt_mode, action);
+			return findpeer(payload, pkt_mode, action);
 		}
 	}
 	return p;
@@ -1014,7 +1014,7 @@ peer_all_reset(void)
  */
 struct peer *
 findmanycastpeer(
-	struct recvbuf *rbufp	/* receive buffer pointer */
+	struct payload *payload	/* receive buffer pointer */
 	)
 {
 	struct peer *peer;
@@ -1031,7 +1031,7 @@ findmanycastpeer(
 	 * solicitation assocations, so this assumes the transmit
 	 * timestamps are unique for such.
 	 */
-	pkt = &rbufp->recv_pkt;
+	pkt = &payload->recv_pkt;
 	for (peer = peer_list; peer != NULL; peer = peer->p_link)
 		if (MDF_SOLICIT_MASK & peer->cast_flags) {
 			NTOHL_FP(&pkt->org, &p_org);


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -139,7 +139,7 @@ u_long	sys_kodsent;		/* KoD sent */
 static	double	root_distance	(struct peer *);
 static	void	clock_combine	(peer_select *, int, int);
 static	void	peer_xmit	(struct peer *);
-static	void	fast_xmit	(struct recvbuf *, int, keyid_t, int);
+static	void	fast_xmit	(struct payload *, int, keyid_t, int);
 static	void	pool_xmit	(struct peer *);
 static	void	clock_update	(struct peer *);
 static	void	measure_precision(const bool);
@@ -380,7 +380,7 @@ transmit(
  */
 void
 receive(
-	struct recvbuf *rbufp
+	struct payload *payload
 	)
 {
 	register struct peer *peer;	/* peer structure pointer */
@@ -427,16 +427,16 @@ receive(
 	 * reveals a clogging attack.
 	 */
 	sys_received++;
-	if (0 == SRCPORT(&rbufp->recv_srcaddr)) {
+	if (0 == SRCPORT(&payload->recv_srcaddr)) {
 		sys_badlength++;
 		return;				/* bogus port */
 	}
-	restrict_mask = restrictions(&rbufp->recv_srcaddr);
+	restrict_mask = restrictions(&payload->recv_srcaddr);
 	DPRINTF(2, ("receive: at %ld %s<-%s flags %x restrict %03x\n",
-		    current_time, stoa(&rbufp->dstaddr->sin),
-		    stoa(&rbufp->recv_srcaddr),
-		    rbufp->dstaddr->flags, restrict_mask));
-	pkt = &rbufp->recv_pkt;
+		    current_time, stoa(&payload->dstaddr->sin),
+		    stoa(&payload->recv_srcaddr),
+		    payload->dstaddr->flags, restrict_mask));
+	pkt = &payload->recv_pkt;
 	hisversion = PKT_VERSION(pkt->li_vn_mode);
 	hisleap = PKT_LEAP(pkt->li_vn_mode);
 	hismode = (int)PKT_MODE(pkt->li_vn_mode);
@@ -455,7 +455,7 @@ receive(
 			sys_restricted++;
 			return;			/* no query control */
 		}
-		process_control(rbufp, restrict_mask);
+		process_control(payload, restrict_mask);
 		return;
 	}
 	if (restrict_mask & RES_DONTSERVE) {
@@ -516,7 +516,7 @@ receive(
 	 * field and go around again.
 	 */
 	authlen = LEN_PKT_NOMAC;
-	has_mac = rbufp->recv_length - authlen;
+	has_mac = payload->recv_length - authlen;
 	while (has_mac > 0) {
 		uint32_t	len;
 #ifdef ENABLE_AUTOKEY
@@ -537,7 +537,7 @@ receive(
 			opcode = ntohl(((uint32_t *)pkt)[authlen / 4]);
 			len = opcode & 0xffff;
 			if (len % 4 != 0 || len < 4 || (int)len +
-			    authlen > rbufp->recv_length) {
+			    authlen > payload->recv_length) {
 				sys_badlength++;
 				return;		/* bad length */
 			}
@@ -594,21 +594,21 @@ receive(
 	 * RES_LIMITED and RES_KOD will be cleared in the returned
 	 * restrict_mask unless one or both actions are warranted.
 	 */
-	restrict_mask = ntp_monitor(rbufp, restrict_mask);
+	restrict_mask = ntp_monitor(payload, restrict_mask);
 	if (restrict_mask & RES_LIMITED) {
 		sys_limitrejected++;
 		if (!(restrict_mask & RES_KOD) || MODE_BROADCAST ==
 		    hismode || MODE_SERVER == hismode) {
 			if (MODE_SERVER == hismode)
 				DPRINTF(1, ("Possibly self-induced rate limiting of MODE_SERVER from %s\n",
-					stoa(&rbufp->recv_srcaddr)));
+					stoa(&payload->recv_srcaddr)));
 			return;			/* rate exceeded */
 		}
 		if (hismode == MODE_CLIENT)
-			fast_xmit(rbufp, MODE_SERVER, skeyid,
+			fast_xmit(payload, MODE_SERVER, skeyid,
 			    restrict_mask);
 		else
-			fast_xmit(rbufp, MODE_ACTIVE, skeyid,
+			fast_xmit(payload, MODE_ACTIVE, skeyid,
 			    restrict_mask);
 		return;				/* rate exceeded */
 	}
@@ -633,9 +633,9 @@ receive(
 	 * multicaster, the broadcast address is null, so we use the
 	 * unicast address anyway. Don't ask.
 	 */
-	peer = findpeer(rbufp,  hismode, &retcode);
+	peer = findpeer(payload,  hismode, &retcode);
 #ifdef DEBUG
-	dstaddr_sin = &rbufp->dstaddr->sin;
+	dstaddr_sin = &payload->dstaddr->sin;
 #endif
 	NTOHL_FP(&pkt->org, &p_org);
 	NTOHL_FP(&pkt->rec, &p_rec);
@@ -673,7 +673,7 @@ receive(
 			printf(
 			    "receive: at %ld %s<-%s mode %d len %zd\n",
 			    current_time, stoa(dstaddr_sin),
-			    stoa(&rbufp->recv_srcaddr), hismode,
+			    stoa(&payload->recv_srcaddr), hismode,
 			    authlen);
 #endif
 	} else if (has_mac == 4) {
@@ -684,7 +684,7 @@ receive(
 			printf(
 			    "receive: at %ld %s<-%s mode %d keyid %08x len %zd auth %d\n",
 			    current_time, stoa(dstaddr_sin),
-			    stoa(&rbufp->recv_srcaddr), hismode, skeyid,
+			    stoa(&payload->recv_srcaddr), hismode, skeyid,
 			    authlen + has_mac, is_authentic);
 #endif
 
@@ -754,18 +754,18 @@ receive(
 				 * mobilized. However, if this is from
 				 * the wildcard interface, game over.
 				 */
-				if (crypto_flags && rbufp->dstaddr ==
-				    ANY_INTERFACE_CHOOSE(&rbufp->recv_srcaddr)) {
+				if (crypto_flags && payload->dstaddr ==
+				    ANY_INTERFACE_CHOOSE(&payload->recv_srcaddr)) {
 					sys_restricted++;
 					return;	     /* no wildcard */
 				}
 				pkeyid = 0;
-				if (!SOCK_UNSPEC(&rbufp->dstaddr->bcast))
+				if (!SOCK_UNSPEC(&payload->dstaddr->bcast))
 					dstaddr_sin =
-					    &rbufp->dstaddr->bcast;
+					    &payload->dstaddr->bcast;
 			} else if (peer == NULL) {
 				pkeyid = session_key(
-				    &rbufp->recv_srcaddr, dstaddr_sin, 0,
+				    &payload->recv_srcaddr, dstaddr_sin, 0,
 				    sys_private, 0);
 			} else {
 				pkeyid = peer->pcookie;
@@ -779,14 +779,14 @@ receive(
 			 * use later in the autokey mambo.
 			 */
 			if (authlen > LEN_PKT_NOMAC && pkeyid != 0) {
-				session_key(&rbufp->recv_srcaddr,
+				session_key(&payload->recv_srcaddr,
 				    dstaddr_sin, skeyid, 0, 2);
 				tkeyid = session_key(
-				    &rbufp->recv_srcaddr, dstaddr_sin,
+				    &payload->recv_srcaddr, dstaddr_sin,
 				    skeyid, pkeyid, 0);
 			} else {
 				tkeyid = session_key(
-				    &rbufp->recv_srcaddr, dstaddr_sin,
+				    &payload->recv_srcaddr, dstaddr_sin,
 				    skeyid, pkeyid, 2);
 			}
 
@@ -814,7 +814,7 @@ receive(
 			printf(
 			    "receive: at %ld %s<-%s mode %d keyid %08x len %zd auth %d\n",
 			    current_time, stoa(dstaddr_sin),
-			    stoa(&rbufp->recv_srcaddr), hismode, skeyid,
+			    stoa(&payload->recv_srcaddr), hismode, skeyid,
 			    authlen + has_mac, is_authentic);
 #endif
 	}
@@ -843,13 +843,13 @@ receive(
 		 * If authentication OK, send a server reply; otherwise,
 		 * send a crypto-NAK.
 		 */
-		if (!(rbufp->dstaddr->flags & INT_MCASTOPEN)) {
+		if (!(payload->dstaddr->flags & INT_MCASTOPEN)) {
 			if (AUTH(restrict_mask & RES_DONTTRUST,
 			   is_authentic)) {
-				fast_xmit(rbufp, MODE_SERVER, skeyid,
+				fast_xmit(payload, MODE_SERVER, skeyid,
 				    restrict_mask);
 			} else if (is_authentic == AUTH_ERROR) {
-				fast_xmit(rbufp, MODE_SERVER, 0,
+				fast_xmit(payload, MODE_SERVER, 0,
 				    restrict_mask);
 				sys_badauth++;
 			} else {
@@ -884,7 +884,7 @@ receive(
 		 */
 		if (sys_leap == LEAP_NOTINSYNC || sys_stratum >=
 		    hisstratum || (!sys_cohort && sys_stratum ==
-		    hisstratum + 1) || rbufp->dstaddr->addr_refid ==
+		    hisstratum + 1) || payload->dstaddr->addr_refid ==
 		    pkt->refid) {
 			sys_declined++;
 			return;			/* no help */
@@ -895,7 +895,7 @@ receive(
 		 * crypto-NAK, as that would not be useful.
 		 */
 		if (AUTH(restrict_mask & RES_DONTTRUST, is_authentic))
-			fast_xmit(rbufp, MODE_SERVER, skeyid,
+			fast_xmit(payload, MODE_SERVER, skeyid,
 			    restrict_mask);
 		return;				/* hooray */
 
@@ -929,7 +929,7 @@ receive(
 			return;
 		}
 #endif /* ENABLE_AUTOKEY */
-		if ((peer2 = findmanycastpeer(rbufp)) == NULL) {
+		if ((peer2 = findmanycastpeer(payload)) == NULL) {
 			sys_restricted++;
 			return;			/* not enabled */
 		}
@@ -949,7 +949,7 @@ receive(
 			sys_declined++;
 			return;			/* no help */
 		}
-		peer = newpeer(&rbufp->recv_srcaddr, NULL, rbufp->dstaddr,
+		peer = newpeer(&payload->recv_srcaddr, NULL, payload->dstaddr,
 			       MODE_CLIENT, hisversion, peer2->minpoll,
 			       peer2->maxpoll, FLAG_PREEMPT |
 			       (FLAG_IBURST & peer2->flags), MDF_UCAST |
@@ -1034,8 +1034,8 @@ receive(
 		 * ephemeral associations are unique across all local
 		 * endpoints.
 		 */
-		if (!(INT_MCASTOPEN & rbufp->dstaddr->flags))
-			match_ep = rbufp->dstaddr;
+		if (!(INT_MCASTOPEN & payload->dstaddr->flags))
+			match_ep = payload->dstaddr;
 		else
 			match_ep = NULL;
 
@@ -1058,7 +1058,7 @@ receive(
 			 * Do not execute the volley. Start out in
 			 * broadcast client mode.
 			 */
-			peer = newpeer(&rbufp->recv_srcaddr, NULL,
+			peer = newpeer(&payload->recv_srcaddr, NULL,
 			    match_ep, MODE_BCLIENT, hisversion,
 			    pkt->ppoll, pkt->ppoll, FLAG_PREEMPT,
 			    MDF_BCLNT, 0, skeyid, sys_ident);
@@ -1080,7 +1080,7 @@ receive(
 		 * packet, normally 6 (64 s) and that the poll interval
 		 * is fixed at this value.
 		 */
-		peer = newpeer(&rbufp->recv_srcaddr, NULL, match_ep,
+		peer = newpeer(&payload->recv_srcaddr, NULL, match_ep,
 		    MODE_CLIENT, hisversion, pkt->ppoll, pkt->ppoll,
 		    FLAG_BC_VOL | FLAG_IBURST | FLAG_PREEMPT, MDF_BCLNT,
 		    0, skeyid, sys_ident);
@@ -1090,7 +1090,7 @@ receive(
 		}
 #ifdef ENABLE_AUTOKEY
 		if (skeyid > NTP_MAXKEY)
-			crypto_recv(peer, rbufp);
+			crypto_recv(peer, payload);
 #endif	/* ENABLE_AUTOKEY */
 
 		return;				/* hooray */
@@ -1123,12 +1123,12 @@ receive(
 			 */
 			if (AUTH(restrict_mask & RES_DONTTRUST,
 			    is_authentic)) {
-				fast_xmit(rbufp, MODE_PASSIVE, skeyid,
+				fast_xmit(payload, MODE_PASSIVE, skeyid,
 				    restrict_mask);
 				return;			/* hooray */
 			}
 			if (is_authentic == AUTH_ERROR) {
-				fast_xmit(rbufp, MODE_ACTIVE, 0,
+				fast_xmit(payload, MODE_ACTIVE, 0,
 				    restrict_mask);
 				sys_restricted++;
 				return;
@@ -1148,7 +1148,7 @@ receive(
 				 printf(
 					 "receive: at %ld refusing to mobilize passive association"
 					 " with unknown peer %s mode %d keyid %08x len %zd auth %d\n",
-					 current_time, stoa(&rbufp->recv_srcaddr), hismode, skeyid,
+					 current_time, stoa(&payload->recv_srcaddr), hismode, skeyid,
 					 authlen + has_mac, is_authentic);
 			}
 #endif
@@ -1176,8 +1176,8 @@ receive(
 		 * The message is correctly authenticated and allowed.
 		 * Mobilize a symmetric passive association.
 		 */
-		if ((peer = newpeer(&rbufp->recv_srcaddr, NULL,
-		    rbufp->dstaddr, MODE_PASSIVE, hisversion, pkt->ppoll,
+		if ((peer = newpeer(&payload->recv_srcaddr, NULL,
+		    payload->dstaddr, MODE_PASSIVE, hisversion, pkt->ppoll,
 		    NTP_MAXDPOLL, 0, MDF_UCAST, 0, skeyid,
 		    sys_ident)) == NULL) {
 			sys_declined++;
@@ -1268,7 +1268,7 @@ receive(
 		if (!L_ISZERO(&p_org) && !(peer->flags & FLAG_XB)) {
 			peer->flags |= FLAG_XB;
 			peer->aorg = p_xmt;
-			peer->borg = rbufp->recv_time;
+			peer->borg = payload->recv_time;
 			report_event(PEVNT_XLEAVE, peer, NULL);
 			return;
 		}
@@ -1344,7 +1344,7 @@ receive(
 		peer->badauth++;
 		if (has_mac &&
 		    (hismode == MODE_ACTIVE || hismode == MODE_PASSIVE))
-			fast_xmit(rbufp, MODE_ACTIVE, 0, restrict_mask);
+			fast_xmit(payload, MODE_ACTIVE, 0, restrict_mask);
 		if (peer->flags & FLAG_PREEMPT) {
 			unpeer(peer);
 			return;
@@ -1362,7 +1362,7 @@ receive(
 	if (peer->flip == 0) {
 		if (hismode != MODE_BROADCAST)
 			peer->rec = p_xmt;
-		peer->dst = rbufp->recv_time;
+		peer->dst = payload->recv_time;
 	}
 	peer->xmt = p_xmt;
 
@@ -1438,7 +1438,7 @@ receive(
 				ap->seq--;
 		}
 		peer->flash |= BOGON8;
-		rval = crypto_recv(peer, rbufp);
+		rval = crypto_recv(peer, payload);
 		if (rval == XEVNT_OK) {
 			peer->unreach = 0;
 		} else {
@@ -1496,7 +1496,7 @@ receive(
 					break;
 				}
 				tkeyid = session_key(
-				    &rbufp->recv_srcaddr, dstaddr_sin,
+				    &payload->recv_srcaddr, dstaddr_sin,
 				    tkeyid, pkeyid, 0);
 			}
 			if (peer->flash & BOGON8)
@@ -1524,7 +1524,7 @@ receive(
 	 * the packet over the fence for processing, which may light up
 	 * more flashers.
 	 */
-	process_packet(peer, pkt, rbufp->recv_length);
+	process_packet(peer, pkt, payload->recv_length);
 
 	/*
 	 * In interleaved mode update the state variables. Also adjust the
@@ -1532,7 +1532,7 @@ receive(
 	 */
 	if (peer->flip != 0) {
 		peer->rec = p_rec;
-		peer->dst = rbufp->recv_time;
+		peer->dst = payload->recv_time;
 		if (peer->nextdate - current_time < (1U << min(peer->ppoll,
 		    peer->hpoll)) / 2)
 			peer->nextdate++;
@@ -3483,7 +3483,7 @@ leap_smear_add_offs(l_fp *t, l_fp *t_recv) {
  */
 static void
 fast_xmit(
-	struct recvbuf *rbufp,	/* receive packet pointer */
+	struct payload *payload,	/* receive packet pointer */
 	int	xmode,		/* receive mode */
 	keyid_t	xkeyid,		/* transmit key ID */
 	int	flags		/* restrict mask */
@@ -3508,9 +3508,9 @@ fast_xmit(
 	 * If the gazinta was from a multicast address, the gazoutta
 	 * must go out another way.
 	 */
-	rpkt = &rbufp->recv_pkt;
-	if (rbufp->dstaddr->flags & INT_MCASTOPEN)
-		rbufp->dstaddr = findinterface(&rbufp->recv_srcaddr);
+	rpkt = &payload->recv_pkt;
+	if (payload->dstaddr->flags & INT_MCASTOPEN)
+		payload->dstaddr = findinterface(&payload->recv_srcaddr);
 
 	/*
 	 * If this is a kiss-o'-death (KoD) packet, show leap
@@ -3580,12 +3580,12 @@ fast_xmit(
 		xpkt.org = rpkt->xmt;
 
 #ifdef ENABLE_LEAP_SMEAR
-		this_recv_time = rbufp->recv_time;
+		this_recv_time = payload->recv_time;
 		if (leap_smear.in_progress)
 			leap_smear_add_offs(&this_recv_time, NULL);
 		HTONL_FP(&this_recv_time, &xpkt.rec);
 #else
-		HTONL_FP(&rbufp->recv_time, &xpkt.rec);
+		HTONL_FP(&payload->recv_time, &xpkt.rec);
 #endif
 
 		intercept_get_systime(__func__, &xmt_tx);
@@ -3598,7 +3598,7 @@ fast_xmit(
 
 #ifdef ENABLE_MSSNTP
 	if (flags & RES_MSSNTP) {
-		send_via_ntp_signd(rbufp, xmode, xkeyid, flags, &xpkt);
+		send_via_ntp_signd(payload, xmode, xkeyid, flags, &xpkt);
 		return;
 	}
 #endif /* ENABLE_MSSNTP */
@@ -3609,15 +3609,15 @@ fast_xmit(
 	 * packet is not authenticated.
 	 */
 	sendlen = LEN_PKT_NOMAC;
-	if (rbufp->recv_length == sendlen) {
-		intercept_sendpkt(__func__, &rbufp->recv_srcaddr, rbufp->dstaddr, 0, &xpkt,
+	if (payload->recv_length == sendlen) {
+		intercept_sendpkt(__func__, &payload->recv_srcaddr, payload->dstaddr, 0, &xpkt,
 		    sendlen);
 #ifdef DEBUG
 		if (debug)
 			printf(
 			    "transmit: at %ld %s->%s mode %d len %zd\n",
-			    current_time, stoa(&rbufp->dstaddr->sin),
-			    stoa(&rbufp->recv_srcaddr), xmode, sendlen);
+			    current_time, stoa(&payload->dstaddr->sin),
+			    stoa(&payload->recv_srcaddr), xmode, sendlen);
 #endif
 		return;
 	}
@@ -3643,19 +3643,19 @@ fast_xmit(
 		 * jerk can decode it. If no extension field is present,
 		 * use the cookie to generate the session key.
 		 */
-		cookie = session_key(&rbufp->recv_srcaddr,
-		    &rbufp->dstaddr->sin, 0, sys_private, 0);
-		if (rbufp->recv_length > sendlen + (int)MAX_MAC_LEN) {
-			session_key(&rbufp->dstaddr->sin,
-			    &rbufp->recv_srcaddr, xkeyid, 0, 2);
+		cookie = session_key(&payload->recv_srcaddr,
+		    &payload->dstaddr->sin, 0, sys_private, 0);
+		if (payload->recv_length > sendlen + (int)MAX_MAC_LEN) {
+			session_key(&payload->dstaddr->sin,
+			    &payload->recv_srcaddr, xkeyid, 0, 2);
 			temp32 = CRYPTO_RESP;
 			rpkt->exten[0] |= htonl(temp32);
-			sendlen += crypto_xmit(NULL, &xpkt, rbufp,
+			sendlen += crypto_xmit(NULL, &xpkt, payload,
 			    sendlen, (struct exten *)rpkt->exten,
 			    cookie);
 		} else {
-			session_key(&rbufp->dstaddr->sin,
-			    &rbufp->recv_srcaddr, xkeyid, cookie, 2);
+			session_key(&payload->dstaddr->sin,
+			    &payload->recv_srcaddr, xkeyid, cookie, 2);
 		}
 	}
 #endif	/* ENABLE_AUTOKEY */
@@ -3665,7 +3665,7 @@ fast_xmit(
 	if (xkeyid > NTP_MAXKEY)
 		authtrust(xkeyid, 0);
 #endif	/* ENABLE_AUTOKEY */
-	intercept_sendpkt(__func__, &rbufp->recv_srcaddr, rbufp->dstaddr, 0, &xpkt, sendlen);
+	intercept_sendpkt(__func__, &payload->recv_srcaddr, payload->dstaddr, 0, &xpkt, sendlen);
 	intercept_get_systime(__func__, &xmt_ty);
 	L_SUB(&xmt_ty, &xmt_tx);
 	sys_authdelay = xmt_ty;
@@ -3673,8 +3673,8 @@ fast_xmit(
 	if (debug)
 		printf(
 		    "transmit: at %ld %s->%s mode %d keyid %08x len %zd\n",
-		    current_time, ntoa(&rbufp->dstaddr->sin),
-		    ntoa(&rbufp->recv_srcaddr), xmode, xkeyid, sendlen);
+		    current_time, ntoa(&payload->dstaddr->sin),
+		    ntoa(&payload->recv_srcaddr), xmode, xkeyid, sendlen);
 #endif
 }
 


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -1010,7 +1010,7 @@ static void mainloop(void)
 					collect_timing(rbuf, "buffer processing delay", 1, &dts);
 					bufcount++;
 # endif
-					(*rbuf->receiver)(rbuf);
+					(*rbuf->receiver)(&rbuf->payload);
 				} else {
 					msyslog(LOG_ERR, "fatal: receive buffer callback NULL");
 					abort();



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151205/04d81773/attachment.html>


More information about the vc mailing list