* response, so the maximum total extension field length is 864
* octets. But, to handle humungus certificates, the bank must
* be broke.
+ *
+ * The different definitions of the 'exten' field are here for
+ * the benefit of applications that want to send a packet from
+ * an auto variable in the stack - not using the AUTOKEY version
+ * saves 2KB of stack space. The receive buffer should ALWAYS be
+ * big enough to hold a full extended packet if the extension
+ * fields have to be parsed or skipped.
*/
#ifdef AUTOKEY
- u_int32 exten[NTP_MAXEXTEN / 4]; /* max extension field */
+ u_int32 exten[(NTP_MAXEXTEN + MAX_MAC_LEN) / sizeof(u_int32)];
#else /* !AUTOKEY follows */
- u_int32 exten[1]; /* misused */
+ u_int32 exten[(MAX_MAC_LEN) / sizeof(u_int32)];
#endif /* !AUTOKEY */
- u_char mac[MAX_MAC_LEN]; /* mac */
};
/*
# define thread_exit(c) _endthreadex(c)
# define tickle_sem SetEvent
#else
-# define thread_exit(c) pthread_exit((void *)(c))
+# define thread_exit(c) pthread_exit((void*)(size_t)(c))
# define tickle_sem sem_post
#endif
static union {
struct pkt pkt;
- char buf[1500];
+ char buf[LEN_PKT_NOMAC + NTP_MAXEXTEN + MAX_MAC_LEN];
} rbuf;
#define r_pkt rbuf.pkt
)
{
sockaddr_u name;
- int one_fam_works;
- one_fam_works = FALSE;
if (-1 == sock4) {
sock4 = socket(PF_INET, SOCK_DGRAM, 0);
if (-1 == sock4) {
msyslog(LOG_ERR,
"open_sockets: event_new(base, sock4) failed!");
} else {
- one_fam_works = TRUE;
event_add(ev_sock4, &wakeup_tv);
}
}
msyslog(LOG_ERR,
"open_sockets: event_new(base, sock6) failed!");
} else {
- one_fam_works = TRUE;
event_add(ev_sock6, &wakeup_tv);
}
}