]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 164, 165] Make sure NTP mode 7 request and response packets are layed
authorRainer Orth <ro@TechFak.Uni-Bielefeld.DE>
Mon, 4 Aug 2003 16:33:47 +0000 (18:33 +0200)
committerRainer Orth <ro@TechFak.Uni-Bielefeld.DE>
Mon, 4 Aug 2003 16:33:47 +0000 (18:33 +0200)
out identically irrespective of 32 vs. 64-bit systems or struct in6_addr
alignment requirements.

bk: 3f2e8aebCWAo96g3bjWg51bgOnXK5Q

include/ntp_request.h
ntpd/ntp_request.c
ntpdc/Makefile.am
ntpdc/nl.pl [new file with mode: 0644]
ntpdc/nl_in.c [new file with mode: 0644]
ntpdc/ntpdc-layout.c [new file with mode: 0644]
ntpdc/ntpdc_ops.c

index f5b04c9bf1af20b52d6ea00d52a21902d9dfe9d0..8166a4df2c5ff14d09a5d963b2c4e62af182cfce 100644 (file)
@@ -276,11 +276,8 @@ struct resp_pkt {
 #define        REQ_MON_GETLIST_1       42      /* return collected v1 monitor data */
 #define        REQ_HOSTNAME_ASSOCID    43      /* Here is a hostname + assoc_id */
 
-/* Use for alternate sized structures */
-#define ALT_LONG (sizeof(struct in6_addr) + sizeof(long))
-#define ALT_INT (sizeof(struct in6_addr) +  sizeof(int)) 
-#define ALT_2ADDR_INT ((sizeof(struct in6_addr) * 2) + sizeof(int)) 
-#define ALT_2ADDR_LONG ((sizeof(struct in6_addr) * 2) + sizeof(long)) 
+/* Determine size of pre-v6 version of structures */
+#define v4sizeof(type)         offsetof(type, v6_flag)
 
 /*
  * Flags in the peer information returns
@@ -316,7 +313,8 @@ struct info_peer_list {
        u_short port;           /* port number of peer */
        u_char hmode;           /* mode for this peer */
        u_char flags;           /* flags (from above) */
-       u_long v6_flag;         /* is this v6 or not */
+       u_int v6_flag;          /* is this v6 or not */
+       u_int unused1;          /* (unused) padding for addr6 */
        struct in6_addr addr6;  /* v6 address of peer */
 };
 
@@ -337,7 +335,8 @@ struct info_peer_summary {
        s_fp delay;             /* peer.estdelay */
        l_fp offset;            /* peer.estoffset */
        u_fp dispersion;        /* peer.estdisp */
-       u_long v6_flag;                 /* is this v6 or not */
+       u_int v6_flag;                  /* is this v6 or not */
+       u_int unused1;                  /* (unused) padding for dstadr6 */
        struct in6_addr dstadr6;        /* local address (v6) */
        struct in6_addr srcadr6;        /* source address (v6) */
 };
