summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/xntpdc
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1994-04-03 19:50:51 +0000
committerwollman <wollman@FreeBSD.org>1994-04-03 19:50:51 +0000
commite443cab17b10edaf34f39653876a52614bf98e94 (patch)
treecaf2959896957145971a1a5c7f3f641bc9cd15d2 /usr.sbin/xntpd/xntpdc
parentf4bf06486e3f6de83178388ed9761a4d9ee8f3bd (diff)
parentd9768fd9dbb9ffb082896c373f5e78f968079f68 (diff)
downloadFreeBSD-src-e443cab17b10edaf34f39653876a52614bf98e94.zip
FreeBSD-src-e443cab17b10edaf34f39653876a52614bf98e94.tar.gz
This commit was generated by cvs2svn to compensate for changes in r1328,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'usr.sbin/xntpd/xntpdc')
-rw-r--r--usr.sbin/xntpd/xntpdc/ntpdc.c6
-rw-r--r--usr.sbin/xntpd/xntpdc/ntpdc_ops.c71
2 files changed, 59 insertions, 18 deletions
diff --git a/usr.sbin/xntpd/xntpdc/ntpdc.c b/usr.sbin/xntpd/xntpdc/ntpdc.c
index 001bd77..aae1b40 100644
--- a/usr.sbin/xntpd/xntpdc/ntpdc.c
+++ b/usr.sbin/xntpd/xntpdc/ntpdc.c
@@ -598,8 +598,12 @@ again:
/*
* So far, so good. Copy this data into the output array.
*/
- if ((datap + datasize) > (pktdata + pktdatasize))
+ if ((datap + datasize) > (pktdata + pktdatasize)) {
+ int offset = datap - pktdata;
growpktdata();
+ *rdata = pktdata; /* might have been realloced ! */
+ datap = pktdata + offset;
+ }
memmove(datap, (char *)rpkt.data, datasize);
datap += datasize;
if (firstpkt) {
diff --git a/usr.sbin/xntpd/xntpdc/ntpdc_ops.c b/usr.sbin/xntpd/xntpdc/ntpdc_ops.c
index 55483fa..d708d4b 100644
--- a/usr.sbin/xntpd/xntpdc/ntpdc_ops.c
+++ b/usr.sbin/xntpd/xntpdc/ntpdc_ops.c
@@ -846,8 +846,12 @@ sysstats(pcmd, fp)
if (!check1item(items, fp))
return;
- if (!checkitemsize(itemsize, sizeof(struct info_sys_stats)))
+ if (itemsize != sizeof(struct info_sys_stats) &&
+ itemsize != sizeof(struct old_info_sys_stats)) {
+ /* issue warning according to new structure size */
+ checkitemsize(itemsize, sizeof(struct info_sys_stats));
return;
+ }
(void) fprintf(fp, "system uptime: %d\n",
ntohl(ss->timeup));
@@ -869,6 +873,11 @@ sysstats(pcmd, fp)
ntohl(ss->badauth));
(void) fprintf(fp, "wander hold downs: %d\n",
ntohl(ss->wanderhold));
+ if (itemsize != sizeof(struct info_sys_stats))
+ return;
+
+ (void) fprintf(fp, "limitation rejects: %d\n",
+ ntohl(ss->limitrejected));
}
@@ -1243,6 +1252,7 @@ static struct resflags resflags[] = {
{ "nopeer", RES_NOPEER },
{ "notrap", RES_NOTRAP },
{ "lptrap", RES_LPTRAP },
+ { "limited", RES_LIMITED },
{ "", 0 }
};
@@ -1463,6 +1473,7 @@ monlist(pcmd, fp)
FILE *fp;
{
struct info_monitor *ml;
+ struct old_info_monitor *oml;
int items;
int itemsize;
int res;
@@ -1476,23 +1487,49 @@ monlist(pcmd, fp)
if (!checkitems(items, fp))
return;
- if (!checkitemsize(itemsize, sizeof(struct info_monitor)))
- return;
+ if (itemsize == sizeof(struct info_monitor)) {
- (void) fprintf(fp,
- " address port count mode version lasttime firsttime\n");
- (void) fprintf(fp,
- "=====================================================================\n");
- while (items > 0) {
- (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u\n",
- nntohost(ml->addr),
- ntohs(ml->port),
- ntohl(ml->count),
- ml->mode, ml->version,
- ntohl(ml->lasttime),
- ntohl(ml->firsttime));
- ml++;
- items--;
+ (void) fprintf(fp,
+ " address port count mode version lastdrop lasttime firsttime\n");
+ (void) fprintf(fp,
+ "===============================================================================\n");
+ while (items > 0) {
+ (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u %9u\n",
+ nntohost(ml->addr),
+ ntohs(ml->port),
+ ntohl(ml->count),
+ ml->mode,
+ ml->version,
+ ntohl(ml->lastdrop),
+ ntohl(ml->lasttime),
+ ntohl(ml->firsttime));
+ ml++;
+ items--;
+ }
+ } else {
+ if (itemsize != sizeof(struct old_info_monitor)) {
+ /* issue warning according to new info_monitor size */
+ checkitemsize(itemsize, sizeof(struct info_monitor));
+ return;
+ }
+
+ oml = (struct old_info_monitor *)ml;
+ (void) fprintf(fp,
+ " address port count mode version lasttime firsttime\n");
+ (void) fprintf(fp,
+ "======================================================================\n");
+ while (items > 0) {
+ (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u\n",
+ nntohost(oml->addr),
+ ntohs(oml->port),
+ ntohl(oml->count),
+ oml->mode,
+ oml->version,
+ ntohl(oml->lasttime),
+ ntohl(oml->firsttime));
+ oml++;
+ items--;
+ }
}
}
OpenPOWER on IntegriCloud