mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 05:47:45 +00:00
Support parsing of configuration options in generic blocks.
This commit is contained in:
parent
d970ea7d43
commit
588af26930
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: parse.c,v 1.61 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: parse.c,v 1.62 2000/02/02 17:10:38 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@ -1451,6 +1451,17 @@ int parse_executable_statement (result, cfile, lose, case_context)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (config_universe && is_identifier (token)) {
|
||||||
|
option = ((struct option *)
|
||||||
|
hash_lookup (config_universe -> hash,
|
||||||
|
(const unsigned char *)val, 0));
|
||||||
|
if (option) {
|
||||||
|
token = next_token (&val, cfile);
|
||||||
|
return parse_option_statement
|
||||||
|
(result, cfile, 1, option,
|
||||||
|
supersede_option_statement);
|
||||||
|
}
|
||||||
|
}
|
||||||
*lose = 0;
|
*lose = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: tables.c,v 1.35 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: tables.c,v 1.36 2000/02/02 17:10:39 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@ -829,6 +829,12 @@ struct hash_table universe_hash;
|
|||||||
struct universe **universes;
|
struct universe **universes;
|
||||||
int universe_count, universe_max;
|
int universe_count, universe_max;
|
||||||
|
|
||||||
|
/* Universe containing names of configuration options, which, rather than
|
||||||
|
writing "option universe-name.option-name ...;", can be set by writing
|
||||||
|
"option-name ...;". */
|
||||||
|
|
||||||
|
struct universe *config_universe;
|
||||||
|
|
||||||
void initialize_common_option_spaces()
|
void initialize_common_option_spaces()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1422,6 +1422,7 @@ int universe_count, universe_max;
|
|||||||
struct universe **universes;
|
struct universe **universes;
|
||||||
extern struct hash_table universe_hash;
|
extern struct hash_table universe_hash;
|
||||||
void initialize_common_option_spaces PROTO ((void));
|
void initialize_common_option_spaces PROTO ((void));
|
||||||
|
struct universe *config_universe;
|
||||||
|
|
||||||
/* stables.c */
|
/* stables.c */
|
||||||
#if defined (FAILOVER_PROTOCOL)
|
#if defined (FAILOVER_PROTOCOL)
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: confpars.c,v 1.100 2000/02/01 03:19:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: confpars.c,v 1.101 2000/02/02 17:10:43 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@ -491,39 +491,19 @@ int parse_statement (cfile, group, type, host_decl, declaration)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
et = (struct executable_statement *)0;
|
et = (struct executable_statement *)0;
|
||||||
if (is_identifier (token)) {
|
lose = 0;
|
||||||
option = ((struct option *)
|
if (!parse_executable_statement (&et, cfile, &lose,
|
||||||
hash_lookup (server_universe.hash,
|
context_any)) {
|
||||||
(const unsigned char *)val, 0));
|
if (!lose) {
|
||||||
if (option) {
|
if (declaration)
|
||||||
token = next_token (&val, cfile);
|
|
||||||
if (!parse_option_statement
|
|
||||||
(&et, cfile, 1, option,
|
|
||||||
supersede_option_statement))
|
|
||||||
return declaration;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!et) {
|
|
||||||
lose = 0;
|
|
||||||
if (!parse_executable_statement (&et, cfile, &lose,
|
|
||||||
context_any)) {
|
|
||||||
if (!lose) {
|
|
||||||
if (declaration)
|
|
||||||
parse_warn (cfile,
|
parse_warn (cfile,
|
||||||
"expecting a declaration");
|
"expecting a declaration");
|
||||||
else
|
else
|
||||||
parse_warn (cfile,
|
parse_warn (cfile,
|
||||||
"expecting a parameter %s",
|
"expecting a parameter %s",
|
||||||
"or declaration");
|
"or declaration");
|
||||||
skip_to_semi (cfile);
|
skip_to_semi (cfile);
|
||||||
}
|
|
||||||
return declaration;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!et) {
|
|
||||||
parse_warn (cfile, "expecting a %sdeclaration",
|
|
||||||
declaration ? "" : "parameter or ");
|
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
insert_statement:
|
insert_statement:
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: stables.c,v 1.5 2000/01/25 01:45:00 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: stables.c,v 1.6 2000/02/02 17:10:43 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@ -733,4 +733,7 @@ void initialize_server_option_spaces()
|
|||||||
add_hash (&universe_hash,
|
add_hash (&universe_hash,
|
||||||
(const unsigned char *)server_universe.name, 0,
|
(const unsigned char *)server_universe.name, 0,
|
||||||
(unsigned char *)&server_universe);
|
(unsigned char *)&server_universe);
|
||||||
|
|
||||||
|
/* Make the server universe the configuration option universe. */
|
||||||
|
config_universe = &server_universe;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user