<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Eric S. Raymond pushed to branch master at <a href="https://gitlab.com/NTPsec/ntpsec">NTPsec / ntpsec</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c">175b58dc</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-05T08:36:30Z</i>
</div>
<pre class='commit-message'>Split out the payload part of the recvbuf structure.
No logic changes. Narrows the interface of the protocol machine's
receive hook.</pre>
</li>
</ul>
<h4>9 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
include/ntpd.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
include/recvbuff.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
libntp/recvbuff.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
ntpd/ntp_control.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
ntpd/ntp_io.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
ntpd/ntp_monitor.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-6'>
ntpd/ntp_peer.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-7'>
ntpd/ntp_proto.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-8'>
ntpd/ntpd.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-0'>
<strong>
include/ntpd.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/include/ntpd.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/include/ntpd.h
</span><span style="color: #aaaaaa">@@ -64,7 +64,7 @@ extern u_short ctlpeerstatus (struct peer *);
</span> extern bool ctlsettrap (sockaddr_u *, struct interface *, int, int);
extern u_short ctlsysstatus (void);
extern void init_control (void);
<span style="color: #000000;background-color: #ffdddd">-extern void process_control (struct recvbuf *, int);
</span><span style="color: #000000;background-color: #ddffdd">+extern void process_control (struct payload *, int);
</span> extern void report_event (int, struct peer *, const char *);
extern int mprintf_event (int, struct peer *, const char *, ...)
NTP_PRINTF(3, 4);
<span style="color: #aaaaaa">@@ -161,14 +161,14 @@ extern int freq_cnt;
</span> extern void init_mon (void);
extern void mon_start (int);
extern void mon_stop (int);
<span style="color: #000000;background-color: #ffdddd">-extern u_short ntp_monitor (struct recvbuf *, u_short);
</span><span style="color: #000000;background-color: #ddffdd">+extern u_short ntp_monitor (struct payload *, u_short);
</span> 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);
<span style="color: #000000;background-color: #ffdddd">-extern struct peer *findpeer (struct recvbuf *, int, int *);
</span><span style="color: #000000;background-color: #ddffdd">+extern struct peer *findpeer (struct payload *, int, int *);
</span> extern struct peer *findpeerbyassoc(associd_t);
extern void set_peerdstaddr (struct peer *, endpt *);
extern struct peer *newpeer (sockaddr_u *, const char *,
<span style="color: #aaaaaa">@@ -186,7 +186,7 @@ extern void refresh_all_peerinterfaces(void);
</span> extern void unpeer (struct peer *);
extern void clear_all (void);
extern int score_all (struct peer *);
<span style="color: #000000;background-color: #ffdddd">-extern struct peer *findmanycastpeer(struct recvbuf *);
</span><span style="color: #000000;background-color: #ddffdd">+extern struct peer *findmanycastpeer(struct payload *);
</span> extern void peer_cleanup (void);
/* ntp_crypto.c */
<span style="color: #aaaaaa">@@ -217,7 +217,7 @@ extern struct value tai_leap;
</span>
/* ntp_proto.c */
extern void transmit (struct peer *);
<span style="color: #000000;background-color: #ffdddd">-extern void receive (struct recvbuf *);
</span><span style="color: #000000;background-color: #ddffdd">+extern void receive (struct payload *);
</span> extern void peer_clear (struct peer *, const char *);
extern void process_packet (struct peer *, struct pkt *, u_int);
extern void clock_select (void);
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-1'>
<strong>
include/recvbuff.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/include/recvbuff.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/include/recvbuff.h
</span><span style="color: #aaaaaa">@@ -44,10 +44,7 @@ extern HANDLE get_recv_buff_event(void);
</span> #define RX_BUFF_SIZE 1000 /* hail Mary */
<span style="color: #000000;background-color: #ffdddd">-typedef struct recvbuf recvbuf_t;
-
-struct recvbuf {
- recvbuf_t * link; /* next in list */
</span><span style="color: #000000;background-color: #ddffdd">+struct payload {
</span> union {
sockaddr_u X_recv_srcaddr; /* where packet came from */
void * X_recv_srcclock;
<span style="color: #aaaaaa">@@ -63,7 +60,6 @@ struct recvbuf {
</span> SOCKET fd; /* fd on which it was received */
int msg_flags; /* Flags received about the packet */
l_fp recv_time; /* time of arrival */
<span style="color: #000000;background-color: #ffdddd">- void (*receiver)(struct recvbuf *); /* callback */
</span> size_t recv_length; /* number of octets received */
union {
struct pkt X_recv_pkt;
<span style="color: #aaaaaa">@@ -71,7 +67,15 @@ struct recvbuf {
</span> } recv_space;
#define recv_pkt recv_space.X_recv_pkt
#define recv_buffer recv_space.X_recv_buffer
<span style="color: #000000;background-color: #ffdddd">- int used; /* reference count */
</span><span style="color: #000000;background-color: #ddffdd">+};
+
+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 */
</span> };
extern void init_recvbuff(int);
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-2'>
<strong>
libntp/recvbuff.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/libntp/recvbuff.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/libntp/recvbuff.c
</span><span style="color: #aaaaaa">@@ -276,7 +276,7 @@ purge_recv_buffers_for_fd(
</span> rbufp != NULL;
rbufp = next) {
next = rbufp->link;
<span style="color: #000000;background-color: #ffdddd">- if (rbufp->fd == fd) {
</span><span style="color: #000000;background-color: #ddffdd">+ if (rbufp->payload.fd == fd) {
</span> UNLINK_MID_FIFO(punlinked, full_recv_fifo,
rbufp, link, recvbuf_t);
INSIST(punlinked == rbufp);
</code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-3'>
<strong>
ntpd/ntp_control.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_control.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_control.c
</span><span style="color: #aaaaaa">@@ -37,7 +37,7 @@ struct ctl_proc {
</span> /* Only one flag. Authentication required or not. */
#define NOAUTH 0
#define AUTH 1
<span style="color: #000000;background-color: #ffdddd">- void (*handler) (struct recvbuf *, int); /* handle request */
</span><span style="color: #000000;background-color: #ddffdd">+ void (*handler) (struct payload *, int); /* handle request */
</span> };
<span style="color: #aaaaaa">@@ -73,33 +73,33 @@ static void ctl_putclock (int, struct refclockstat *, int);
</span> static const struct ctl_var *ctl_getitem(const struct ctl_var *,
char **);
static u_short count_var (const struct ctl_var *);
<span style="color: #000000;background-color: #ffdddd">-static void control_unspec (struct recvbuf *, int);
-static void read_status (struct recvbuf *, int);
</span><span style="color: #000000;background-color: #ddffdd">+static void control_unspec (struct payload *, int);
+static void read_status (struct payload *, int);
</span> static void read_sysvars (void);
static void read_peervars (void);
<span style="color: #000000;background-color: #ffdddd">-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);
</span><span style="color: #000000;background-color: #ddffdd">+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);
</span> static void send_mru_entry (mon_entry *, int);
static void send_random_tag_value(int);
<span style="color: #000000;background-color: #ffdddd">-static void read_mru_list (struct recvbuf *, int);
</span><span style="color: #000000;background-color: #ddffdd">+static void read_mru_list (struct payload *, int);
</span> static void send_ifstats_entry(endpt *, u_int);
<span style="color: #000000;background-color: #ffdddd">-static void read_ifstats (struct recvbuf *);
</span><span style="color: #000000;background-color: #ddffdd">+static void read_ifstats (struct payload *);
</span> 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 *);
<span style="color: #000000;background-color: #ffdddd">-static void read_addr_restrictions(struct recvbuf *);
-static void read_ordlist (struct recvbuf *, int);
</span><span style="color: #000000;background-color: #ddffdd">+static void read_addr_restrictions(struct payload *);
+static void read_ordlist (struct payload *, int);
</span> static uint32_t derive_nonce (sockaddr_u *, uint32_t, uint32_t);
<span style="color: #000000;background-color: #ffdddd">-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);
</span><span style="color: #000000;background-color: #ddffdd">+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);
</span> static struct ctl_trap *ctlfindtrap(sockaddr_u *,
struct interface *);
<span style="color: #aaaaaa">@@ -796,7 +796,7 @@ ctl_error(
</span> */
void
save_config(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -821,7 +821,7 @@ save_config(
</span> NLOG(NLOG_SYSINFO)
msyslog(LOG_NOTICE,
"saveconfig from %s rejected due to nomodify restriction",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> sys_restricted++;
return;
}
<span style="color: #aaaaaa">@@ -835,7 +835,7 @@ save_config(
</span> NLOG(NLOG_SYSINFO)
msyslog(LOG_NOTICE,
"saveconfig from %s rejected, no saveconfigdir",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> return;
}
<span style="color: #aaaaaa">@@ -873,7 +873,7 @@ save_config(
</span> ctl_flushpkt(0);
msyslog(LOG_NOTICE,
"saveconfig with path from %s rejected",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> return;
}
<span style="color: #aaaaaa">@@ -893,13 +893,13 @@ save_config(
</span> filename);
msyslog(LOG_ERR,
"saveconfig %s from %s failed", filename,
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> } else {
snprintf(reply, sizeof(reply),
"Configuration saved to %s", filename);
msyslog(LOG_NOTICE,
"Configuration saved to %s (requested by %s)",
<span style="color: #000000;background-color: #ffdddd">- fullpath, stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ fullpath, stoa(&payload->recv_srcaddr));
</span> /*
* save the output filename in system variable
* savedconfig, retrieved with:
<span style="color: #aaaaaa">@@ -927,7 +927,7 @@ save_config(
</span> */
void
process_control(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -945,19 +945,19 @@ process_control(
</span> * Save the addresses for error responses
*/
numctlreq++;
<span style="color: #000000;background-color: #ffdddd">- rmt_addr = &rbufp->recv_srcaddr;
- lcl_inter = rbufp->dstaddr;
- pkt = (struct ntp_control *)&rbufp->recv_pkt;
</span><span style="color: #000000;background-color: #ddffdd">+ rmt_addr = &payload->recv_srcaddr;
+ lcl_inter = payload->dstaddr;
+ pkt = (struct ntp_control *)&payload->recv_pkt;
</span>
/*
* If the length is less than required for the header, or
* it is a response or a fragment, ignore this.
*/
<span style="color: #000000;background-color: #ffdddd">- if (rbufp->recv_length < (int)CTL_HEADER_LEN
</span><span style="color: #000000;background-color: #ddffdd">+ if (payload->recv_length < (int)CTL_HEADER_LEN
</span> || (CTL_RESPONSE | CTL_MORE | CTL_ERROR) & pkt->r_m_e_op
|| pkt->offset != 0) {
DPRINTF(1, ("invalid format in control packet\n"));
<span style="color: #000000;background-color: #ffdddd">- if (rbufp->recv_length < (int)CTL_HEADER_LEN)
</span><span style="color: #000000;background-color: #ddffdd">+ if (payload->recv_length < (int)CTL_HEADER_LEN)
</span> numctltooshort++;
if (CTL_RESPONSE & pkt->r_m_e_op)
numctlinputresp++;
<span style="color: #aaaaaa">@@ -1001,16 +1001,16 @@ process_control(
</span> datapt = rpkt.u.data;
dataend = &rpkt.u.data[CTL_MAX_DATA_LEN];
<span style="color: #000000;background-color: #ffdddd">- if ((rbufp->recv_length & 0x3) != 0)
</span><span style="color: #000000;background-color: #ddffdd">+ if ((payload->recv_length & 0x3) != 0)
</span> DPRINTF(3, ("Control packet length %zd unrounded\n",
<span style="color: #000000;background-color: #ffdddd">- rbufp->recv_length));
</span><span style="color: #000000;background-color: #ddffdd">+ payload->recv_length));
</span>
/*
* We're set up now. Make sure we've got at least enough
* incoming data space to match the count.
*/
<span style="color: #000000;background-color: #ffdddd">- req_data = rbufp->recv_length - CTL_HEADER_LEN;
- if (req_data < req_count || rbufp->recv_length & 0x3) {
</span><span style="color: #000000;background-color: #ddffdd">+ req_data = payload->recv_length - CTL_HEADER_LEN;
+ if (req_data < req_count || payload->recv_length & 0x3) {
</span> ctl_error(CERR_BADFMT);
numctldatatooshort++;
return;
<span style="color: #aaaaaa">@@ -1020,21 +1020,21 @@ process_control(
</span> /* round up proper len to a 8 octet boundary */
properlen = (properlen + 7) & ~7;
<span style="color: #000000;background-color: #ffdddd">- maclen = rbufp->recv_length - properlen;
- if ((rbufp->recv_length & 3) == 0 &&
</span><span style="color: #000000;background-color: #ddffdd">+ maclen = payload->recv_length - properlen;
+ if ((payload->recv_length & 3) == 0 &&
</span> 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",
<span style="color: #000000;background-color: #ffdddd">- rbufp->recv_length, properlen, res_keyid,
</span><span style="color: #000000;background-color: #ddffdd">+ payload->recv_length, properlen, res_keyid,
</span> maclen));
if (!authistrusted(res_keyid))
DPRINTF(3, ("invalid keyid %08x\n", res_keyid));
else if (authdecrypt(res_keyid, (uint32_t *)pkt,
<span style="color: #000000;background-color: #ffdddd">- rbufp->recv_length - maclen,
</span><span style="color: #000000;background-color: #ddffdd">+ payload->recv_length - maclen,
</span> maclen)) {
res_authokay = true;
DPRINTF(3, ("authenticated okay\n"));
<span style="color: #aaaaaa">@@ -1063,7 +1063,7 @@ process_control(
</span> ctl_error(CERR_PERMISSION);
return;
}
<span style="color: #000000;background-color: #ffdddd">- (cc->handler)(rbufp, restrict_mask);
</span><span style="color: #000000;background-color: #ddffdd">+ (cc->handler)(payload, restrict_mask);
</span> return;
}
}
<span style="color: #aaaaaa">@@ -2900,13 +2900,13 @@ ctl_getitem(
</span> /*ARGSUSED*/
static void
control_unspec(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
struct peer *peer;
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
/*
<span style="color: #aaaaaa">@@ -2934,7 +2934,7 @@ control_unspec(
</span> /*ARGSUSED*/
static void
read_status(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -2944,7 +2944,7 @@ read_status(
</span> /* a_st holds association ID, status pairs alternating */
u_short a_st[CTL_MAX_DATA_LEN / sizeof(u_short)];
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
#ifdef DEBUG
if (debug > 2)
<span style="color: #aaaaaa">@@ -3112,11 +3112,11 @@ read_sysvars(void)
</span> /*ARGSUSED*/
static void
read_variables(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
if (res_associd)
<span style="color: #aaaaaa">@@ -3133,7 +3133,7 @@ read_variables(
</span> /*ARGSUSED*/
static void
write_variables(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -3146,7 +3146,7 @@ write_variables(
</span> const char *t;
char *tt;
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
val = 0;
<span style="color: #aaaaaa">@@ -3232,7 +3232,7 @@ write_variables(
</span> * generic runtime reconfiguration.
*/
static void configure(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -3258,7 +3258,7 @@ static void configure(
</span> NLOG(NLOG_SYSINFO)
msyslog(LOG_NOTICE,
"runtime config from %s rejected due to nomodify restriction",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> sys_restricted++;
return;
}
<span style="color: #aaaaaa">@@ -3275,7 +3275,7 @@ static void configure(
</span> ctl_flushpkt(0);
msyslog(LOG_NOTICE,
"runtime config from %s rejected: request too long",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> return;
}
<span style="color: #aaaaaa">@@ -3300,13 +3300,13 @@ static void configure(
</span> DPRINTF(1, ("Got Remote Configuration Command: %s\n",
remote_config.buffer));
msyslog(LOG_NOTICE, "%s config: %s",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr),
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr),
</span> remote_config.buffer);
if (replace_nl)
remote_config.buffer[data_count - 1] = '\n';
<span style="color: #000000;background-color: #ffdddd">- config_remotely(&rbufp->recv_srcaddr);
</span><span style="color: #000000;background-color: #ddffdd">+ config_remotely(&payload->recv_srcaddr);
</span>
/*
* Check if errors were reported. If not, output 'Config
<span style="color: #aaaaaa">@@ -3329,7 +3329,7 @@ static void configure(
</span> if (remote_config.no_errors > 0)
msyslog(LOG_NOTICE, "%d error in %s config",
remote_config.no_errors,
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> }
<span style="color: #aaaaaa">@@ -3382,18 +3382,18 @@ static uint32_t derive_nonce(
</span> * generate_nonce - generate client-address-specific nonce string.
*/
static void generate_nonce(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf * rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload * payload,
</span> char * nonce,
size_t nonce_octets
)
{
uint32_t derived;
<span style="color: #000000;background-color: #ffdddd">- derived = derive_nonce(&rbufp->recv_srcaddr,
- rbufp->recv_time.l_ui,
- rbufp->recv_time.l_uf);
</span><span style="color: #000000;background-color: #ddffdd">+ derived = derive_nonce(&payload->recv_srcaddr,
+ payload->recv_time.l_ui,
+ payload->recv_time.l_uf);
</span> snprintf(nonce, nonce_octets, "%08x%08x%08x",
<span style="color: #000000;background-color: #ffdddd">- rbufp->recv_time.l_ui, rbufp->recv_time.l_uf, derived);
</span><span style="color: #000000;background-color: #ddffdd">+ payload->recv_time.l_ui, payload->recv_time.l_uf, derived);
</span> }
<span style="color: #aaaaaa">@@ -3405,7 +3405,7 @@ static void generate_nonce(
</span> */
static int validate_nonce(
const char * pnonce,
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf * rbufp
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload * payload
</span> )
{
u_int ts_i;
<span style="color: #aaaaaa">@@ -3420,7 +3420,7 @@ static int validate_nonce(
</span>
ts.l_ui = (uint32_t)ts_i;
ts.l_uf = (uint32_t)ts_f;
<span style="color: #000000;background-color: #ffdddd">- derived = derive_nonce(&rbufp->recv_srcaddr, ts.l_ui, ts.l_uf);
</span><span style="color: #000000;background-color: #ddffdd">+ derived = derive_nonce(&payload->recv_srcaddr, ts.l_ui, ts.l_uf);
</span> intercept_get_systime(__func__, &now_delta);
L_SUB(&now_delta, &ts);
<span style="color: #aaaaaa">@@ -3645,7 +3645,7 @@ send_mru_entry(
</span> * entry.
*/
static void read_mru_list(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -3690,7 +3690,7 @@ static void read_mru_list(
</span> NLOG(NLOG_SYSINFO)
msyslog(LOG_NOTICE,
"mrulist from %s rejected due to nomrulist restriction",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr));
</span> sys_restricted++;
return;
}
<span style="color: #aaaaaa">@@ -3776,7 +3776,7 @@ static void read_mru_list(
</span> if (NULL == pnonce)
return;
<span style="color: #000000;background-color: #ffdddd">- nonce_valid = validate_nonce(pnonce, rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ nonce_valid = validate_nonce(pnonce, payload);
</span> free(pnonce);
if (!nonce_valid)
return;
<span style="color: #aaaaaa">@@ -3841,7 +3841,7 @@ static void read_mru_list(
</span> * send up to limit= entries in up to frags= datagrams
*/
intercept_get_systime(__func__, &now);
<span style="color: #000000;background-color: #ffdddd">- generate_nonce(rbufp, buf, sizeof(buf));
</span><span style="color: #000000;background-color: #ddffdd">+ generate_nonce(payload, buf, sizeof(buf));
</span> ctl_putunqstr("nonce", buf, strlen(buf));
prior_mon = NULL;
for (count = 0;
<span style="color: #aaaaaa">@@ -4013,13 +4013,13 @@ send_ifstats_entry(
</span> */
static void
read_ifstats(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf * rbufp
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload * payload
</span> )
{
u_int ifidx;
endpt * la;
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span>
/*
* loop over [0..sys_ifnum] searching ep_list for each
<span style="color: #aaaaaa">@@ -4172,12 +4172,12 @@ send_restrict_list(
</span> */
static void
read_addr_restrictions(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf * rbufp
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload * payload
</span> )
{
u_int idx;
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span>
idx = 0;
send_restrict_list(restrictlist4, false, &idx);
<span style="color: #aaaaaa">@@ -4191,7 +4191,7 @@ read_addr_restrictions(
</span> */
static void
read_ordlist(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf * rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload * payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -4202,7 +4202,7 @@ read_ordlist(
</span> struct ntp_control * cpkt;
u_short qdata_octets;
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
/*
<span style="color: #aaaaaa">@@ -4216,16 +4216,16 @@ read_ordlist(
</span> * which are access control lists. Other request data return
* CERR_UNKNOWNVAR.
*/
<span style="color: #000000;background-color: #ffdddd">- cpkt = (struct ntp_control *)&rbufp->recv_pkt;
</span><span style="color: #000000;background-color: #ddffdd">+ cpkt = (struct ntp_control *)&payload->recv_pkt;
</span> qdata_octets = ntohs(cpkt->count);
if (0 == qdata_octets || (ifstatint8_ts == qdata_octets &&
!memcmp(ifstats_s, cpkt->u.data, ifstatint8_ts))) {
<span style="color: #000000;background-color: #ffdddd">- read_ifstats(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ read_ifstats(payload);
</span> return;
}
if (a_r_chars == qdata_octets &&
!memcmp(addr_rst_s, cpkt->u.data, a_r_chars)) {
<span style="color: #000000;background-color: #ffdddd">- read_addr_restrictions(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ read_addr_restrictions(payload);
</span> return;
}
ctl_error(CERR_UNKNOWNVAR);
<span style="color: #aaaaaa">@@ -4236,7 +4236,7 @@ read_ordlist(
</span> * req_nonce - CTL_OP_REQ_NONCE for ntpq -c mrulist prerequisite.
*/
static void req_nonce(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf * rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload * payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -4244,7 +4244,7 @@ static void req_nonce(
</span>
UNUSED_ARG(restrict_mask);
<span style="color: #000000;background-color: #ffdddd">- generate_nonce(rbufp, buf, sizeof(buf));
</span><span style="color: #000000;background-color: #ddffdd">+ generate_nonce(payload, buf, sizeof(buf));
</span> ctl_putunqstr("nonce", buf, strlen(buf));
ctl_flushpkt(0);
}
<span style="color: #aaaaaa">@@ -4256,12 +4256,12 @@ static void req_nonce(
</span> /*ARGSUSED*/
static void
read_clockstatus(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
#ifndef REFCLOCK
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
/*
* If no refclock support, no data to return
<span style="color: #aaaaaa">@@ -4279,7 +4279,7 @@ read_clockstatus(
</span> struct ctl_var * kv;
struct refclockstat cs;
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
if (res_associd != 0) {
<span style="color: #aaaaaa">@@ -4368,11 +4368,11 @@ read_clockstatus(
</span> /*ARGSUSED*/
static void
write_clockstatus(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #000000;background-color: #ffdddd">- UNUSED_ARG(rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ UNUSED_ARG(payload);
</span> UNUSED_ARG(restrict_mask);
ctl_error(CERR_PERMISSION);
<span style="color: #aaaaaa">@@ -4388,7 +4388,7 @@ write_clockstatus(
</span> */
static void
set_trap(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -4413,7 +4413,7 @@ set_trap(
</span> * Call ctlsettrap() to do the work. Return
* an error if it can't assign the trap.
*/
<span style="color: #000000;background-color: #ffdddd">- if (!ctlsettrap(&rbufp->recv_srcaddr, rbufp->dstaddr, traptype,
</span><span style="color: #000000;background-color: #ddffdd">+ if (!ctlsettrap(&payload->recv_srcaddr, payload->dstaddr, traptype,
</span> (int)res_version))
ctl_error(CERR_NORESOURCE);
ctl_flushpkt(0);
<span style="color: #aaaaaa">@@ -4425,7 +4425,7 @@ set_trap(
</span> */
static void
unset_trap(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int restrict_mask
)
{
<span style="color: #aaaaaa">@@ -4444,7 +4444,7 @@ unset_trap(
</span> /*
* Call ctlclrtrap() to clear this out.
*/
<span style="color: #000000;background-color: #ffdddd">- if (!ctlclrtrap(&rbufp->recv_srcaddr, rbufp->dstaddr, traptype))
</span><span style="color: #000000;background-color: #ddffdd">+ if (!ctlclrtrap(&payload->recv_srcaddr, payload->dstaddr, traptype))
</span> ctl_error(CERR_BADASSOC);
ctl_flushpkt(0);
}
</code></pre>
<br>
</li>
<li id='diff-4'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-4'>
<strong>
ntpd/ntp_io.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_io.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_io.c
</span><span style="color: #aaaaaa">@@ -3471,26 +3471,26 @@ read_network_packet(
</span> return (buflen);
}
<span style="color: #000000;background-color: #ffdddd">- fromlen = sizeof(rb->recv_srcaddr);
</span><span style="color: #000000;background-color: #ddffdd">+ fromlen = sizeof(rb->payload.recv_srcaddr);
</span>
#ifndef USE_PACKET_TIMESTAMP
rb->recv_length = recvfrom(fd, (char *)&rb->recv_space,
sizeof(rb->recv_space), 0,
&rb->recv_srcaddr.sa, &fromlen);
#else
<span style="color: #000000;background-color: #ffdddd">- iovec.iov_base = &rb->recv_space;
- iovec.iov_len = sizeof(rb->recv_space);
- msghdr.msg_name = &rb->recv_srcaddr;
</span><span style="color: #000000;background-color: #ddffdd">+ iovec.iov_base = &rb->payload.recv_space;
+ iovec.iov_len = sizeof(rb->payload.recv_space);
+ msghdr.msg_name = &rb->payload.recv_srcaddr;
</span> 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;
<span style="color: #000000;background-color: #ffdddd">- rb->recv_length = recvmsg(fd, &msghdr, 0);
</span><span style="color: #000000;background-color: #ddffdd">+ rb->payload.recv_length = recvmsg(fd, &msghdr, 0);
</span> #endif
<span style="color: #000000;background-color: #ffdddd">- buflen = rb->recv_length;
</span><span style="color: #000000;background-color: #ddffdd">+ buflen = rb->payload.recv_length;
</span>
if (buflen == 0 || (buflen == -1 &&
(EWOULDBLOCK == errno
<span style="color: #aaaaaa">@@ -3502,7 +3502,7 @@ read_network_packet(
</span> return (buflen);
} else if (buflen < 0) {
msyslog(LOG_ERR, "recvfrom(%s) fd=%d: %m",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rb->recv_srcaddr), fd);
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&rb->payload.recv_srcaddr), fd);
</span> DPRINTF(5, ("read_network_packet: fd=%d dropped (bad recvfrom)\n",
fd));
freerecvbuf(rb);
<span style="color: #aaaaaa">@@ -3524,7 +3524,7 @@ read_network_packet(
</span> !IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&itf->sin))
));
<span style="color: #000000;background-color: #ffdddd">- if ( IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&rb->recv_srcaddr))
</span><span style="color: #000000;background-color: #ddffdd">+ if ( IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&rb->payload.recv_srcaddr))
</span> && !IN6_IS_ADDR_LOOPBACK(PSOCK_ADDR6(&itf->sin))
) {
packets_dropped++;
<span style="color: #aaaaaa">@@ -3539,13 +3539,13 @@ read_network_packet(
</span> * Got one. Mark how and when it got here,
* put it on the full list and do bookkeeping.
*/
<span style="color: #000000;background-color: #ffdddd">- rb->dstaddr = itf;
- rb->fd = fd;
</span><span style="color: #000000;background-color: #ddffdd">+ rb->payload.dstaddr = itf;
+ rb->payload.fd = fd;
</span> #ifdef USE_PACKET_TIMESTAMP
/* pick up a network time stamp if possible */
ts = fetch_timestamp(rb, &msghdr, ts);
#endif
<span style="color: #000000;background-color: #ffdddd">- rb->recv_time = ts;
</span><span style="color: #000000;background-color: #ddffdd">+ rb->payload.recv_time = ts;
</span> rb->receiver = receive;
add_full_recv_buffer(rb);
</code></pre>
<br>
</li>
<li id='diff-5'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-5'>
<strong>
ntpd/ntp_monitor.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_monitor.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_monitor.c
</span><span style="color: #aaaaaa">@@ -305,7 +305,7 @@ mon_clearinterface(
</span> */
u_short
ntp_monitor(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> u_short flags
)
{
<span style="color: #aaaaaa">@@ -326,8 +326,8 @@ ntp_monitor(
</span> if (mon_enabled == MON_OFF)
return ~(RES_LIMITED | RES_KOD) & flags;
<span style="color: #000000;background-color: #ffdddd">- pkt = &rbufp->recv_pkt;
- hash = MON_HASH(&rbufp->recv_srcaddr);
</span><span style="color: #000000;background-color: #ddffdd">+ pkt = &payload->recv_pkt;
+ hash = MON_HASH(&payload->recv_srcaddr);
</span> mode = PKT_MODE(pkt->li_vn_mode);
version = PKT_VERSION(pkt->li_vn_mode);
mon = mon_hash[hash];
<span style="color: #aaaaaa">@@ -338,17 +338,17 @@ ntp_monitor(
</span> */
for (; mon != NULL; mon = mon->hash_next)
<span style="color: #000000;background-color: #ffdddd">- if (SOCK_EQ(&mon->rmtadr, &rbufp->recv_srcaddr))
</span><span style="color: #000000;background-color: #ddffdd">+ if (SOCK_EQ(&mon->rmtadr, &payload->recv_srcaddr))
</span> break;
if (mon != NULL) {
<span style="color: #000000;background-color: #ffdddd">- interval_fp = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ interval_fp = payload->recv_time;
</span> L_SUB(&interval_fp, &mon->last);
/* add one-half second to round up */
L_ADDUF(&interval_fp, 0x80000000);
interval = interval_fp.l_i;
<span style="color: #000000;background-color: #ffdddd">- mon->last = rbufp->recv_time;
- NSRCPORT(&mon->rmtadr) = NSRCPORT(&rbufp->recv_srcaddr);
</span><span style="color: #000000;background-color: #ddffdd">+ mon->last = payload->recv_time;
+ NSRCPORT(&mon->rmtadr) = NSRCPORT(&payload->recv_srcaddr);
</span> mon->count++;
restrict_mask = flags;
mon->vn_mode = VN_MODE(version, mode);
<span style="color: #aaaaaa">@@ -439,7 +439,7 @@ ntp_monitor(
</span> oldest = TAIL_DLIST(mon_mru_list, mru);
oldest_age = 0; /* silence uninit warning */
if (oldest != NULL) {
<span style="color: #000000;background-color: #ffdddd">- interval_fp = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ interval_fp = payload->recv_time;
</span> L_SUB(&interval_fp, &oldest->last);
/* add one-half second to round up */
L_ADDUF(&interval_fp, 0x80000000);
<span style="color: #aaaaaa">@@ -470,17 +470,17 @@ ntp_monitor(
</span> */
mru_entries++;
mru_peakentries = max(mru_peakentries, mru_entries);
<span style="color: #000000;background-color: #ffdddd">- mon->last = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ mon->last = payload->recv_time;
</span> mon->first = mon->last;
mon->count = 1;
mon->flags = ~(RES_LIMITED | RES_KOD) & flags;
mon->leak = 0;
<span style="color: #000000;background-color: #ffdddd">- memcpy(&mon->rmtadr, &rbufp->recv_srcaddr, sizeof(mon->rmtadr));
</span><span style="color: #000000;background-color: #ddffdd">+ memcpy(&mon->rmtadr, &payload->recv_srcaddr, sizeof(mon->rmtadr));
</span> mon->vn_mode = VN_MODE(version, mode);
<span style="color: #000000;background-color: #ffdddd">- 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);
</span><span style="color: #000000;background-color: #ddffdd">+ 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);
</span>
/*
* Drop him into front of the hash table. Also put him on top of
</code></pre>
<br>
</li>
<li id='diff-6'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-6'>
<strong>
ntpd/ntp_peer.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_peer.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_peer.c
</span><span style="color: #aaaaaa">@@ -275,7 +275,7 @@ findexistingpeer(
</span> */
struct peer *
findpeer(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload,
</span> int pkt_mode,
int * action
)
<span style="color: #aaaaaa">@@ -287,7 +287,7 @@ findpeer(
</span> l_fp pkt_org;
findpeer_calls++;
<span style="color: #000000;background-color: #ffdddd">- srcaddr = &rbufp->recv_srcaddr;
</span><span style="color: #000000;background-color: #ddffdd">+ srcaddr = &payload->recv_srcaddr;
</span> hash = NTP_HASH_ADDR(srcaddr);
for (p = peer_hash[hash]; p != NULL; p = p->adr_link) {
if (ADDR_PORT_EQ(srcaddr, &p->srcaddr)) {
<span style="color: #aaaaaa">@@ -310,10 +310,10 @@ findpeer(
</span> */
if (MODE_SERVER == pkt_mode &&
AM_PROCPKT == *action) {
<span style="color: #000000;background-color: #ffdddd">- pkt = &rbufp->recv_pkt;
</span><span style="color: #000000;background-color: #ddffdd">+ pkt = &payload->recv_pkt;
</span> NTOHL_FP(&pkt->org, &pkt_org);
if (!L_ISEQU(&p->aorg, &pkt_org) &&
<span style="color: #000000;background-color: #ffdddd">- findmanycastpeer(rbufp))
</span><span style="color: #000000;background-color: #ddffdd">+ findmanycastpeer(payload))
</span> *action = AM_ERR;
}
<span style="color: #aaaaaa">@@ -337,12 +337,12 @@ findpeer(
</span> */
if (NULL == p) {
*action = MATCH_ASSOC(NO_PEER, pkt_mode);
<span style="color: #000000;background-color: #ffdddd">- } else if (p->dstaddr != rbufp->dstaddr) {
- set_peerdstaddr(p, rbufp->dstaddr);
- if (p->dstaddr == rbufp->dstaddr) {
</span><span style="color: #000000;background-color: #ddffdd">+ } else if (p->dstaddr != payload->dstaddr) {
+ set_peerdstaddr(p, payload->dstaddr);
+ if (p->dstaddr == payload->dstaddr) {
</span> DPRINTF(1, ("Changed %s local address to match response\n",
stoa(&p->srcaddr)));
<span style="color: #000000;background-color: #ffdddd">- return findpeer(rbufp, pkt_mode, action);
</span><span style="color: #000000;background-color: #ddffdd">+ return findpeer(payload, pkt_mode, action);
</span> }
}
return p;
<span style="color: #aaaaaa">@@ -1014,7 +1014,7 @@ peer_all_reset(void)
</span> */
struct peer *
findmanycastpeer(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp /* receive buffer pointer */
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload /* receive buffer pointer */
</span> )
{
struct peer *peer;
<span style="color: #aaaaaa">@@ -1031,7 +1031,7 @@ findmanycastpeer(
</span> * solicitation assocations, so this assumes the transmit
* timestamps are unique for such.
*/
<span style="color: #000000;background-color: #ffdddd">- pkt = &rbufp->recv_pkt;
</span><span style="color: #000000;background-color: #ddffdd">+ pkt = &payload->recv_pkt;
</span> for (peer = peer_list; peer != NULL; peer = peer->p_link)
if (MDF_SOLICIT_MASK & peer->cast_flags) {
NTOHL_FP(&pkt->org, &p_org);
</code></pre>
<br>
</li>
<li id='diff-7'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-7'>
<strong>
ntpd/ntp_proto.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_proto.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_proto.c
</span><span style="color: #aaaaaa">@@ -139,7 +139,7 @@ u_long sys_kodsent; /* KoD sent */
</span> static double root_distance (struct peer *);
static void clock_combine (peer_select *, int, int);
static void peer_xmit (struct peer *);
<span style="color: #000000;background-color: #ffdddd">-static void fast_xmit (struct recvbuf *, int, keyid_t, int);
</span><span style="color: #000000;background-color: #ddffdd">+static void fast_xmit (struct payload *, int, keyid_t, int);
</span> static void pool_xmit (struct peer *);
static void clock_update (struct peer *);
static void measure_precision(const bool);
<span style="color: #aaaaaa">@@ -380,7 +380,7 @@ transmit(
</span> */
void
receive(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload
</span> )
{
register struct peer *peer; /* peer structure pointer */
<span style="color: #aaaaaa">@@ -427,16 +427,16 @@ receive(
</span> * reveals a clogging attack.
*/
sys_received++;
<span style="color: #000000;background-color: #ffdddd">- if (0 == SRCPORT(&rbufp->recv_srcaddr)) {
</span><span style="color: #000000;background-color: #ddffdd">+ if (0 == SRCPORT(&payload->recv_srcaddr)) {
</span> sys_badlength++;
return; /* bogus port */
}
<span style="color: #000000;background-color: #ffdddd">- restrict_mask = restrictions(&rbufp->recv_srcaddr);
</span><span style="color: #000000;background-color: #ddffdd">+ restrict_mask = restrictions(&payload->recv_srcaddr);
</span> DPRINTF(2, ("receive: at %ld %s<-%s flags %x restrict %03x\n",
<span style="color: #000000;background-color: #ffdddd">- current_time, stoa(&rbufp->dstaddr->sin),
- stoa(&rbufp->recv_srcaddr),
- rbufp->dstaddr->flags, restrict_mask));
- pkt = &rbufp->recv_pkt;
</span><span style="color: #000000;background-color: #ddffdd">+ current_time, stoa(&payload->dstaddr->sin),
+ stoa(&payload->recv_srcaddr),
+ payload->dstaddr->flags, restrict_mask));
+ pkt = &payload->recv_pkt;
</span> hisversion = PKT_VERSION(pkt->li_vn_mode);
hisleap = PKT_LEAP(pkt->li_vn_mode);
hismode = (int)PKT_MODE(pkt->li_vn_mode);
<span style="color: #aaaaaa">@@ -455,7 +455,7 @@ receive(
</span> sys_restricted++;
return; /* no query control */
}
<span style="color: #000000;background-color: #ffdddd">- process_control(rbufp, restrict_mask);
</span><span style="color: #000000;background-color: #ddffdd">+ process_control(payload, restrict_mask);
</span> return;
}
if (restrict_mask & RES_DONTSERVE) {
<span style="color: #aaaaaa">@@ -516,7 +516,7 @@ receive(
</span> * field and go around again.
*/
authlen = LEN_PKT_NOMAC;
<span style="color: #000000;background-color: #ffdddd">- has_mac = rbufp->recv_length - authlen;
</span><span style="color: #000000;background-color: #ddffdd">+ has_mac = payload->recv_length - authlen;
</span> while (has_mac > 0) {
uint32_t len;
#ifdef ENABLE_AUTOKEY
<span style="color: #aaaaaa">@@ -537,7 +537,7 @@ receive(
</span> opcode = ntohl(((uint32_t *)pkt)[authlen / 4]);
len = opcode & 0xffff;
if (len % 4 != 0 || len < 4 || (int)len +
<span style="color: #000000;background-color: #ffdddd">- authlen > rbufp->recv_length) {
</span><span style="color: #000000;background-color: #ddffdd">+ authlen > payload->recv_length) {
</span> sys_badlength++;
return; /* bad length */
}
<span style="color: #aaaaaa">@@ -594,21 +594,21 @@ receive(
</span> * RES_LIMITED and RES_KOD will be cleared in the returned
* restrict_mask unless one or both actions are warranted.
*/
<span style="color: #000000;background-color: #ffdddd">- restrict_mask = ntp_monitor(rbufp, restrict_mask);
</span><span style="color: #000000;background-color: #ddffdd">+ restrict_mask = ntp_monitor(payload, restrict_mask);
</span> 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",
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr)));
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr)));
</span> return; /* rate exceeded */
}
if (hismode == MODE_CLIENT)
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_SERVER, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_SERVER, skeyid,
</span> restrict_mask);
else
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_ACTIVE, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_ACTIVE, skeyid,
</span> restrict_mask);
return; /* rate exceeded */
}
<span style="color: #aaaaaa">@@ -633,9 +633,9 @@ receive(
</span> * multicaster, the broadcast address is null, so we use the
* unicast address anyway. Don't ask.
*/
<span style="color: #000000;background-color: #ffdddd">- peer = findpeer(rbufp, hismode, &retcode);
</span><span style="color: #000000;background-color: #ddffdd">+ peer = findpeer(payload, hismode, &retcode);
</span> #ifdef DEBUG
<span style="color: #000000;background-color: #ffdddd">- dstaddr_sin = &rbufp->dstaddr->sin;
</span><span style="color: #000000;background-color: #ddffdd">+ dstaddr_sin = &payload->dstaddr->sin;
</span> #endif
NTOHL_FP(&pkt->org, &p_org);
NTOHL_FP(&pkt->rec, &p_rec);
<span style="color: #aaaaaa">@@ -673,7 +673,7 @@ receive(
</span> printf(
"receive: at %ld %s<-%s mode %d len %zd\n",
current_time, stoa(dstaddr_sin),
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr), hismode,
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr), hismode,
</span> authlen);
#endif
} else if (has_mac == 4) {
<span style="color: #aaaaaa">@@ -684,7 +684,7 @@ receive(
</span> printf(
"receive: at %ld %s<-%s mode %d keyid %08x len %zd auth %d\n",
current_time, stoa(dstaddr_sin),
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr), hismode, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr), hismode, skeyid,
</span> authlen + has_mac, is_authentic);
#endif
<span style="color: #aaaaaa">@@ -754,18 +754,18 @@ receive(
</span> * mobilized. However, if this is from
* the wildcard interface, game over.
*/
<span style="color: #000000;background-color: #ffdddd">- if (crypto_flags && rbufp->dstaddr ==
- ANY_INTERFACE_CHOOSE(&rbufp->recv_srcaddr)) {
</span><span style="color: #000000;background-color: #ddffdd">+ if (crypto_flags && payload->dstaddr ==
+ ANY_INTERFACE_CHOOSE(&payload->recv_srcaddr)) {
</span> sys_restricted++;
return; /* no wildcard */
}
pkeyid = 0;
<span style="color: #000000;background-color: #ffdddd">- if (!SOCK_UNSPEC(&rbufp->dstaddr->bcast))
</span><span style="color: #000000;background-color: #ddffdd">+ if (!SOCK_UNSPEC(&payload->dstaddr->bcast))
</span> dstaddr_sin =
<span style="color: #000000;background-color: #ffdddd">- &rbufp->dstaddr->bcast;
</span><span style="color: #000000;background-color: #ddffdd">+ &payload->dstaddr->bcast;
</span> } else if (peer == NULL) {
pkeyid = session_key(
<span style="color: #000000;background-color: #ffdddd">- &rbufp->recv_srcaddr, dstaddr_sin, 0,
</span><span style="color: #000000;background-color: #ddffdd">+ &payload->recv_srcaddr, dstaddr_sin, 0,
</span> sys_private, 0);
} else {
pkeyid = peer->pcookie;
<span style="color: #aaaaaa">@@ -779,14 +779,14 @@ receive(
</span> * use later in the autokey mambo.
*/
if (authlen > LEN_PKT_NOMAC && pkeyid != 0) {
<span style="color: #000000;background-color: #ffdddd">- session_key(&rbufp->recv_srcaddr,
</span><span style="color: #000000;background-color: #ddffdd">+ session_key(&payload->recv_srcaddr,
</span> dstaddr_sin, skeyid, 0, 2);
tkeyid = session_key(
<span style="color: #000000;background-color: #ffdddd">- &rbufp->recv_srcaddr, dstaddr_sin,
</span><span style="color: #000000;background-color: #ddffdd">+ &payload->recv_srcaddr, dstaddr_sin,
</span> skeyid, pkeyid, 0);
} else {
tkeyid = session_key(
<span style="color: #000000;background-color: #ffdddd">- &rbufp->recv_srcaddr, dstaddr_sin,
</span><span style="color: #000000;background-color: #ddffdd">+ &payload->recv_srcaddr, dstaddr_sin,
</span> skeyid, pkeyid, 2);
}
<span style="color: #aaaaaa">@@ -814,7 +814,7 @@ receive(
</span> printf(
"receive: at %ld %s<-%s mode %d keyid %08x len %zd auth %d\n",
current_time, stoa(dstaddr_sin),
<span style="color: #000000;background-color: #ffdddd">- stoa(&rbufp->recv_srcaddr), hismode, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ stoa(&payload->recv_srcaddr), hismode, skeyid,
</span> authlen + has_mac, is_authentic);
#endif
}
<span style="color: #aaaaaa">@@ -843,13 +843,13 @@ receive(
</span> * If authentication OK, send a server reply; otherwise,
* send a crypto-NAK.
*/
<span style="color: #000000;background-color: #ffdddd">- if (!(rbufp->dstaddr->flags & INT_MCASTOPEN)) {
</span><span style="color: #000000;background-color: #ddffdd">+ if (!(payload->dstaddr->flags & INT_MCASTOPEN)) {
</span> if (AUTH(restrict_mask & RES_DONTTRUST,
is_authentic)) {
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_SERVER, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_SERVER, skeyid,
</span> restrict_mask);
} else if (is_authentic == AUTH_ERROR) {
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_SERVER, 0,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_SERVER, 0,
</span> restrict_mask);
sys_badauth++;
} else {
<span style="color: #aaaaaa">@@ -884,7 +884,7 @@ receive(
</span> */
if (sys_leap == LEAP_NOTINSYNC || sys_stratum >=
hisstratum || (!sys_cohort && sys_stratum ==
<span style="color: #000000;background-color: #ffdddd">- hisstratum + 1) || rbufp->dstaddr->addr_refid ==
</span><span style="color: #000000;background-color: #ddffdd">+ hisstratum + 1) || payload->dstaddr->addr_refid ==
</span> pkt->refid) {
sys_declined++;
return; /* no help */
<span style="color: #aaaaaa">@@ -895,7 +895,7 @@ receive(
</span> * crypto-NAK, as that would not be useful.
*/
if (AUTH(restrict_mask & RES_DONTTRUST, is_authentic))
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_SERVER, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_SERVER, skeyid,
</span> restrict_mask);
return; /* hooray */
<span style="color: #aaaaaa">@@ -929,7 +929,7 @@ receive(
</span> return;
}
#endif /* ENABLE_AUTOKEY */
<span style="color: #000000;background-color: #ffdddd">- if ((peer2 = findmanycastpeer(rbufp)) == NULL) {
</span><span style="color: #000000;background-color: #ddffdd">+ if ((peer2 = findmanycastpeer(payload)) == NULL) {
</span> sys_restricted++;
return; /* not enabled */
}
<span style="color: #aaaaaa">@@ -949,7 +949,7 @@ receive(
</span> sys_declined++;
return; /* no help */
}
<span style="color: #000000;background-color: #ffdddd">- peer = newpeer(&rbufp->recv_srcaddr, NULL, rbufp->dstaddr,
</span><span style="color: #000000;background-color: #ddffdd">+ peer = newpeer(&payload->recv_srcaddr, NULL, payload->dstaddr,
</span> MODE_CLIENT, hisversion, peer2->minpoll,
peer2->maxpoll, FLAG_PREEMPT |
(FLAG_IBURST & peer2->flags), MDF_UCAST |
<span style="color: #aaaaaa">@@ -1034,8 +1034,8 @@ receive(
</span> * ephemeral associations are unique across all local
* endpoints.
*/
<span style="color: #000000;background-color: #ffdddd">- if (!(INT_MCASTOPEN & rbufp->dstaddr->flags))
- match_ep = rbufp->dstaddr;
</span><span style="color: #000000;background-color: #ddffdd">+ if (!(INT_MCASTOPEN & payload->dstaddr->flags))
+ match_ep = payload->dstaddr;
</span> else
match_ep = NULL;
<span style="color: #aaaaaa">@@ -1058,7 +1058,7 @@ receive(
</span> * Do not execute the volley. Start out in
* broadcast client mode.
*/
<span style="color: #000000;background-color: #ffdddd">- peer = newpeer(&rbufp->recv_srcaddr, NULL,
</span><span style="color: #000000;background-color: #ddffdd">+ peer = newpeer(&payload->recv_srcaddr, NULL,
</span> match_ep, MODE_BCLIENT, hisversion,
pkt->ppoll, pkt->ppoll, FLAG_PREEMPT,
MDF_BCLNT, 0, skeyid, sys_ident);
<span style="color: #aaaaaa">@@ -1080,7 +1080,7 @@ receive(
</span> * packet, normally 6 (64 s) and that the poll interval
* is fixed at this value.
*/
<span style="color: #000000;background-color: #ffdddd">- peer = newpeer(&rbufp->recv_srcaddr, NULL, match_ep,
</span><span style="color: #000000;background-color: #ddffdd">+ peer = newpeer(&payload->recv_srcaddr, NULL, match_ep,
</span> MODE_CLIENT, hisversion, pkt->ppoll, pkt->ppoll,
FLAG_BC_VOL | FLAG_IBURST | FLAG_PREEMPT, MDF_BCLNT,
0, skeyid, sys_ident);
<span style="color: #aaaaaa">@@ -1090,7 +1090,7 @@ receive(
</span> }
#ifdef ENABLE_AUTOKEY
if (skeyid > NTP_MAXKEY)
<span style="color: #000000;background-color: #ffdddd">- crypto_recv(peer, rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ crypto_recv(peer, payload);
</span> #endif /* ENABLE_AUTOKEY */
return; /* hooray */
<span style="color: #aaaaaa">@@ -1123,12 +1123,12 @@ receive(
</span> */
if (AUTH(restrict_mask & RES_DONTTRUST,
is_authentic)) {
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_PASSIVE, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_PASSIVE, skeyid,
</span> restrict_mask);
return; /* hooray */
}
if (is_authentic == AUTH_ERROR) {
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_ACTIVE, 0,
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_ACTIVE, 0,
</span> restrict_mask);
sys_restricted++;
return;
<span style="color: #aaaaaa">@@ -1148,7 +1148,7 @@ receive(
</span> printf(
"receive: at %ld refusing to mobilize passive association"
" with unknown peer %s mode %d keyid %08x len %zd auth %d\n",
<span style="color: #000000;background-color: #ffdddd">- current_time, stoa(&rbufp->recv_srcaddr), hismode, skeyid,
</span><span style="color: #000000;background-color: #ddffdd">+ current_time, stoa(&payload->recv_srcaddr), hismode, skeyid,
</span> authlen + has_mac, is_authentic);
}
#endif
<span style="color: #aaaaaa">@@ -1176,8 +1176,8 @@ receive(
</span> * The message is correctly authenticated and allowed.
* Mobilize a symmetric passive association.
*/
<span style="color: #000000;background-color: #ffdddd">- if ((peer = newpeer(&rbufp->recv_srcaddr, NULL,
- rbufp->dstaddr, MODE_PASSIVE, hisversion, pkt->ppoll,
</span><span style="color: #000000;background-color: #ddffdd">+ if ((peer = newpeer(&payload->recv_srcaddr, NULL,
+ payload->dstaddr, MODE_PASSIVE, hisversion, pkt->ppoll,
</span> NTP_MAXDPOLL, 0, MDF_UCAST, 0, skeyid,
sys_ident)) == NULL) {
sys_declined++;
<span style="color: #aaaaaa">@@ -1268,7 +1268,7 @@ receive(
</span> if (!L_ISZERO(&p_org) && !(peer->flags & FLAG_XB)) {
peer->flags |= FLAG_XB;
peer->aorg = p_xmt;
<span style="color: #000000;background-color: #ffdddd">- peer->borg = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ peer->borg = payload->recv_time;
</span> report_event(PEVNT_XLEAVE, peer, NULL);
return;
}
<span style="color: #aaaaaa">@@ -1344,7 +1344,7 @@ receive(
</span> peer->badauth++;
if (has_mac &&
(hismode == MODE_ACTIVE || hismode == MODE_PASSIVE))
<span style="color: #000000;background-color: #ffdddd">- fast_xmit(rbufp, MODE_ACTIVE, 0, restrict_mask);
</span><span style="color: #000000;background-color: #ddffdd">+ fast_xmit(payload, MODE_ACTIVE, 0, restrict_mask);
</span> if (peer->flags & FLAG_PREEMPT) {
unpeer(peer);
return;
<span style="color: #aaaaaa">@@ -1362,7 +1362,7 @@ receive(
</span> if (peer->flip == 0) {
if (hismode != MODE_BROADCAST)
peer->rec = p_xmt;
<span style="color: #000000;background-color: #ffdddd">- peer->dst = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ peer->dst = payload->recv_time;
</span> }
peer->xmt = p_xmt;
<span style="color: #aaaaaa">@@ -1438,7 +1438,7 @@ receive(
</span> ap->seq--;
}
peer->flash |= BOGON8;
<span style="color: #000000;background-color: #ffdddd">- rval = crypto_recv(peer, rbufp);
</span><span style="color: #000000;background-color: #ddffdd">+ rval = crypto_recv(peer, payload);
</span> if (rval == XEVNT_OK) {
peer->unreach = 0;
} else {
<span style="color: #aaaaaa">@@ -1496,7 +1496,7 @@ receive(
</span> break;
}
tkeyid = session_key(
<span style="color: #000000;background-color: #ffdddd">- &rbufp->recv_srcaddr, dstaddr_sin,
</span><span style="color: #000000;background-color: #ddffdd">+ &payload->recv_srcaddr, dstaddr_sin,
</span> tkeyid, pkeyid, 0);
}
if (peer->flash & BOGON8)
<span style="color: #aaaaaa">@@ -1524,7 +1524,7 @@ receive(
</span> * the packet over the fence for processing, which may light up
* more flashers.
*/
<span style="color: #000000;background-color: #ffdddd">- process_packet(peer, pkt, rbufp->recv_length);
</span><span style="color: #000000;background-color: #ddffdd">+ process_packet(peer, pkt, payload->recv_length);
</span>
/*
* In interleaved mode update the state variables. Also adjust the
<span style="color: #aaaaaa">@@ -1532,7 +1532,7 @@ receive(
</span> */
if (peer->flip != 0) {
peer->rec = p_rec;
<span style="color: #000000;background-color: #ffdddd">- peer->dst = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ peer->dst = payload->recv_time;
</span> if (peer->nextdate - current_time < (1U << min(peer->ppoll,
peer->hpoll)) / 2)
peer->nextdate++;
<span style="color: #aaaaaa">@@ -3483,7 +3483,7 @@ leap_smear_add_offs(l_fp *t, l_fp *t_recv) {
</span> */
static void
fast_xmit(
<span style="color: #000000;background-color: #ffdddd">- struct recvbuf *rbufp, /* receive packet pointer */
</span><span style="color: #000000;background-color: #ddffdd">+ struct payload *payload, /* receive packet pointer */
</span> int xmode, /* receive mode */
keyid_t xkeyid, /* transmit key ID */
int flags /* restrict mask */
<span style="color: #aaaaaa">@@ -3508,9 +3508,9 @@ fast_xmit(
</span> * If the gazinta was from a multicast address, the gazoutta
* must go out another way.
*/
<span style="color: #000000;background-color: #ffdddd">- rpkt = &rbufp->recv_pkt;
- if (rbufp->dstaddr->flags & INT_MCASTOPEN)
- rbufp->dstaddr = findinterface(&rbufp->recv_srcaddr);
</span><span style="color: #000000;background-color: #ddffdd">+ rpkt = &payload->recv_pkt;
+ if (payload->dstaddr->flags & INT_MCASTOPEN)
+ payload->dstaddr = findinterface(&payload->recv_srcaddr);
</span>
/*
* If this is a kiss-o'-death (KoD) packet, show leap
<span style="color: #aaaaaa">@@ -3580,12 +3580,12 @@ fast_xmit(
</span> xpkt.org = rpkt->xmt;
#ifdef ENABLE_LEAP_SMEAR
<span style="color: #000000;background-color: #ffdddd">- this_recv_time = rbufp->recv_time;
</span><span style="color: #000000;background-color: #ddffdd">+ this_recv_time = payload->recv_time;
</span> if (leap_smear.in_progress)
leap_smear_add_offs(&this_recv_time, NULL);
HTONL_FP(&this_recv_time, &xpkt.rec);
#else
<span style="color: #000000;background-color: #ffdddd">- HTONL_FP(&rbufp->recv_time, &xpkt.rec);
</span><span style="color: #000000;background-color: #ddffdd">+ HTONL_FP(&payload->recv_time, &xpkt.rec);
</span> #endif
intercept_get_systime(__func__, &xmt_tx);
<span style="color: #aaaaaa">@@ -3598,7 +3598,7 @@ fast_xmit(
</span>
#ifdef ENABLE_MSSNTP
if (flags & RES_MSSNTP) {
<span style="color: #000000;background-color: #ffdddd">- send_via_ntp_signd(rbufp, xmode, xkeyid, flags, &xpkt);
</span><span style="color: #000000;background-color: #ddffdd">+ send_via_ntp_signd(payload, xmode, xkeyid, flags, &xpkt);
</span> return;
}
#endif /* ENABLE_MSSNTP */
<span style="color: #aaaaaa">@@ -3609,15 +3609,15 @@ fast_xmit(
</span> * packet is not authenticated.
*/
sendlen = LEN_PKT_NOMAC;
<span style="color: #000000;background-color: #ffdddd">- if (rbufp->recv_length == sendlen) {
- intercept_sendpkt(__func__, &rbufp->recv_srcaddr, rbufp->dstaddr, 0, &xpkt,
</span><span style="color: #000000;background-color: #ddffdd">+ if (payload->recv_length == sendlen) {
+ intercept_sendpkt(__func__, &payload->recv_srcaddr, payload->dstaddr, 0, &xpkt,
</span> sendlen);
#ifdef DEBUG
if (debug)
printf(
"transmit: at %ld %s->%s mode %d len %zd\n",
<span style="color: #000000;background-color: #ffdddd">- current_time, stoa(&rbufp->dstaddr->sin),
- stoa(&rbufp->recv_srcaddr), xmode, sendlen);
</span><span style="color: #000000;background-color: #ddffdd">+ current_time, stoa(&payload->dstaddr->sin),
+ stoa(&payload->recv_srcaddr), xmode, sendlen);
</span> #endif
return;
}
<span style="color: #aaaaaa">@@ -3643,19 +3643,19 @@ fast_xmit(
</span> * jerk can decode it. If no extension field is present,
* use the cookie to generate the session key.
*/
<span style="color: #000000;background-color: #ffdddd">- 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);
</span><span style="color: #000000;background-color: #ddffdd">+ 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);
</span> temp32 = CRYPTO_RESP;
rpkt->exten[0] |= htonl(temp32);
<span style="color: #000000;background-color: #ffdddd">- sendlen += crypto_xmit(NULL, &xpkt, rbufp,
</span><span style="color: #000000;background-color: #ddffdd">+ sendlen += crypto_xmit(NULL, &xpkt, payload,
</span> sendlen, (struct exten *)rpkt->exten,
cookie);
} else {
<span style="color: #000000;background-color: #ffdddd">- session_key(&rbufp->dstaddr->sin,
- &rbufp->recv_srcaddr, xkeyid, cookie, 2);
</span><span style="color: #000000;background-color: #ddffdd">+ session_key(&payload->dstaddr->sin,
+ &payload->recv_srcaddr, xkeyid, cookie, 2);
</span> }
}
#endif /* ENABLE_AUTOKEY */
<span style="color: #aaaaaa">@@ -3665,7 +3665,7 @@ fast_xmit(
</span> if (xkeyid > NTP_MAXKEY)
authtrust(xkeyid, 0);
#endif /* ENABLE_AUTOKEY */
<span style="color: #000000;background-color: #ffdddd">- intercept_sendpkt(__func__, &rbufp->recv_srcaddr, rbufp->dstaddr, 0, &xpkt, sendlen);
</span><span style="color: #000000;background-color: #ddffdd">+ intercept_sendpkt(__func__, &payload->recv_srcaddr, payload->dstaddr, 0, &xpkt, sendlen);
</span> intercept_get_systime(__func__, &xmt_ty);
L_SUB(&xmt_ty, &xmt_tx);
sys_authdelay = xmt_ty;
<span style="color: #aaaaaa">@@ -3673,8 +3673,8 @@ fast_xmit(
</span> if (debug)
printf(
"transmit: at %ld %s->%s mode %d keyid %08x len %zd\n",
<span style="color: #000000;background-color: #ffdddd">- current_time, ntoa(&rbufp->dstaddr->sin),
- ntoa(&rbufp->recv_srcaddr), xmode, xkeyid, sendlen);
</span><span style="color: #000000;background-color: #ddffdd">+ current_time, ntoa(&payload->dstaddr->sin),
+ ntoa(&payload->recv_srcaddr), xmode, xkeyid, sendlen);
</span> #endif
}
</code></pre>
<br>
</li>
<li id='diff-8'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c#diff-8'>
<strong>
ntpd/ntpd.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntpd.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntpd.c
</span><span style="color: #aaaaaa">@@ -1010,7 +1010,7 @@ static void mainloop(void)
</span> collect_timing(rbuf, "buffer processing delay", 1, &dts);
bufcount++;
# endif
<span style="color: #000000;background-color: #ffdddd">- (*rbuf->receiver)(rbuf);
</span><span style="color: #000000;background-color: #ddffdd">+ (*rbuf->receiver)(&rbuf->payload);
</span> } else {
msyslog(LOG_ERR, "fatal: receive buffer callback NULL");
abort();
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.com/NTPsec/ntpsec/commit/175b58dc0dd11493de4a337d4ebcf011c16fc59c"}}</script>
</p>
</div>
</body>
</html>