@@ -348,7 +347,7 @@ struct info_peer_summary {
  */
 struct info_peer {
        u_int32 dstadr;         /* local address */
-       u_int32 srcadr;         /* sources address */
+       u_int32 srcadr;         /* source address */
        u_short srcport;        /* remote port */
        u_char flags;           /* peer flags */
        u_char leap;            /* peer.leap */
@@ -391,9 +390,10 @@ struct info_peer {
        int32 unused6;
        int32 unused7;
        s_fp estbdelay;         /* broadcast offset */
-       u_long v6_flag;                 /* is this v6 or not */
-       struct in6_addr dstadr6;        /*local address (v6-like) */
-       struct in6_addr srcadr6;        /*sources address (v6-like) */
+       u_int v6_flag;                  /* is this v6 or not */
+       u_int unused9;                  /* (unused) padding for dstadr6 */
+       struct in6_addr dstadr6;        /* local address (v6-like) */
+       struct in6_addr srcadr6;        /* sources address (v6-like) */
 };
 
 
@@ -426,6 +426,7 @@ struct info_peer_stats {
        u_char unused7;         /* (unused) */
        u_char unused8;         /* (unused) */
        u_int v6_flag;                  /* is this v6 or not */
+       u_int unused9;                  /* (unused) padding for dstadr6 */
        struct in6_addr dstadr6;        /* local address */
        struct in6_addr srcadr6;        /* remote address */
 };
@@ -465,7 +466,8 @@ struct info_sys {
        s_fp frequency;         /* frequency residual (scaled ppm)  */
        l_fp authdelay;         /* default authentication delay */
        u_fp stability;         /* clock stability (scaled ppm) */
-       u_long v6_flag;         /* is this v6 or not */
+       u_int v6_flag;          /* is this v6 or not */
+       u_int unused4;          /* unused, padding for peer6 */
        struct in6_addr peer6;  /* system peer address (v6) */
 };
 
@@ -572,11 +574,12 @@ struct conf_peer {
        u_char maxpoll;         /* max host poll interval */
        u_char flags;           /* flags for this request */
        u_char ttl;             /* time to live (multicast) or refclock mode */
-       u_short unused        /* unused */
+       u_short unused1;        /* unused */
        keyid_t keyid;          /* key to use for this association */
        char keystr[MAXFILENAME]; /* public key file name*/
-       u_long v6_flag;         /* is this v6 or not */
-       struct in6_addr peeraddr6;      /* ipv6 addresss to poll */
+       u_int v6_flag;          /* is this v6 or not */
+       u_int unused2;                  /* unused, padding for peeraddr6 */
+       struct in6_addr peeraddr6;      /* ipv6 address to poll */
 };
 
 #define        CONF_FLAG_AUTHENABLE    0x01
@@ -625,7 +628,8 @@ struct info_restrict {
        u_int32 count;          /* number of packets matched */
        u_short flags;          /* restrict flags */
        u_short mflags;         /* match flags */
-       u_long v6_flag;         /* is this v6 or not */
+       u_int v6_flag;          /* is this v6 or not */
+       u_int unused1;          /* unused, padding for addr6 */
        struct in6_addr addr6;  /* match address (v6) */
        struct in6_addr mask6;  /* match mask (v6) */
 };
@@ -659,7 +663,8 @@ struct info_monitor_1 {
        u_short port;           /* port number of last reception */
        u_char mode;            /* mode of last packet */
        u_char version;         /* version number of last packet */
-       u_long v6_flag;         /* is this v6 or not */
+       u_int v6_flag;          /* is this v6 or not */
+       u_int unused1;          /* unused, padding for addr6 */
        struct in6_addr addr6;  /* host address V6 style */
        struct in6_addr daddr6; /* host address V6 style */
 };
@@ -677,7 +682,8 @@ struct info_monitor {
        u_short port;           /* port number of last reception */
        u_char mode;            /* mode of last packet */
        u_char version;         /* version number of last packet */
-       u_long v6_flag;         /* is this v6 or not */
+       u_int v6_flag;          /* is this v6 or not */
+       u_int unused1;          /* unused, padding for addr6 */
        struct in6_addr addr6;  /* host v6 address */
 };
 
index 749b0587823b25e864d17c46b3845406d051595d..a137cce064fbd83aa6d6dffad831328780e30a27 100644 (file)
@@ -15,6 +15,7 @@
 #include "ntp_stdlib.h"
 
 #include <stdio.h>
+#include <stddef.h>
 #include <signal.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -39,6 +40,8 @@
  */
 static int client_v6_capable = 0;   /* the client can handle longer messages */
 
+#define v6sizeof(type) (client_v6_capable ? sizeof(type) : v4sizeof(type))
+
 struct req_proc {
        short request_code;     /* defined request code */
        short needs_auth;       /* true when authentication needed */
@@ -113,9 +116,9 @@ static      void    get_clkbug_info P((struct sockaddr_storage *, struct interface *, st
 static struct req_proc ntp_codes[] = {
        { REQ_PEER_LIST,        NOAUTH, 0, 0,   peer_list },
        { REQ_PEER_LIST_SUM,    NOAUTH, 0, 0,   peer_list_sum },
-       { REQ_PEER_INFO,    NOAUTH, (sizeof(struct info_peer_list) - ALT_LONG),
+       { REQ_PEER_INFO,    NOAUTH, v4sizeof(struct info_peer_list),
                                sizeof(struct info_peer_list), peer_info},
-       { REQ_PEER_STATS,   NOAUTH, (sizeof(struct info_peer_list) - ALT_LONG),
+       { REQ_PEER_STATS,   NOAUTH, v4sizeof(struct info_peer_list),
                                sizeof(struct info_peer_list), peer_stats},
        { REQ_SYS_INFO,         NOAUTH, 0, 0,   sys_info },
        { REQ_SYS_STATS,        NOAUTH, 0, 0,   sys_stats },
@@ -123,34 +126,34 @@ static    struct req_proc ntp_codes[] = {
        { REQ_MEM_STATS,        NOAUTH, 0, 0,   mem_stats },
        { REQ_LOOP_INFO,        NOAUTH, 0, 0,   loop_info },
        { REQ_TIMER_STATS,      NOAUTH, 0, 0,   timer_stats },
-       { REQ_CONFIG,       AUTH, (sizeof(struct conf_peer) - ALT_LONG),
+       { REQ_CONFIG,       AUTH, v4sizeof(struct conf_peer),
                                sizeof(struct conf_peer), do_conf },
-       { REQ_UNCONFIG,     AUTH, (sizeof(struct conf_unpeer) - ALT_INT),
+       { REQ_UNCONFIG,     AUTH, v4sizeof(struct conf_unpeer),
                                sizeof(struct conf_unpeer), do_unconf },
        { REQ_SET_SYS_FLAG, AUTH, sizeof(struct conf_sys_flags),
                                sizeof(struct conf_sys_flags), set_sys_flag },
        { REQ_CLR_SYS_FLAG, AUTH, sizeof(struct conf_sys_flags), 
                                sizeof(struct conf_sys_flags),  clr_sys_flag },
        { REQ_GET_RESTRICT,     NOAUTH, 0, 0,   list_restrict },
-       { REQ_RESADDFLAGS, AUTH, (sizeof(struct conf_restrict) - ALT_LONG),
+       { REQ_RESADDFLAGS, AUTH, v4sizeof(struct conf_restrict),
                                sizeof(struct conf_restrict), do_resaddflags },
-       { REQ_RESSUBFLAGS, AUTH, (sizeof(struct conf_restrict) - ALT_LONG),
+       { REQ_RESSUBFLAGS, AUTH, v4sizeof(struct conf_restrict),
                                sizeof(struct conf_restrict), do_ressubflags },
-       { REQ_UNRESTRICT, AUTH, (sizeof(struct conf_restrict) - ALT_LONG),
+       { REQ_UNRESTRICT, AUTH, v4sizeof(struct conf_restrict),
                                sizeof(struct conf_restrict), do_unrestrict },
        { REQ_MON_GETLIST,      NOAUTH, 0, 0,   mon_getlist_0 },
        { REQ_MON_GETLIST_1,    NOAUTH, 0, 0,   mon_getlist_1 },
        { REQ_RESET_STATS, AUTH, sizeof(struct reset_flags), 0, reset_stats },
-       { REQ_RESET_PEER,  AUTH, (sizeof(struct conf_unpeer) - ALT_INT),
+       { REQ_RESET_PEER,  AUTH, v4sizeof(struct conf_unpeer),
                                sizeof(struct conf_unpeer), reset_peer },
        { REQ_REREAD_KEYS,      AUTH,   0, 0,   do_key_reread },
        { REQ_TRUSTKEY,   AUTH, sizeof(u_long), sizeof(u_long), trust_key },
        { REQ_UNTRUSTKEY, AUTH, sizeof(u_long), sizeof(u_long), untrust_key },
        { REQ_AUTHINFO,         NOAUTH, 0, 0,   get_auth_info },
        { REQ_TRAPS,            NOAUTH, 0, 0,   req_get_traps },
-       { REQ_ADD_TRAP, AUTH, (sizeof(struct conf_trap) - ALT_LONG),
+       { REQ_ADD_TRAP, AUTH, v4sizeof(struct conf_trap),
                                sizeof(struct conf_trap), req_set_trap },
-       { REQ_CLR_TRAP, AUTH, (sizeof(struct conf_trap) - ALT_LONG),
+       { REQ_CLR_TRAP, AUTH, v4sizeof(struct conf_trap),
                                sizeof(struct conf_trap), req_clr_trap },
        { REQ_REQUEST_KEY, AUTH, sizeof(u_long), sizeof(u_long), 
                                set_request_keyid },
@@ -644,14 +647,9 @@ peer_list(
        register struct peer *pp;
        register int i;
        register int skip = 0;
-       int offset;
 
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_LONG;
        ip = (struct info_peer_list *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_peer_list) - offset);
+           v6sizeof(struct info_peer_list));
        for (i = 0; i < HASH_SIZE && ip != 0; i++) {
                pp = peer_hash[i];
                while (pp != 0 && ip != 0) {
@@ -707,18 +705,13 @@ peer_list_sum(
        register int i;
        l_fp ltmp;
        register int skip;
-       int offset;
 
 #ifdef DEBUG
        if (debug > 2)
            printf("wants peer list summary\n");
 #endif
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_2ADDR_LONG;
        ips = (struct info_peer_summary *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_peer_summary) - offset);
+           v6sizeof(struct info_peer_summary));
        for (i = 0; i < HASH_SIZE && ips != 0; i++) {
                pp = peer_hash[i];
                while (pp != 0 && ips != 0) {
@@ -808,7 +801,6 @@ peer_info (
        register struct info_peer *ip;
        register int items;
        register int i, j;
-       int offset;
        struct sockaddr_storage addr;
        extern struct peer *sys_peer;
        l_fp ltmp;
@@ -817,12 +809,8 @@ peer_info (
        items = INFO_NITEMS(inpkt->err_nitems);
        ipl = (struct info_peer_list *) inpkt->data;
 
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_2ADDR_LONG;
        ip = (struct info_peer *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_peer) - offset);
+           v6sizeof(struct info_peer));
        while (items-- > 0 && ip != 0) {
                memset((char *)&addr, 0, sizeof(addr));
                NSRCPORT(&addr) = ipl->port;
@@ -937,19 +925,14 @@ peer_stats (
        register struct peer *pp;
        register struct info_peer_stats *ip;
        register int items;
-       int offset;
        struct sockaddr_storage addr;
        extern struct peer *sys_peer;
 
        printf("peer_stats: called\n");
        items = INFO_NITEMS(inpkt->err_nitems);
        ipl = (struct info_peer_list *) inpkt->data;
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_2ADDR_LONG;
        ip = (struct info_peer_stats *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_peer_stats) - offset);
+           v6sizeof(struct info_peer_stats));
        while (items-- > 0 && ip != 0) {
                memset((char *)&addr, 0, sizeof(addr));
                NSRCPORT(&addr) = ipl->port;
@@ -1036,7 +1019,6 @@ sys_info(
        )
 {
        register struct info_sys *is;
-       int offset;
 
        /*
         * Importations from the protocol module
@@ -1056,12 +1038,8 @@ sys_info(
        extern double clock_stability;
        extern double sys_jitter;
 
-       if (client_v6_capable)
-               offset = 0;
-       else 
-               offset = ALT_LONG;
        is = (struct info_sys *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_sys) - offset);
+           v6sizeof(struct info_sys));
 
        is->peer = 0;
        is->peer_mode = 0;
@@ -1692,19 +1670,14 @@ list_restrict(
        register struct info_restrict *ir;
        register struct restrictlist *rl;
        register struct restrictlist6 *rl6;
-       int offset;
 
 #ifdef DEBUG
        if (debug > 2)
            printf("wants restrict list summary\n");
 #endif
-       if (client_v6_capable) 
-               offset = 0;
-       else
-               offset = ALT_2ADDR_LONG;        
 
        ir = (struct info_restrict *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_restrict) - offset);
+           v6sizeof(struct info_restrict));
        
        for (rl = restrictlist; rl != 0 && ir != 0; rl = rl->next) {
                ir->addr = htonl(rl->addr);
@@ -1867,7 +1840,6 @@ mon_getlist_0(
 {
        register struct info_monitor *im;
        register struct mon_data *md;
-       int offset;
        extern struct mon_data mon_mru_list;
        extern int mon_enabled;
 
@@ -1879,12 +1851,8 @@ mon_getlist_0(
                req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
                return;
        }
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_LONG;
        im = (struct info_monitor *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_monitor) - offset);
+           v6sizeof(struct info_monitor));
        for (md = mon_mru_list.mru_next; md != &mon_mru_list && im != 0;
             md = md->mru_next) {
                im->lasttime = htonl((u_int32)md->avg_interval);
@@ -1921,7 +1889,6 @@ mon_getlist_1(
 {
        register struct info_monitor_1 *im;
        register struct mon_data *md;
-       int offset;
        extern struct mon_data mon_mru_list;
        extern int mon_enabled;
 
@@ -1933,12 +1900,8 @@ mon_getlist_1(
                req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
                return;
        }
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_2ADDR_LONG;
        im = (struct info_monitor_1 *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_monitor_1) - offset);
+           v6sizeof(struct info_monitor_1));
        for (md = mon_mru_list.mru_next; md != &mon_mru_list && im != 0;
             md = md->mru_next) {
                im->lasttime = htonl((u_int32)md->avg_interval);
@@ -2257,7 +2220,6 @@ req_get_traps(
        register struct info_trap *it;
        register struct ctl_trap *tr;
        register int i;
-       int offset;
 
        /*
         * Imported from the control module
@@ -2270,12 +2232,8 @@ req_get_traps(
                return;
        }
 
-       if (client_v6_capable)
-               offset = 0;
-       else
-               offset = ALT_2ADDR_INT;         
        it = (struct info_trap *)prepare_pkt(srcadr, inter, inpkt,
-           sizeof(struct info_trap) - offset);
+           v6sizeof(struct info_trap));
 
        for (i = 0, tr = ctl_trap; i < CTL_MAXTRAPS; i++, tr++) {
                if (tr->tr_flags & TRAP_INUSE) {
index 8b88386eafc843c9d7f99bf2d33ec1a52f254392..1774d0fe1547e4f6a6f3f3d18680a26f3d791538 100644 (file)
@@ -1,9 +1,12 @@
 #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
 AUTOMAKE_OPTIONS = ../util/ansi2knr
 bin_PROGRAMS = ntpdc
+noinst_PROGRAMS = ntpdc-layout
 INCLUDES = -I$(top_srcdir)/include
 # LDADD might need RESLIB and ADJLIB
 LDADD =        version.o ../libntp/libntp.a @READLINE_LIBS@
+# ntpdc-layout doesn't need any additional libraries at all
+ntpdc_layout_LDADD =
 DISTCLEANFILES = .version version.c
 noinst_HEADERS = ntpdc.h
 #EXTRA_DIST = ntpdc.mak
diff --git a/ntpdc/nl.pl b/ntpdc/nl.pl
new file mode 100644 (file)
index 0000000..22dc9c5
--- /dev/null
@@ -0,0 +1,32 @@
+#!/vol/perl-5.8/bin/perl -w
+
+$found = 0;
+$last = 0;
+
+while (<>) {
+    next if /^#/;
+    next if /^\s*$/;
+    if (/^struct req_pkt/) {
+       $found = 1;
+    }
+    if (/^struct info_dns_assoc/) {
+       $last = 1;
+    }
+    if ($found) {
+       if (/^(struct\s*\w*)\s*{$/) {
+           $type = $1;
+           printf "  printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
+           next;
+       }
+       if (/\s*\w+\s*(\w*)(\[.*\])?;$/) {
+           $field = $1;
+           printf "  printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n";
+           next;
+       }
+       if (/^};$/) {
+           printf "  printf(\"\\n\");\n\n";
+           $found = 0 if $last;
+           next;
+       }
+    }
+}
diff --git a/ntpdc/nl_in.c b/ntpdc/nl_in.c
new file mode 100644 (file)
index 0000000..d6fce15
--- /dev/null
@@ -0,0 +1,2 @@
+#include "ntpdc.h"
+#include "ntp_request.h"
diff --git a/ntpdc/ntpdc-layout.c b/ntpdc/ntpdc-layout.c
new file mode 100644 (file)
index 0000000..b05fbf3
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * ntpdc-layout - print layout of NTP mode 7 request/response packets
+ */
+
+#include <stdio.h>
+#include <stddef.h>
+
+#include "ntpdc.h"
+#include "ntp_stdlib.h"
+
+#if defined(IMPL_XNTPD_OLD) && IMPL_XNTPD != 3
+#error Unexpected IMPL_XNTPD
+#endif
+
+int
+main(void)
+{
+#include "nl.c"
+
+  return (EXIT_SUCCESS);
+}
index df1ad19b15fb47efd4866fafe3c35bf6688dc0d9..7c5e925fe21dc4e3cf39d699918e46bdb9c19221 100644 (file)
@@ -7,6 +7,7 @@
 #endif
 
 #include <stdio.h>
+#include <stddef.h>
 
 #include "ntpdc.h"
 #include "ntp_control.h"
@@ -307,7 +308,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_peer_list)) &&
-           !checkitemsize(itemsize, sizeof(struct info_peer_list) - ALT_LONG))
+           !checkitemsize(itemsize, v4sizeof(struct info_peer_list)))
            return;
 
        while (items > 0) {
@@ -397,8 +398,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_peer_summary)) &&
-           !checkitemsize(itemsize, sizeof(struct info_peer_summary) -
-           ALT_2ADDR_LONG))
+           !checkitemsize(itemsize, v4sizeof(struct info_peer_summary)))
                return;
 
        (void) fprintf(fp,
@@ -644,7 +644,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct info_peer_list);
        else
-               sendsize = sizeof(struct info_peer_list) - ALT_LONG;
+               sendsize = v4sizeof(struct info_peer_list);
 
        for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 4); qitems++) {
                if (pcmd->argval[qitems].netnum.ss_family == AF_INET) {
@@ -681,7 +681,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_peer)) &&
-           !checkitemsize(itemsize, sizeof(struct info_peer) - ALT_2ADDR_LONG))
+           !checkitemsize(itemsize, v4sizeof(struct info_peer)))
            return;
 
        while (items-- > 0) {
@@ -716,7 +716,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct info_peer_list);
        else
-               sendsize = sizeof(struct info_peer_list) - ALT_LONG;
+               sendsize = v4sizeof(struct info_peer_list);
 
        memset((char *)plist, 0, sizeof(struct info_peer_list) * min(MAXARGS, 4));
        for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 4); qitems++) {
@@ -755,8 +755,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_peer_stats)) &&
-           !checkitemsize(itemsize, sizeof(struct info_peer_stats) -
-           ALT_2ADDR_INT))
+           !checkitemsize(itemsize, v4sizeof(struct info_peer_stats)))
            return;
 
        while (items-- > 0) {
@@ -917,7 +916,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_sys)) &&
-           !checkitemsize(itemsize, sizeof(struct info_sys) - ALT_LONG))
+           !checkitemsize(itemsize, v4sizeof(struct info_sys)))
            return;
 
        memset((char *)&peeraddr, 0, sizeof(peeraddr));
@@ -1298,7 +1297,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct conf_peer);
        else
-               sendsize = sizeof(struct conf_peer) - ALT_LONG;
+               sendsize = v4sizeof(struct conf_peer);
 
        items = pcmd->nargs;
 
@@ -1426,7 +1425,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct conf_unpeer);
        else
