From: Rainer Orth Date: Fri, 8 Aug 2003 15:12:56 +0000 (+0200) Subject: Fix some problems in layout.std verification. X-Git-Tag: NTP_4_2_0~22^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee783041a28ce629bfbf0c7d5b345b7f7fceda94;p=thirdparty%2Fntp.git Fix some problems in layout.std verification. bk: 3f33bdf83TjrNsJejjLXzT9d-PO3hA --- diff --git a/ntpdc/Makefile.am b/ntpdc/Makefile.am index 670f0d84ee..f0fb8a1977 100644 --- a/ntpdc/Makefile.am +++ b/ntpdc/Makefile.am @@ -17,7 +17,7 @@ ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-layout.o: nl.c -layout.here: +layout.here: ntpdc-layout ntpdc-layout > $@ check-layout: ntpdc-layout layout.std layout.here diff --git a/ntpdc/layout.std b/ntpdc/layout.std index a592eb74f6..0a67b73e63 100644 --- a/ntpdc/layout.std +++ b/ntpdc/layout.std @@ -1,23 +1,135 @@ sizeof(struct req_pkt) = 212 +offsetof(rm_vn_mode) = 0 +offsetof(auth_seq) = 1 +offsetof(implementation) = 2 +offsetof(request) = 3 +offsetof(err_nitems) = 4 +offsetof(mbz_itemsize) = 6 +offsetof(data) = 8 +offsetof(tstamp) = 184 +offsetof(keyid) = 192 +offsetof(mac) = 196 sizeof(struct req_pkt_tail) = 28 +offsetof(tstamp) = 0 +offsetof(keyid) = 8 +offsetof(mac) = 12 sizeof(struct resp_pkt) = 508 +offsetof(rm_vn_mode) = 0 +offsetof(auth_seq) = 1 +offsetof(implementation) = 2 +offsetof(request) = 3 +offsetof(err_nitems) = 4 +offsetof(mbz_itemsize) = 6 +offsetof(data) = 8 sizeof(struct info_peer_list) = 32 +offsetof(addr) = 0 +offsetof(port) = 4 +offsetof(hmode) = 6 +offsetof(flags) = 7 +offsetof(v6_flag) = 8 +offsetof(unused1) = 12 +offsetof(addr6) = 16 sizeof(struct info_peer_summary) = 72 +offsetof(dstadr) = 0 +offsetof(srcadr) = 4 +offsetof(srcport) = 8 +offsetof(stratum) = 10 +offsetof(hpoll) = 11 +offsetof(ppoll) = 12 +offsetof(reach) = 13 +offsetof(flags) = 14 +offsetof(hmode) = 15 +offsetof(delay) = 16 +offsetof(offset) = 20 +offsetof(dispersion) = 28 +offsetof(v6_flag) = 32 +offsetof(unused1) = 36 +offsetof(dstadr6) = 40 +offsetof(srcadr6) = 56 sizeof(struct info_peer) = 280 +offsetof(dstadr) = 0 +offsetof(srcadr) = 4 +offsetof(srcport) = 8 +offsetof(flags) = 10 +offsetof(leap) = 11 +offsetof(hmode) = 12 +offsetof(pmode) = 13 +offsetof(stratum) = 14 +offsetof(ppoll) = 15 +offsetof(hpoll) = 16 +offsetof(precision) = 17 +offsetof(version) = 18 offsetof(unused8) = 19 +offsetof(reach) = 20 +offsetof(unreach) = 21 +offsetof(flash) = 22 +offsetof(ttl) = 23 +offsetof(flash2) = 24 +offsetof(associd) = 26 +offsetof(keyid) = 28 +offsetof(pkeyid) = 32 +offsetof(refid) = 36 +offsetof(timer) = 40 +offsetof(rootdelay) = 44 +offsetof(rootdispersion) = 48 +offsetof(reftime) = 52 +offsetof(org) = 60 +offsetof(rec) = 68 +offsetof(xmt) = 76 +offsetof(filtdelay) = 84 +offsetof(filtoffset) = 116 +offsetof(order) = 180 +offsetof(delay) = 188 +offsetof(dispersion) = 192 +offsetof(offset) = 196 +offsetof(selectdisp) = 204 +offsetof(unused1) = 208 offsetof(unused2) = 212 offsetof(unused3) = 216 offsetof(unused4) = 220 offsetof(unused5) = 224 offsetof(unused6) = 228 offsetof(unused7) = 232 +offsetof(estbdelay) = 236 +offsetof(v6_flag) = 240 +offsetof(unused9) = 244 +offsetof(dstadr6) = 248 +offsetof(srcadr6) = 264 sizeof(struct info_peer_stats) = 120 +offsetof(dstadr) = 0 +offsetof(srcadr) = 4 +offsetof(srcport) = 8 +offsetof(flags) = 10 +offsetof(timereset) = 12 +offsetof(timereceived) = 16 +offsetof(timetosend) = 20 +offsetof(timereachable) = 24 +offsetof(sent) = 28 +offsetof(unused1) = 32 +offsetof(processed) = 36 +offsetof(unused2) = 40 +offsetof(badauth) = 44 +offsetof(bogusorg) = 48 +offsetof(oldpkt) = 52 +offsetof(unused3) = 56 +offsetof(unused4) = 60 +offsetof(seldisp) = 64 +offsetof(selbroken) = 68 +offsetof(unused5) = 72 +offsetof(candidate) = 76 +offsetof(unused6) = 77 +offsetof(unused7) = 78 +offsetof(unused8) = 79 +offsetof(v6_flag) = 80 +offsetof(unused9) = 84 +offsetof(dstadr6) = 88 +offsetof(srcadr6) = 104 sizeof(struct info_loop) = 24 offsetof(last_offset) = 0 @@ -26,12 +138,55 @@ offsetof(compliance) = 16 offsetof(watchdog_timer) = 20 sizeof(struct info_sys) = 80 +offsetof(peer) = 0 +offsetof(peer_mode) = 4 +offsetof(leap) = 5 +offsetof(stratum) = 6 +offsetof(precision) = 7 +offsetof(rootdelay) = 8 +offsetof(rootdispersion) = 12 +offsetof(refid) = 16 +offsetof(reftime) = 20 +offsetof(poll) = 28 +offsetof(flags) = 32 +offsetof(unused1) = 33 +offsetof(unused2) = 34 +offsetof(unused3) = 35 +offsetof(bdelay) = 36 +offsetof(frequency) = 40 +offsetof(authdelay) = 44 +offsetof(stability) = 52 +offsetof(v6_flag) = 56 +offsetof(unused4) = 60 +offsetof(peer6) = 64 sizeof(struct info_sys_stats) = 44 +offsetof(timeup) = 0 +offsetof(timereset) = 4 +offsetof(denied) = 8 +offsetof(oldversionpkt) = 12 +offsetof(newversionpkt) = 16 +offsetof(unknownversion) = 20 +offsetof(badlength) = 24 +offsetof(processed) = 28 +offsetof(badauth) = 32 +offsetof(received) = 36 +offsetof(limitrejected) = 40 sizeof(struct old_info_sys_stats) = 40 +offsetof(timeup) = 0 +offsetof(timereset) = 4 +offsetof(denied) = 8 +offsetof(oldversionpkt) = 12 +offsetof(newversionpkt) = 16 +offsetof(unknownversion) = 20 +offsetof(badlength) = 24 +offsetof(processed) = 28 +offsetof(badauth) = 32 +offsetof(wanderhold) = 36 sizeof(struct info_mem_stats) = 148 +offsetof(timereset) = 0 offsetof(totalpeermem) = 4 offsetof(freepeermem) = 6 offsetof(findpeer_calls) = 8 @@ -40,36 +195,171 @@ offsetof(demobilizations) = 16 offsetof(hashcount) = 20 sizeof(struct info_io_stats) = 40 +offsetof(timereset) = 0 +offsetof(totalrecvbufs) = 4 +offsetof(freerecvbufs) = 6 +offsetof(fullrecvbufs) = 8 +offsetof(lowwater) = 10 +offsetof(dropped) = 12 +offsetof(ignored) = 16 +offsetof(received) = 20 +offsetof(sent) = 24 +offsetof(notsent) = 28 +offsetof(interrupts) = 32 +offsetof(int_received) = 36 sizeof(struct info_timer_stats) = 16 +offsetof(timereset) = 0 +offsetof(alarms) = 4 +offsetof(overflows) = 8 +offsetof(xmtcalls) = 12 sizeof(struct old_conf_peer) = 16 +offsetof(peeraddr) = 0 +offsetof(hmode) = 4 +offsetof(version) = 5 +offsetof(minpoll) = 6 +offsetof(maxpoll) = 7 +offsetof(flags) = 8 +offsetof(ttl) = 9 +offsetof(unused) = 10 +offsetof(keyid) = 12 sizeof(struct conf_peer) = 168 +offsetof(peeraddr) = 0 +offsetof(hmode) = 4 +offsetof(version) = 5 +offsetof(minpoll) = 6 +offsetof(maxpoll) = 7 +offsetof(flags) = 8 +offsetof(ttl) = 9 +offsetof(unused1) = 10 +offsetof(keyid) = 12 +offsetof(keystr) = 16 +offsetof(v6_flag) = 144 +offsetof(unused2) = 148 +offsetof(peeraddr6) = 152 sizeof(struct conf_unpeer) = 24 +offsetof(peeraddr) = 0 +offsetof(v6_flag) = 4 +offsetof(peeraddr6) = 8 sizeof(struct conf_sys_flags) = 4 offsetof(flags) = 0 sizeof(struct info_restrict) = 56 +offsetof(addr) = 0 +offsetof(mask) = 4 +offsetof(count) = 8 +offsetof(flags) = 12 +offsetof(mflags) = 14 +offsetof(v6_flag) = 16 +offsetof(unused1) = 20 +offsetof(addr6) = 24 +offsetof(mask6) = 40 sizeof(struct conf_restrict) = 48 - - - +offsetof(addr) = 0 +offsetof(mask) = 4 +offsetof(flags) = 8 +offsetof(mflags) = 10 +offsetof(v6_flag) = 12 +offsetof(addr6) = 16 +offsetof(mask6) = 32 + +sizeof(struct info_monitor_1) = 72 +offsetof(lasttime) = 0 +offsetof(firsttime) = 4 +offsetof(lastdrop) = 8 +offsetof(count) = 12 +offsetof(addr) = 16 +offsetof(daddr) = 20 +offsetof(flags) = 24 +offsetof(port) = 28 +offsetof(mode) = 30 +offsetof(version) = 31 +offsetof(v6_flag) = 32 +offsetof(unused1) = 36 +offsetof(addr6) = 40 +offsetof(daddr6) = 56 + +sizeof(struct info_monitor) = 48 +offsetof(lasttime) = 0 +offsetof(firsttime) = 4 +offsetof(lastdrop) = 8 +offsetof(count) = 12 +offsetof(addr) = 16 +offsetof(port) = 20 +offsetof(mode) = 22 +offsetof(version) = 23 +offsetof(v6_flag) = 24 +offsetof(unused1) = 28 +offsetof(addr6) = 32 + +sizeof(struct old_info_monitor) = 40 +offsetof(lasttime) = 0 +offsetof(firsttime) = 4 +offsetof(count) = 8 +offsetof(addr) = 12 +offsetof(port) = 16 +offsetof(mode) = 18 +offsetof(version) = 19 +offsetof(v6_flag) = 20 +offsetof(addr6) = 24 sizeof(struct reset_flags) = 4 offsetof(flags) = 0 sizeof(struct info_auth) = 36 +offsetof(timereset) = 0 +offsetof(numkeys) = 4 +offsetof(numfreekeys) = 8 +offsetof(keylookups) = 12 +offsetof(keynotfound) = 16 +offsetof(encryptions) = 20 +offsetof(decryptions) = 24 +offsetof(expired) = 28 +offsetof(keyuncached) = 32 sizeof(struct info_trap) = 64 +offsetof(local_address) = 0 +offsetof(trap_address) = 4 +offsetof(trap_port) = 8 +offsetof(sequence) = 10 +offsetof(settime) = 12 +offsetof(origtime) = 16 +offsetof(resets) = 20 +offsetof(flags) = 24 +offsetof(v6_flag) = 28 +offsetof(local_address6) = 32 +offsetof(trap_address6) = 48 sizeof(struct conf_trap) = 48 +offsetof(local_address) = 0 +offsetof(trap_address) = 4 +offsetof(trap_port) = 8 +offsetof(unused) = 10 +offsetof(v6_flag) = 12 +offsetof(local_address6) = 16 +offsetof(trap_address6) = 32 sizeof(struct info_control) = 60 offsetof(ctltimereset) = 0 +offsetof(numctlreq) = 4 +offsetof(numctlbadpkts) = 8 +offsetof(numctlresponses) = 12 +offsetof(numctlfrags) = 16 +offsetof(numctlerrors) = 20 +offsetof(numctltooshort) = 24 +offsetof(numctlinputresp) = 28 +offsetof(numctlinputfrag) = 32 +offsetof(numctlinputerr) = 36 +offsetof(numctlbadoffset) = 40 +offsetof(numctlbadversion) = 44 +offsetof(numctldatatooshort) = 48 +offsetof(numctlbadop) = 52 +offsetof(numasyncmsgs) = 56 sizeof(struct info_clock) = 52 offsetof(clockadr) = 0 @@ -121,4 +411,7 @@ offsetof(errcnt) = 52 offsetof(stbcnt) = 56 sizeof(struct info_dns_assoc) = 32 +offsetof(peeraddr) = 0 +offsetof(associd) = 4 +offsetof(hostname) = 6 diff --git a/ntpdc/nl.pl.in b/ntpdc/nl.pl.in index 087acf9566..dfa79c26ab 100644 --- a/ntpdc/nl.pl.in +++ b/ntpdc/nl.pl.in @@ -2,6 +2,7 @@ $found = 0; $last = 0; +$debug = 0; while (<>) { next if /^#/; @@ -13,13 +14,15 @@ while (<>) { $last = 1; } if ($found) { - if (/^(struct\s*\w*)\s*{$/) { + if (/^(struct\s*\w*)\s*{\s*$/) { $type = $1; + print STDERR "type = '$type'\n" if $debug; printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; next; } - if (/\s*\w+\s*(\w*)(\[.*\])?;$/) { + if (/\s*\w+\s*(\w*)(\[.*\])?\s*;\s*$/) { $field = $1; + print STDERR "\tfield = '$field'\n" if $debug; printf " printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n"; next; } @@ -28,5 +31,7 @@ while (<>) { $found = 0 if $last; next; } + print STDERR "Unmatched line: $_"; + exit 1; } } diff --git a/ntpdc/nl_in.c b/ntpdc/nl_in.c index d6fce15d08..3df8c7880b 100644 --- a/ntpdc/nl_in.c +++ b/ntpdc/nl_in.c @@ -1,2 +1,3 @@ +#include #include "ntpdc.h" #include "ntp_request.h"