Replied: Fri, 29 Aug 1997 18:29:19 -0400
Replied: ""Ulrich Windl" <ulrich.windl@rz.uni-regensburg.de> "
Return-Path: Ulrich.Windl@rz.uni-regensburg.de 
Return-Path: <Ulrich.Windl@rz.uni-regensburg.de>
Received: from rrzs2.rz.uni-regensburg.de (rrzs2.rz.uni-regensburg.de [132.199.1.2])
	by whimsy.udel.edu (8.8.5/8.8.5) with ESMTP id GAA19005
	for <stenn@whimsy.udel.edu>; Tue, 26 Aug 1997 06:55:28 GMT
Received: from ngate.ngate.uni-regensburg.de (ngate.rz.uni-regensburg.de [132.199.3.13])
	by rrzs2.rz.uni-regensburg.de (8.8.5/8.8.5) with SMTP id IAA24666
	for <stenn@whimsy.udel.edu>; Tue, 26 Aug 1997 08:55:22 +0200 (MET DST)
Received: from rkdvmks1.ngate.uni-regensburg.de by ngate.ngate.uni-regensburg.de; Tue, 26 Aug 97 07:55 MET
Received: from rkdvmks1.ngate.uni-regensburg.de by kgate.ngate.uni-regensburg.de; Tue, 26 Aug 97 06:51 GMT
Received: from RKDVMKS1/SpoolDir by rkdvmks1.ngate.uni-regensburg.de (Mercury 1.31);
    26 Aug 97 08:55:17 +0200
Received: from SpoolDir by RKDVMKS1 (Mercury 1.31); 26 Aug 97 08:55:03 +0200
From: "Ulrich Windl" <ulrich.windl@rz.uni-regensburg.de>
Organization: Universitaet Regensburg, Klinikum
To: stenn@whimsy.udel.edu
Date: Tue, 26 Aug 1997 08:55:01 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: ntp_config.c is buggy ("clockall")
Priority: normal
X-mailer: Pegasus Mail for Windows (v2.53/R1)
Message-ID: <641BB7018CD@rkdvmks1.ngate.uni-regensburg.de>

Yesterday I found out that ntp_config.c is buggy insofar as a
"logconfig +clockall" is accepted without error (should be
"allclock").

Moreover, the value set in the logmask is wrong (should not be
shifted). The value used is "0xffff << 8".

A quick-and dirty fix would be to check in line 443 of ntp_config.c 
for the condition ``if ( offset != 0 && strncmp(t, "all", 3) == 0 )''
or you cound negate the condition above and add it with "&&" to the 
condition in the "if" (else error).

Maybe a cleaner fix would be to change some of the defines:

#define	MASK_INFO	0x11111111
#define MASK_EVENT	0x22222222
#define	MASK_STATUS	0x44444444
#define	MASK_STATIST	0x88888888
#define	MASK_ALL	0xffffffff

and

#define	FACILITY_SYS	0x0000000f
#define	FACILITY_PEER	0x000000f0
#define	FACILITY_CLOCK	0x00000f00
#define	FACILITY_SYNC	0x0000f000
#define	FACILITY_ALL	0x0000ffff	/* maybe 0xffffffff */

Anding the MASK with the FACILITY would give:

"peerstatus" == (0x44444444 & 0x000000f0) ---> 0x00000040

The advantage is that it would be commutative (i.e. "peerstatus" == 
"statuspeer"), and ("{}" denoting the empty string) "all" would be 
equivalent to "{}all", "all{}", and "allall" ;-)

I think the parser would be a bit easier and more consistent then. I 
think "allall" should be really allowed.

I haven't checked all the places where NLOG* is used, but I think the 
change is possible...

Ulrich
