76
76
* "logconfig" building blocks
79
const char * const name;
83
83
static struct masks logcfg_class[] = {
84
{ "clock", NLOG_OCLOCK },
85
{ "peer", NLOG_OPEER },
86
{ "sync", NLOG_OSYNC },
91
static struct masks logcfg_item[] = {
84
{ "clock", NLOG_OCLOCK },
85
{ "peer", NLOG_OPEER },
86
{ "sync", NLOG_OSYNC },
91
/* logcfg_noclass_items[] masks are complete and must not be shifted */
92
static struct masks logcfg_noclass_items[] = {
93
{ "allall", NLOG_SYSMASK | NLOG_PEERMASK | NLOG_CLOCKMASK | NLOG_SYNCMASK },
94
{ "allinfo", NLOG_SYSINFO | NLOG_PEERINFO | NLOG_CLOCKINFO | NLOG_SYNCINFO },
95
{ "allevents", NLOG_SYSEVENT | NLOG_PEEREVENT | NLOG_CLOCKEVENT | NLOG_SYNCEVENT },
96
{ "allstatus", NLOG_SYSSTATUS | NLOG_PEERSTATUS | NLOG_CLOCKSTATUS | NLOG_SYNCSTATUS },
97
{ "allstatistics", NLOG_SYSSTATIST | NLOG_PEERSTATIST | NLOG_CLOCKSTATIST | NLOG_SYNCSTATIST },
98
/* the remainder are misspellings of clockall, peerall, sysall, and syncall. */
99
{ "allclock", (NLOG_INFO | NLOG_STATIST | NLOG_EVENT | NLOG_STATUS) << NLOG_OCLOCK },
100
{ "allpeer", (NLOG_INFO | NLOG_STATIST | NLOG_EVENT | NLOG_STATUS) << NLOG_OPEER },
101
{ "allsys", (NLOG_INFO | NLOG_STATIST | NLOG_EVENT | NLOG_STATUS) << NLOG_OSYS },
102
{ "allsync", (NLOG_INFO | NLOG_STATIST | NLOG_EVENT | NLOG_STATUS) << NLOG_OSYNC },
106
/* logcfg_class_items[] masks are shiftable by NLOG_O* counts */
107
static struct masks logcfg_class_items[] = {
108
{ "all", NLOG_INFO | NLOG_EVENT | NLOG_STATUS | NLOG_STATIST },
92
109
{ "info", NLOG_INFO },
93
{ "allinfo", NLOG_SYSINFO|NLOG_PEERINFO|NLOG_CLOCKINFO|NLOG_SYNCINFO },
94
110
{ "events", NLOG_EVENT },
95
{ "allevents", NLOG_SYSEVENT|NLOG_PEEREVENT|NLOG_CLOCKEVENT|NLOG_SYNCEVENT },
96
111
{ "status", NLOG_STATUS },
97
{ "allstatus", NLOG_SYSSTATUS|NLOG_PEERSTATUS|NLOG_CLOCKSTATUS|NLOG_SYNCSTATUS },
98
112
{ "statistics", NLOG_STATIST },
99
{ "allstatistics", NLOG_SYSSTATIST|NLOG_PEERSTATIST|NLOG_CLOCKSTATIST|NLOG_SYNCSTATIST },
100
{ "allclock", (NLOG_INFO|NLOG_STATIST|NLOG_EVENT|NLOG_STATUS)<<NLOG_OCLOCK },
101
{ "allpeer", (NLOG_INFO|NLOG_STATIST|NLOG_EVENT|NLOG_STATUS)<<NLOG_OPEER },
102
{ "allsys", (NLOG_INFO|NLOG_STATIST|NLOG_EVENT|NLOG_STATUS)<<NLOG_OSYS },
103
{ "allsync", (NLOG_INFO|NLOG_STATIST|NLOG_EVENT|NLOG_STATUS)<<NLOG_OSYNC },
104
{ "all", NLOG_SYSMASK|NLOG_PEERMASK|NLOG_CLOCKMASK|NLOG_SYNCMASK },
305
313
void ntpd_set_tod_using(const char *);
306
static unsigned long get_pfxmatch(char **s,struct masks *m);
307
static unsigned long get_match(char *s,struct masks *m);
308
static unsigned long get_logmask(char *s);
314
static u_int32 get_pfxmatch(const char **, struct masks *);
315
static u_int32 get_match(const char *, struct masks *);
316
static u_int32 get_logmask(const char *);
309
317
static int getnetnum(const char *num,sockaddr_u *addr, int complain,
310
318
enum gnn_type a_type);
311
319
static int get_multiple_netnums(const char *num, sockaddr_u *addr,
4064
4072
* get_logmask - build bitmask for ntp_syslogmask
4066
static unsigned long
4072
unsigned long offset;
4083
mask = get_match(str, logcfg_noclass_items);
4076
4088
offset = get_pfxmatch(&t, logcfg_class);
4077
mask = get_match(t, logcfg_item);
4089
mask = get_match(t, logcfg_class_items);
4080
4092
return mask << offset;
4082
msyslog(LOG_ERR, "logconfig: illegal argument %s - ignored", s);
4094
msyslog(LOG_ERR, "logconfig: '%s' not recognized - ignored",