112
115
* A request packet. These are almost a fixed length.
115
#define MAXFILENAME 128 /* max key file name length */
116
/* NOTE: also in ntp.h */
119
118
u_char rm_vn_mode; /* response, more, version, mode */
120
119
u_char auth_seq; /* key, sequence number */
122
121
u_char request; /* request number */
123
122
u_short err_nitems; /* error code/number of data items */
124
123
u_short mbz_itemsize; /* item size */
125
char data[MAXFILENAME + 16]; /* data area [32 prev](144 byte max) */
124
char data[MAXFILENAME + 48]; /* data area [32 prev](176 byte max) */
125
/* struct conf_peer must fit */
126
l_fp tstamp; /* time stamp, for authentication */
127
keyid_t keyid; /* encryption key */
128
char mac[MAX_MAC_LEN-sizeof(u_int32)]; /* (optional) 8 byte auth code */
132
* The req_pkt_tail structure is used by ntpd to adjust for different
133
* packet sizes that may arrive.
135
struct req_pkt_tail {
126
136
l_fp tstamp; /* time stamp, for authentication */
127
137
keyid_t keyid; /* encryption key */
128
138
char mac[MAX_MAC_LEN-sizeof(u_int32)]; /* (optional) 8 byte auth code */
132
142
* Input packet lengths. One with the mac, one without.
144
#define REQ_LEN_HDR 8 /* 4 * u_char + 2 * u_short */
134
145
#define REQ_LEN_MAC (sizeof(struct req_pkt))
135
146
#define REQ_LEN_NOMAC (sizeof(struct req_pkt) - MAX_MAC_LEN)
196
207
|((u_short)(nitems)&0xfff))))
198
209
#define INFO_MBZ(mbz_itemsize) ((ntohs(mbz_itemsize)>>12)&0xf)
199
#define INFO_ITEMSIZE(mbz_itemsize) (ntohs(mbz_itemsize)&0xfff)
210
#define INFO_ITEMSIZE(mbz_itemsize) ((u_short)(ntohs(mbz_itemsize)&0xfff))
200
211
#define MBZ_ITEMSIZE(itemsize) (htons((u_short)(itemsize)))
204
215
* Implementation numbers. One for universal use and one for ntpd.
206
217
#define IMPL_UNIV 0
218
#define IMPL_XNTPD_OLD 2 /* Used by pre ipv6 ntpdc */
219
#define IMPL_XNTPD 3 /* Used by post ipv6 ntpdc */
210
222
* Some limits related to authentication. Frames which are
264
276
#define REQ_MON_GETLIST_1 42 /* return collected v1 monitor data */
265
277
#define REQ_HOSTNAME_ASSOCID 43 /* Here is a hostname + assoc_id */
279
/* Determine size of pre-v6 version of structures */
280
#define v4sizeof(type) offsetof(type, v6_flag)
268
283
* Flags in the peer information returns
285
300
#define INFO_FLAG_KERNEL 0x8
286
301
#define INFO_FLAG_MONITOR 0x40
287
302
#define INFO_FLAG_FILEGEN 0x80
288
#define INFO_FLAG_PLL_SYNC 0x10
303
#define INFO_FLAG_CAL 0x10
289
304
#define INFO_FLAG_PPS_SYNC 0x20
294
309
* Well, it *would* have gone without saying, but somebody said it.
296
311
struct info_peer_list {
297
u_int32 address; /* address of peer */
312
u_int32 addr; /* address of peer */
298
313
u_short port; /* port number of peer */
299
314
u_char hmode; /* mode for this peer */
300
315
u_char flags; /* flags (from above) */
316
u_int v6_flag; /* is this v6 or not */
317
u_int unused1; /* (unused) padding for addr6 */
318
struct in6_addr addr6; /* v6 address of peer */
317
335
s_fp delay; /* peer.estdelay */
318
336
l_fp offset; /* peer.estoffset */
319
337
u_fp dispersion; /* peer.estdisp */
338
u_int v6_flag; /* is this v6 or not */
339
u_int unused1; /* (unused) padding for dstadr6 */
340
struct in6_addr dstadr6; /* local address (v6) */
341
struct in6_addr srcadr6; /* source address (v6) */
326
348
struct info_peer {
327
349
u_int32 dstadr; /* local address */
328
u_int32 srcadr; /* remote address */
350
u_int32 srcadr; /* source address */
329
351
u_short srcport; /* remote port */
330
352
u_char flags; /* peer flags */
331
353
u_char leap; /* peer.leap */
370
392
s_fp estbdelay; /* broadcast offset */
393
u_int v6_flag; /* is this v6 or not */
394
u_int unused9; /* (unused) padding for dstadr6 */
395
struct in6_addr dstadr6; /* local address (v6-like) */
396
struct in6_addr srcadr6; /* sources address (v6-like) */
399
425
u_char unused6; /* (unused) */
400
426
u_char unused7; /* (unused) */
401
427
u_char unused8; /* (unused) */
428
u_int v6_flag; /* is this v6 or not */
429
u_int unused9; /* (unused) padding for dstadr6 */
430
struct in6_addr dstadr6; /* local address */
431
struct in6_addr srcadr6; /* remote address */
418
448
* the implementation.
420
450
struct info_sys {
421
u_int32 peer; /* system peer address */
451
u_int32 peer; /* system peer address (v4) */
422
452
u_char peer_mode; /* mode we are syncing to peer in */
423
453
u_char leap; /* system leap bits */
424
454
u_char stratum; /* our stratum */
436
466
s_fp frequency; /* frequency residual (scaled ppm) */
437
467
l_fp authdelay; /* default authentication delay */
438
468
u_fp stability; /* clock stability (scaled ppm) */
469
u_int v6_flag; /* is this v6 or not */
470
u_int unused4; /* unused, padding for peer6 */
471
struct in6_addr peer6; /* system peer address (v6) */
443
476
* System stats. These are collected in the protocol module
445
478
struct info_sys_stats {
446
u_int32 timeup; /* time we have been up and running */
447
u_int32 timereset; /* time since these were last cleared */
448
u_int32 badstratum; /* packets claiming an invalid stratum */
449
u_int32 oldversionpkt; /* old version packets received */
450
u_int32 newversionpkt; /* new version packets received */
451
u_int32 unknownversion; /* don't know version packets */
452
u_int32 badlength; /* packets with bad length */
479
u_int32 timeup; /* time since restart */
480
u_int32 timereset; /* time since reset */
481
u_int32 denied; /* access denied */
482
u_int32 oldversionpkt; /* recent version */
483
u_int32 newversionpkt; /* current version */
484
u_int32 unknownversion; /* bad version */
485
u_int32 badlength; /* bad length or format */
453
486
u_int32 processed; /* packets processed */
454
u_int32 badauth; /* packets dropped because of authorization */
455
u_int32 wanderhold; /* (obsolete) */
456
u_int32 limitrejected; /* rejected because of client limitation */
487
u_int32 badauth; /* bad authentication */
488
u_int32 received; /* packets received */
489
u_int32 limitrejected; /* rate exceeded */
461
494
* System stats - old version
463
496
struct old_info_sys_stats {
464
u_int32 timeup; /* time we have been up and running */
465
u_int32 timereset; /* time since these were last cleared */
466
u_int32 badstratum; /* packets claiming an invalid stratum */
467
u_int32 oldversionpkt; /* old version packets received */
468
u_int32 newversionpkt; /* new version packets received */
469
u_int32 unknownversion; /* don't know version packets */
470
u_int32 badlength; /* packets with bad length */
497
u_int32 timeup; /* time since restart */
498
u_int32 timereset; /* time since reset */
499
u_int32 denied; /* access denied */
500
u_int32 oldversionpkt; /* recent version */
501
u_int32 newversionpkt; /* current version */
502
u_int32 unknownversion; /* bad version */
503
u_int32 badlength; /* bad length or format */
471
504
u_int32 processed; /* packets processed */
472
u_int32 badauth; /* packets dropped because of authorization */
505
u_int32 badauth; /* bad authentication */
506
u_int32 wanderhold; /* (not used) */
522
555
* Structure for passing peer configuration information
557
struct old_conf_peer {
558
u_int32 peeraddr; /* address to poll */
559
u_char hmode; /* mode, either broadcast, active or client */
560
u_char version; /* version number to poll with */
561
u_char minpoll; /* min host poll interval */
562
u_char maxpoll; /* max host poll interval */
563
u_char flags; /* flags for this request */
564
u_char ttl; /* time to live (multicast) or refclock mode */
565
u_short unused; /* unused */
566
keyid_t keyid; /* key to use for this association */
524
569
struct conf_peer {
525
570
u_int32 peeraddr; /* address to poll */
526
571
u_char hmode; /* mode, either broadcast, active or client */
529
574
u_char maxpoll; /* max host poll interval */
530
575
u_char flags; /* flags for this request */
531
576
u_char ttl; /* time to live (multicast) or refclock mode */
532
u_short unused; /* unused */
577
u_short unused1; /* unused */
533
578
keyid_t keyid; /* key to use for this association */
534
579
char keystr[MAXFILENAME]; /* public key file name*/
580
u_int v6_flag; /* is this v6 or not */
581
u_int unused2; /* unused, padding for peeraddr6 */
582
struct in6_addr peeraddr6; /* ipv6 address to poll */
537
585
#define CONF_FLAG_AUTHENABLE 0x01
561
611
* System flags we can set/clear
563
#define SYS_FLAG_BCLIENT 0x1
564
#define SYS_FLAG_PPS 0x2
565
#define SYS_FLAG_NTP 0x4
566
#define SYS_FLAG_KERNEL 0x8
613
#define SYS_FLAG_BCLIENT 0x01
614
#define SYS_FLAG_PPS 0x02
615
#define SYS_FLAG_NTP 0x04
616
#define SYS_FLAG_KERNEL 0x08
567
617
#define SYS_FLAG_MONITOR 0x10
568
618
#define SYS_FLAG_FILEGEN 0x20
619
#define SYS_FLAG_AUTH 0x40
620
#define SYS_FLAG_CAL 0x80
571
623
* Structure used for returning restrict entries
576
628
u_int32 count; /* number of packets matched */
577
629
u_short flags; /* restrict flags */
578
630
u_short mflags; /* match flags */
631
u_int v6_flag; /* is this v6 or not */
632
u_int unused1; /* unused, padding for addr6 */
633
struct in6_addr addr6; /* match address (v6) */
634
struct in6_addr mask6; /* match mask (v6) */
583
639
* Structure used for specifying restrict entries
585
641
struct conf_restrict {
586
u_int32 addr; /* match address */
642
u_int32 addr; /* match address */
587
643
u_int32 mask; /* match mask */
588
644
u_short flags; /* restrict flags */
589
645
u_short mflags; /* match flags */
646
u_int v6_flag; /* is this v6 or not */
647
struct in6_addr addr6; /* match address (v6) */
648
struct in6_addr mask6; /* match mask (v6) */
598
657
u_int32 firsttime; /* first time we received a packet */
599
658
u_int32 lastdrop; /* last time we rejected a packet due to client limitation policy */
600
659
u_int32 count; /* count of packets received */
601
u_int32 addr; /* host address */
660
u_int32 addr; /* host address V4 style */
602
661
u_int32 daddr; /* destination host address */
603
662
u_int32 flags; /* flags about destination */
604
663
u_short port; /* port number of last reception */
605
664
u_char mode; /* mode of last packet */
606
665
u_char version; /* version number of last packet */
666
u_int v6_flag; /* is this v6 or not */
667
u_int unused1; /* unused, padding for addr6 */
668
struct in6_addr addr6; /* host address V6 style */
669
struct in6_addr daddr6; /* host address V6 style */
619
682
u_short port; /* port number of last reception */
620
683
u_char mode; /* mode of last packet */
621
684
u_char version; /* version number of last packet */
685
u_int v6_flag; /* is this v6 or not */
686
u_int unused1; /* unused, padding for addr6 */
687
struct in6_addr addr6; /* host v6 address */
632
698
u_short port; /* port number of last reception */
633
699
u_char mode; /* mode of last packet */
634
700
u_char version; /* version number of last packet */
701
u_int v6_flag; /* is this v6 or not */
702
struct in6_addr addr6; /* host address (v6)*/
674
742
* Structure used to pass trap information to the client
676
744
struct info_trap {
677
u_int32 local_address; /* local interface address */
678
u_int32 trap_address; /* remote client's address */
745
u_int32 local_address; /* local interface addres (v4) */
746
u_int32 trap_address; /* remote client's addres (v4) */
679
747
u_short trap_port; /* remote port number */
680
748
u_short sequence; /* sequence number */
681
749
u_int32 settime; /* time trap last set */
682
750
u_int32 origtime; /* time trap originally set */
683
751
u_int32 resets; /* number of resets on this trap */
684
752
u_int32 flags; /* trap flags, as defined in ntp_control.h */
753
u_int v6_flag; /* is this v6 or not */
754
struct in6_addr local_address6; /* local interface address (v6) */
755
struct in6_addr trap_address6; /* remote client's address (v6) */
688
759
* Structure used to pass add/clear trap information to the client
690
761
struct conf_trap {
691
u_int32 local_address; /* local interface address */
692
u_int32 trap_address; /* remote client's address */
762
u_int32 local_address; /* remote client's address */
763
u_int32 trap_address; /* local interface address */
693
764
u_short trap_port; /* remote client's port */
694
765
u_short unused; /* (unused) */
766
u_int v6_flag; /* is this v6 or not */
767
struct in6_addr local_address6; /* local interface address (v6) */
768
struct in6_addr trap_address6; /* remote client's address (v6) */