-               sendsize = sizeof(struct conf_unpeer) - ALT_INT;
+               sendsize = v4sizeof(struct conf_unpeer);
 
        for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 8); qitems++) {
                if (pcmd->argval[0].netnum.ss_family == AF_INET) {
@@ -1622,8 +1621,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_restrict)) &&
-           !checkitemsize(itemsize, sizeof(struct info_restrict) -
-           ALT_2ADDR_LONG))
+           !checkitemsize(itemsize, v4sizeof(struct info_restrict)))
            return;
 
        (void) fprintf(fp,
@@ -1774,7 +1772,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct conf_restrict);
        else
-               sendsize = sizeof(struct conf_restrict) - ALT_2ADDR_INT;
+               sendsize = v4sizeof(struct conf_restrict);
 
        if (pcmd->argval[0].netnum.ss_family == AF_INET) {
                cres.addr = GET_INADDR(pcmd->argval[0].netnum);
@@ -1908,7 +1906,7 @@ again:
            return;
 
        if (itemsize == sizeof(struct info_monitor_1) ||
-           itemsize == sizeof(struct info_monitor_1) - ALT_2ADDR_LONG) {
+           itemsize == v4sizeof(struct info_monitor_1)) {
                struct info_monitor_1 *ml = (struct info_monitor_1 *) struct_star;
 
                (void) fprintf(fp,
@@ -1951,7 +1949,7 @@ again:
                        items--;
                }
        } else if (itemsize == sizeof(struct info_monitor) ||
-           itemsize == sizeof(struct info_monitor) - ALT_LONG) {
+           itemsize == v4sizeof(struct info_monitor)) {
                struct info_monitor *ml = (struct info_monitor *) struct_star;
 
                (void) fprintf(fp,
@@ -2115,7 +2113,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct conf_unpeer);
        else
-               sendsize = sizeof(struct conf_unpeer) - ALT_INT;
+               sendsize = v4sizeof(struct conf_unpeer);
 
        for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 8); qitems++) {
                if (pcmd->argval[qitems].netnum.ss_family == AF_INET) {
@@ -2335,7 +2333,7 @@ again:
            return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_trap)) &&
-           !checkitemsize(itemsize, sizeof(struct info_trap) - ALT_2ADDR_INT))
+           !checkitemsize(itemsize, v4sizeof(struct info_trap)))
            return;
 
        for (i = 0; i < items; i++ ) {
@@ -2429,7 +2427,7 @@ again:
        if (impl_ver == IMPL_XNTPD)
                sendsize = sizeof(struct conf_trap);
        else
-               sendsize = sizeof(struct conf_trap) - ALT_2ADDR_INT;
+               sendsize = v4sizeof(struct conf_trap);
 
        if (pcmd->argval[0].netnum.ss_family == AF_INET) {
                ctrap.trap_address = GET_INADDR(pcmd->argval[0].netnum);