Deleted Added
full compact
ntpdc_ops.c (54359) ntpdc_ops.c (82498)
1/*
2 * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include <stdio.h>
1/*
2 * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include <stdio.h>
10
11#include "ntpdc.h"
12#include "ntp_control.h"
13#include "ntp_refclock.h"
14#include "ntp_stdlib.h"
15
10#include <ctype.h>
16#include <ctype.h>
11#include <sys/types.h>
12#include <sys/time.h>
13#ifdef HAVE_SYS_TIMEX_H
14# include <sys/timex.h>
15#endif
16#include <netdb.h>
17#if !defined(__bsdi__) && !defined(apollo)
18#include <netinet/in.h>
19#endif
20
17#ifdef HAVE_SYS_TIMEX_H
18# include <sys/timex.h>
19#endif
20#include <netdb.h>
21#if !defined(__bsdi__) && !defined(apollo)
22#include <netinet/in.h>
23#endif
24
21#include "ntpdc.h"
22#include "ntp_control.h"
23#include "ntp_refclock.h"
24#include "ntp_stdlib.h"
25
26#include <arpa/inet.h>
27
28/*
29 * Declarations for command handlers in here
30 */
31static int checkitems P((int, FILE *));
32static int checkitemsize P((int, int));
33static int check1item P((int, FILE *));

--- 104 unchanged lines hidden (view full) ---

138 { "disable", sys_clear, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
139 { "auth|bclient|monitor|pll|kernel|stats", "...", "...", "..." },
140 "clear a system flag (auth, bclient, monitor, pll, kernel, stats)" },
141 { "reslist", reslist, { NO, NO, NO, NO },
142 { "", "", "", "" },
143 "display the server's restrict list" },
144 { "restrict", new_restrict, { ADD, ADD, NTP_STR, OPT|NTP_STR },
145 { "address", "mask",
25#include <arpa/inet.h>
26
27/*
28 * Declarations for command handlers in here
29 */
30static int checkitems P((int, FILE *));
31static int checkitemsize P((int, int));
32static int check1item P((int, FILE *));

--- 104 unchanged lines hidden (view full) ---

137 { "disable", sys_clear, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
138 { "auth|bclient|monitor|pll|kernel|stats", "...", "...", "..." },
139 "clear a system flag (auth, bclient, monitor, pll, kernel, stats)" },
140 { "reslist", reslist, { NO, NO, NO, NO },
141 { "", "", "", "" },
142 "display the server's restrict list" },
143 { "restrict", new_restrict, { ADD, ADD, NTP_STR, OPT|NTP_STR },
144 { "address", "mask",
146 "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer",
145 "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod",
147 "..." },
148 "create restrict entry/add flags to entry" },
149 { "unrestrict", unrestrict, { ADD, ADD, NTP_STR, OPT|NTP_STR },
150 { "address", "mask",
146 "..." },
147 "create restrict entry/add flags to entry" },
148 { "unrestrict", unrestrict, { ADD, ADD, NTP_STR, OPT|NTP_STR },
149 { "address", "mask",
151 "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer",
150 "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod",
152 "..." },
153 "remove flags from a restrict entry" },
154 { "delrestrict", delrestrict, { ADD, ADD, OPT|NTP_STR, NO },
155 { "address", "mask", "ntpport", "" },
156 "delete a restrict entry" },
157 { "monlist", monlist, { OPT|INT, NO, NO, NO },
158 { "version", "", "", "" },
159 "display data the server's monitor routines have collected" },

--- 305 unchanged lines hidden (view full) ---

465 refid_string(pp->refid, pp->stratum), fptoa(NTOHS_FP(pp->rootdelay), 5),
466 ufptoa(NTOHS_FP(pp->rootdispersion), 5));
467
468 (void) fprintf(fp,
469 "ppoll %d, hpoll %d, keyid %lu, version %d, association %u\n",
470 pp->ppoll, pp->hpoll, (u_long)pp->keyid, pp->version, ntohs(pp->associd));
471
472 (void) fprintf(fp,
151 "..." },
152 "remove flags from a restrict entry" },
153 { "delrestrict", delrestrict, { ADD, ADD, OPT|NTP_STR, NO },
154 { "address", "mask", "ntpport", "" },
155 "delete a restrict entry" },
156 { "monlist", monlist, { OPT|INT, NO, NO, NO },
157 { "version", "", "", "" },
158 "display data the server's monitor routines have collected" },

