diff options
author | Chris Kuethe <ckuethe@cvs.openbsd.org> | 2008-06-09 16:37:36 +0000 |
---|---|---|
committer | Chris Kuethe <ckuethe@cvs.openbsd.org> | 2008-06-09 16:37:36 +0000 |
commit | 06cbd28a8803f79ee46baf228b998ff7482ec318 (patch) | |
tree | 42f53f5b7de6a649bef8f280c2c84e5dc4eeb91d /usr.sbin/ntpd/parse.y | |
parent | b77829a82ea87b9804631ca7a4ff3c3e6d3ac074 (diff) |
Allow outgoing replies from sensor-driven servers to have a
user-configurable reference ID, eg. "GPS" or "DCF"...
ok mbalmer
Diffstat (limited to 'usr.sbin/ntpd/parse.y')
-rw-r--r-- | usr.sbin/ntpd/parse.y | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y index ea9357a8b19..252ee7e87e1 100644 --- a/usr.sbin/ntpd/parse.y +++ b/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.42 2008/02/26 10:09:58 mpf Exp $ */ +/* $OpenBSD: parse.y,v 1.43 2008/06/09 16:37:35 ckuethe Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -60,6 +60,7 @@ struct ntpd_conf *conf; struct opts { int weight; int correction; + char *refstr; } opts; void opts_default(void); @@ -76,7 +77,7 @@ typedef struct { %} %token LISTEN ON -%token SERVER SERVERS SENSOR CORRECTION WEIGHT +%token SERVER SERVERS SENSOR CORRECTION REFID WEIGHT %token ERROR %token <v.string> STRING %token <v.number> NUMBER @@ -84,6 +85,7 @@ typedef struct { %type <v.opts> server_opts server_opts_l server_opt %type <v.opts> sensor_opts sensor_opts_l sensor_opt %type <v.opts> correction +%type <v.opts> refid %type <v.opts> weight %% @@ -203,6 +205,7 @@ main : LISTEN ON address { s = new_sensor($2); s->weight = $3.weight; s->correction = $3.correction; + s->refstr = $3.refstr; free($2); TAILQ_INSERT_TAIL(&conf->ntp_conf_sensors, s, entry); } @@ -243,6 +246,7 @@ sensor_opts_l : sensor_opts_l sensor_opt | sensor_opt ; sensor_opt : correction + | refid | weight ; @@ -256,6 +260,18 @@ correction : CORRECTION NUMBER { } ; +refid : REFID STRING { + size_t l; + l = strlen($2); + if (l < 1 || l > 4) { + yyerror("refid must be a string of 1 to 4 " + "characters"); + YYERROR; + } + opts.refstr = $2; + } + ; + weight : WEIGHT NUMBER { if ($2 < 1 || $2 > 10) { yyerror("weight must be between 1 and 10"); @@ -309,6 +325,7 @@ lookup(char *s) { "correction", CORRECTION}, { "listen", LISTEN}, { "on", ON}, + { "refid", REFID}, { "sensor", SENSOR}, { "server", SERVER}, { "servers", SERVERS}, |