/* Max. of 255 characters for hostname, 10 for timestamp, 4 for kisscode, 2 for format : and 1 for \n */
char fbuf[272];
- char *obuf = fbuf;
char error = 0;
printf("Starting to read KOD file %s...\n", db_file);
/* First let's see how many entries there are and check for right syntax */
- int scan_value = 0;
while(!feof(db_s)) {
fgets(fbuf, 272, db_s);
for(b=0; (!feof(db_s) || !ferror(db_s)) && b<entryc; b++) {
char *str_ptr = fgets(fbuf, 272, db_s);
- int j = sscanf(fbuf, "%255[^:]", &(kod_db[b].hostname));
- j += sscanf(fbuf + j, "%*[^:]:%i:%4s", &kod_db[b].timestamp, &(kod_db[b].type));
+ int j = sscanf(fbuf, "%255[^:]", (char *) &(kod_db[b].hostname));
+ j += sscanf(fbuf + j, "%*[^:]:%i:%4s", &kod_db[b].timestamp, (char *) &(kod_db[b].type));
if(str_ptr == NULL) {
b = entryc;
char **argv
)
{
- char *kod_file, *log_file;
register int c;
if (isc_net_probeipv6() != ISC_R_SUCCESS) {
/* Initialize logging system */
if(HAVE_OPT(FILELOG)) {
- init_log(OPT_ARG(FILELOG));
+ init_log((char *) OPT_ARG(FILELOG));
}
if(HAVE_OPT(KOD)) {
struct pkt *x_pkt = (struct pkt *) malloc(sizeof(struct pkt));
struct pkt *r_pkt = (struct pkt *) malloc(sizeof(struct pkt));
- struct timeval tv_org, tv_dst;
+ struct timeval tv_xmt, tv_dst;
double t21, t34, delta, offset;
int error, rsock, rpktl;
- l_fp p_rec, p_xmt, p_ref, p_org, org, tmp, dst, theta;
+ l_fp p_rec, p_xmt, p_ref, p_org, xmt, org, tmp, dst, theta;
- error = GETTIMEOFDAY(&tv_org, (struct timezone *)NULL);
+ error = GETTIMEOFDAY(&tv_xmt, (struct timezone *)NULL);
#ifdef DEBUG
- printf("Current time sec: %i msec: %i\n\n", tv_org.tv_sec, tv_org.tv_usec);
+ printf("Current time sec: %i msec: %i\n\n", (unsigned int) tv_xmt.tv_sec,
+ (unsigned int) tv_xmt.tv_usec);
#endif
- tv_org.tv_sec += JAN_1970;
- TVTOTS(&tv_org, &org);
- HTONL_FP(&org, &(x_pkt->org));
+ tv_xmt.tv_sec += JAN_1970;
+ TVTOTS(&tv_xmt, &xmt);
+ HTONL_FP(&xmt, &(x_pkt->xmt));
x_pkt->stratum = STRATUM_TO_PKT(STRATUM_UNSPEC);
x_pkt->ppoll = 8;
close_socket(sock);
- if(rpktl == -1)
- return -1;
+/* if(rpktl == -1)
+ return -1; */
/* -2 would indicate that we should try to get a packet
* from this server again
#endif
GETTIMEOFDAY(&tv_dst, (struct timezone *)NULL);
+
+ tv_dst.tv_sec += JAN_1970;
tmp = p_rec;
L_SUB(&tmp, &p_org);
printf("on_wire: t21: %.6f\t t34: %.6f\ndelta: %.6f\t offset: %.6f\n",
t21, t34, delta, offset);
- set_time(offset);
+/* set_time(offset); */
return 0;
}
#include <config.h>
+#include <unistd.h>
#include "sntp-opts.h"
#include "networking.h"
printf("Starting host resolution for %s...\n", hosts[a]);
#endif
- struct addrinfo hints, *dres, *res0;
+ struct addrinfo hints, *dres;
int error;
- const char *cause = NULL;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
for(a=0; a<entryc; a++)
getnameinfo(result[a]->ai_addr, result[a]->ai_addrlen, adr_buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
- printf("%x: IP %s\n", result[a], adr_buf);
+ printf("%x: IP %s\n", (unsigned int) result[a], adr_buf);
#endif
*res = (struct addrinfo *) malloc(sizeof(struct addrinfo *) * entryc);
#endif
#ifdef DEBUG
- register int a;
if(recvc > 0) {
getnameinfo((struct sockaddr *)sender, sender->ss_len, adr_buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
int has_mac;
int is_authentic;
- l_fp ts;
- l_fp t10, t23, tmp;
+ l_fp tmp;
l_fp org;
l_fp rec;
- l_fp ci;
struct sockaddr_storage sender;
return filter_elements;
}
-
-/* Will be handled by recvpkt */
-int
-filter_ntp (
- struct addrinfo **res,
- int resc
- )
-{
-}
#ifndef NETWORK_H
#define NETWORK_H
-#if 0
-#include <sys/types.h> /**/
-/* #include <sys/socket.h> /**/
-/* #include <netinet/in.h> /**/
-/* #include <netdb.h> /**/
-#include <stdlib.h> /**/
-#include <string.h> /**/
-#endif
-#include <strings.h> /**/
-#include <errno.h> /**/
+#include <strings.h>
+#include <errno.h>
#include <ntp_stdlib.h>
#define closesocket close
#endif
-/* Check if necessary or not */
-/* Maximum number of sockets... should be specified in sntp.h later */
-#define MAX_AF 2
-
-int descriptors[MAX_AF];
-
/* From ntpdate.c */
int is_reachable (struct addrinfo *dst);
int recvpkt (SOCKET rsock, struct pkt *rpkt, struct pkt *spkt);
-int filter_reachable (struct addrinfo **res, int resc);
-
#endif
FILE *output
)
{
- register int a, b, bexp;
+ register int a, b;
fprintf(output, HLINE);