--- 305 unchanged lines hidden (view full) ---

464 refid_string(pp->refid, pp->stratum), fptoa(NTOHS_FP(pp->rootdelay), 5),
465 ufptoa(NTOHS_FP(pp->rootdispersion), 5));
466
467 (void) fprintf(fp,
468 "ppoll %d, hpoll %d, keyid %lu, version %d, association %u\n",
469 pp->ppoll, pp->hpoll, (u_long)pp->keyid, pp->version, ntohs(pp->associd));
470
471 (void) fprintf(fp,
473 "valid %d, reach %03o, unreach %d, flash 0x%04x, ",
474 pp->valid, pp->reach, pp->unreach, pp->flash2);
472 "reach %03o, unreach %d, flash 0x%04x, ",
473 pp->reach, pp->unreach, pp->flash2);
475
476 (void) fprintf(fp, "boffset %s, ttl/mode %d\n",
477 fptoa(NTOHS_FP(pp->estbdelay), 5), pp->ttl);
478
479 (void) fprintf(fp, "timer %lds, flags", (long)ntohl(pp->timer));
480 if (pp->flags == 0) {
481 (void) fprintf(fp, " none\n");
482 } else {

--- 375 unchanged lines hidden (view full) ---

858 (void) fprintf(fp, "bad stratum in packet: %ld\n",
859 (u_long)ntohl(ss->badstratum));
860 (void) fprintf(fp, "old version packets: %ld\n",
861 (u_long)ntohl(ss->oldversionpkt));
862 (void) fprintf(fp, "new version packets: %ld\n",
863 (u_long)ntohl(ss->newversionpkt));
864 (void) fprintf(fp, "unknown version number: %ld\n",
865 (u_long)ntohl(ss->unknownversion));
474
475 (void) fprintf(fp, "boffset %s, ttl/mode %d\n",
476 fptoa(NTOHS_FP(pp->estbdelay), 5), pp->ttl);
477
478 (void) fprintf(fp, "timer %lds, flags", (long)ntohl(pp->timer));
479 if (pp->flags == 0) {
480 (void) fprintf(fp, " none\n");
481 } else {

--- 375 unchanged lines hidden (view full) ---

857 (void) fprintf(fp, "bad stratum in packet: %ld\n",
858 (u_long)ntohl(ss->badstratum));
859 (void) fprintf(fp, "old version packets: %ld\n",
860 (u_long)ntohl(ss->oldversionpkt));
861 (void) fprintf(fp, "new version packets: %ld\n",
862 (u_long)ntohl(ss->newversionpkt));
863 (void) fprintf(fp, "unknown version number: %ld\n",
864 (u_long)ntohl(ss->unknownversion));
866 (void) fprintf(fp, "bad packet length: %ld\n",
865 (void) fprintf(fp, "bad packet format: %ld\n",
867 (u_long)ntohl(ss->badlength));
868 (void) fprintf(fp, "packets processed: %ld\n",
869 (u_long)ntohl(ss->processed));
870 (void) fprintf(fp, "bad authentication: %ld\n",
871 (u_long)ntohl(ss->badauth));
872 if (itemsize != sizeof(struct info_sys_stats))
873 return;
874
866 (u_long)ntohl(ss->badlength));
867 (void) fprintf(fp, "packets processed: %ld\n",
868 (u_long)ntohl(ss->processed));
869 (void) fprintf(fp, "bad authentication: %ld\n",
870 (u_long)ntohl(ss->badauth));
871 if (itemsize != sizeof(struct info_sys_stats))
872 return;
873
875 (void) fprintf(fp, "limitation rejects: %ld\n",
874 (void) fprintf(fp, "packets rejected: %ld\n",
876 (u_long)ntohl(ss->limitrejected));
877}
878
879
880
881/*
882 * iostats - print I/O statistics
883 */

--- 368 unchanged lines hidden (view full) ---

1252 int items;
1253 int itemsize;
1254 char *dummy;
1255 int res;
1256
1257 sys.flags = 0;
1258 res = 0;
1259 for (items = 0; items < pcmd->nargs; items++) {
875 (u_long)ntohl(ss->limitrejected));
876}
877
878
879
880/*
881 * iostats - print I/O statistics
882 */

--- 368 unchanged lines hidden (view full) ---

1251 int items;
1252 int itemsize;
1253 char *dummy;
1254 int res;
1255
1256 sys.flags = 0;
1257 res = 0;
1258 for (items = 0; items < pcmd->nargs; items++) {
1260 if (STREQ(pcmd->argval[items].string, "auth"))
1261 sys.flags |= SYS_FLAG_AUTHENTICATE;
1259 if (STREQ(pcmd->argval[items].string, "pps"))
1260 sys.flags |= SYS_FLAG_PPS;
1262 else if (STREQ(pcmd->argval[items].string, "bclient"))
1263 sys.flags |= SYS_FLAG_BCLIENT;
1264 else if (STREQ(pcmd->argval[items].string, "monitor"))
1265 sys.flags |= SYS_FLAG_MONITOR;
1266 else if (STREQ(pcmd->argval[items].string, "ntp"))
1267 sys.flags |= SYS_FLAG_NTP;
1268 else if (STREQ(pcmd->argval[items].string, "kernel"))
1269 sys.flags |= SYS_FLAG_KERNEL;

--- 31 unchanged lines hidden (view full) ---

1301 { "noserve", RES_DONTSERVE },
1302 { "notrust", RES_DONTTRUST },
1303 { "noquery", RES_NOQUERY },
1304 { "nomodify", RES_NOMODIFY },
1305 { "nopeer", RES_NOPEER },
1306 { "notrap", RES_NOTRAP },
1307 { "lptrap", RES_LPTRAP },
1308 { "limited", RES_LIMITED },
1261 else if (STREQ(pcmd->argval[items].string, "bclient"))
1262 sys.flags |= SYS_FLAG_BCLIENT;
1263 else if (STREQ(pcmd->argval[items].string, "monitor"))
1264 sys.flags |= SYS_FLAG_MONITOR;
1265 else if (STREQ(pcmd->argval[items].string, "ntp"))
1266 sys.flags |= SYS_FLAG_NTP;
1267 else if (STREQ(pcmd->argval[items].string, "kernel"))
1268 sys.flags |= SYS_FLAG_KERNEL;

--- 31 unchanged lines hidden (view full) ---

1300 { "noserve", RES_DONTSERVE },
1301 { "notrust", RES_DONTTRUST },
1302 { "noquery", RES_NOQUERY },
1303 { "nomodify", RES_NOMODIFY },
1304 { "nopeer", RES_NOPEER },
1305 { "notrap", RES_NOTRAP },
1306 { "lptrap", RES_LPTRAP },
1307 { "limited", RES_LIMITED },
1308 { "version", RES_VERSION },
1309 { "kod", RES_DEMOBILIZE },
1310
1309 { "", 0 }
1310};
1311
1312static struct resflags resmflags[] = {
1313 { "ntpport", RESM_NTPONLY },
1314 { "interface", RESM_INTERFACE },
1315 { "", 0 }
1316};

--- 1155 unchanged lines hidden ---
1311 { "", 0 }
1312};
1313
1314static struct resflags resmflags[] = {
1315 { "ntpport", RESM_NTPONLY },
1316 { "interface", RESM_INTERFACE },
1317 { "", 0 }
1318};

--- 1155 unchanged lines hidden ---