From 310ab6d7ff9b6ca4c8c1159bdd4eafd63aaf34ba Mon Sep 17 00:00:00 2001 From: bapt Date: Tue, 22 May 2012 16:33:10 +0000 Subject: Fix world after byacc import: - old yacc(1) use to magicially append stdlib.h, while new one don't - new yacc(1) do declare yyparse by itself, fix redundant declaration of 'yyparse' Approved by: des (mentor) --- sbin/devd/parse.y | 1 + sbin/hastd/hast.h | 1 - sbin/hastd/parse.y | 1530 ++++++++++++++++++------------------ usr.bin/ar/acpyacc.y | 1 - usr.bin/bc/bc.y | 1 - usr.bin/find/getdate.y | 2 - usr.bin/m4/parser.y | 1 - usr.bin/mkcsmapper/ldef.h | 1 - usr.bin/mklocale/extern.h | 1 - usr.sbin/bluetooth/bthidd/parser.y | 2 +- usr.sbin/bluetooth/hcsecd/parser.y | 1 + usr.sbin/config/config.h | 1 - usr.sbin/config/main.c | 1 + usr.sbin/fifolog/lib/getdate.y | 2 - usr.sbin/jail/config.c | 2 + usr.sbin/jail/jailp.h | 1 - 16 files changed, 774 insertions(+), 775 deletions(-) diff --git a/sbin/devd/parse.y b/sbin/devd/parse.y index 28b8a90..6334b4e 100644 --- a/sbin/devd/parse.y +++ b/sbin/devd/parse.y @@ -29,6 +29,7 @@ * $FreeBSD$ */ +#include #include "devd.h" #include #include diff --git a/sbin/hastd/hast.h b/sbin/hastd/hast.h index 94e5724..263e984 100644 --- a/sbin/hastd/hast.h +++ b/sbin/hastd/hast.h @@ -244,6 +244,5 @@ void yy_config_free(struct hastd_config *config); void yyerror(const char *); int yylex(void); -int yyparse(void); #endif /* !_HAST_H_ */ diff --git a/sbin/hastd/parse.y b/sbin/hastd/parse.y index 2c16f34..a20b61a 100644 --- a/sbin/hastd/parse.y +++ b/sbin/hastd/parse.y @@ -77,332 +77,483 @@ static int depth1_metaflush; extern void yyrestart(FILE *); -static int -isitme(const char *name) -{ - char buf[MAXHOSTNAMELEN]; - char *pos; - size_t bufsize; - - /* - * First check if the given name matches our full hostname. - */ - if (gethostname(buf, sizeof(buf)) < 0) { - pjdlog_errno(LOG_ERR, "gethostname() failed"); - return (-1); - } - if (strcmp(buf, name) == 0) - return (1); +static int isitme(const char *name); +static bool family_supported(int family); +static int node_names(char **namesp); +%} - /* - * Now check if it matches first part of the host name. - */ - pos = strchr(buf, '.'); - if (pos != NULL && (size_t)(pos - buf) == strlen(name) && - strncmp(buf, name, pos - buf) == 0) { - return (1); - } +%token CONTROL PIDFILE LISTEN REPLICATION CHECKSUM COMPRESSION METAFLUSH +%token TIMEOUT EXEC RESOURCE NAME LOCAL REMOTE SOURCE ON OFF +%token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF +%token NUM STR OB CB - /* - * At the end check if name is equal to our host's UUID. - */ - bufsize = sizeof(buf); - if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) { - pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed"); - return (-1); - } - if (strcasecmp(buf, name) == 0) - return (1); +%type remote_str +%type replication_type +%type checksum_type +%type compression_type +%type boolean - /* - * Looks like this isn't about us. - */ - return (0); +%union +{ + int num; + char *str; } -static bool -family_supported(int family) -{ - int sock; +%token NUM +%token STR - sock = socket(family, SOCK_STREAM, 0); - if (sock == -1 && errno == EPROTONOSUPPORT) - return (false); - if (sock >= 0) - (void)close(sock); - return (true); -} +%% -static int -node_names(char **namesp) -{ - static char names[MAXHOSTNAMELEN * 3]; - char buf[MAXHOSTNAMELEN]; - char *pos; - size_t bufsize; +statements: + | + statements statement + ; - if (gethostname(buf, sizeof(buf)) < 0) { - pjdlog_errno(LOG_ERR, "gethostname() failed"); - return (-1); +statement: + control_statement + | + pidfile_statement + | + listen_statement + | + replication_statement + | + checksum_statement + | + compression_statement + | + timeout_statement + | + exec_statement + | + metaflush_statement + | + node_statement + | + resource_statement + ; + +control_statement: CONTROL STR + { + switch (depth) { + case 0: + if (strlcpy(depth0_control, $2, + sizeof(depth0_control)) >= + sizeof(depth0_control)) { + pjdlog_error("control argument is too long."); + free($2); + return (1); + } + break; + case 1: + if (!mynode) + break; + if (strlcpy(lconfig->hc_controladdr, $2, + sizeof(lconfig->hc_controladdr)) >= + sizeof(lconfig->hc_controladdr)) { + pjdlog_error("control argument is too long."); + free($2); + return (1); + } + break; + default: + PJDLOG_ABORT("control at wrong depth level"); + } + free($2); } + ; - /* First component of the host name. */ - pos = strchr(buf, '.'); - if (pos != NULL && pos != buf) { - (void)strlcpy(names, buf, MIN((size_t)(pos - buf + 1), - sizeof(names))); - (void)strlcat(names, ", ", sizeof(names)); +pidfile_statement: PIDFILE STR + { + switch (depth) { + case 0: + if (strlcpy(depth0_pidfile, $2, + sizeof(depth0_pidfile)) >= + sizeof(depth0_pidfile)) { + pjdlog_error("pidfile argument is too long."); + free($2); + return (1); + } + break; + case 1: + if (!mynode) + break; + if (strlcpy(lconfig->hc_pidfile, $2, + sizeof(lconfig->hc_pidfile)) >= + sizeof(lconfig->hc_pidfile)) { + pjdlog_error("pidfile argument is too long."); + free($2); + return (1); + } + break; + default: + PJDLOG_ABORT("pidfile at wrong depth level"); + } + free($2); } + ; - /* Full host name. */ - (void)strlcat(names, buf, sizeof(names)); - (void)strlcat(names, ", ", sizeof(names)); +listen_statement: LISTEN STR + { + struct hastd_listen *lst; - /* Host UUID. */ - bufsize = sizeof(buf); - if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) { - pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed"); - return (-1); + lst = calloc(1, sizeof(*lst)); + if (lst == NULL) { + pjdlog_error("Unable to allocate memory for listen address."); + free($2); + return (1); + } + if (strlcpy(lst->hl_addr, $2, sizeof(lst->hl_addr)) >= + sizeof(lst->hl_addr)) { + pjdlog_error("listen argument is too long."); + free($2); + free(lst); + return (1); + } + switch (depth) { + case 0: + TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next); + break; + case 1: + if (mynode) + TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next); + else + free(lst); + break; + default: + PJDLOG_ABORT("listen at wrong depth level"); + } + free($2); } - (void)strlcat(names, buf, sizeof(names)); - - *namesp = names; + ; - return (0); -} +replication_statement: REPLICATION replication_type + { + switch (depth) { + case 0: + depth0_replication = $2; + break; + case 1: + PJDLOG_ASSERT(curres != NULL); + curres->hr_replication = $2; + break; + default: + PJDLOG_ABORT("replication at wrong depth level"); + } + } + ; -void -yyerror(const char *str) -{ +replication_type: + FULLSYNC { $$ = HAST_REPLICATION_FULLSYNC; } + | + MEMSYNC { $$ = HAST_REPLICATION_MEMSYNC; } + | + ASYNC { $$ = HAST_REPLICATION_ASYNC; } + ; - pjdlog_error("Unable to parse configuration file at line %d near '%s': %s", - lineno, yytext, str); -} +checksum_statement: CHECKSUM checksum_type + { + switch (depth) { + case 0: + depth0_checksum = $2; + break; + case 1: + PJDLOG_ASSERT(curres != NULL); + curres->hr_checksum = $2; + break; + default: + PJDLOG_ABORT("checksum at wrong depth level"); + } + } + ; -struct hastd_config * -yy_config_parse(const char *config, bool exitonerror) -{ - int ret; - - curres = NULL; - mynode = false; - depth = 0; - lineno = 0; - - depth0_timeout = HAST_TIMEOUT; - depth0_replication = HAST_REPLICATION_FULLSYNC; - depth0_checksum = HAST_CHECKSUM_NONE; - depth0_compression = HAST_COMPRESSION_HOLE; - strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control)); - strlcpy(depth0_pidfile, HASTD_PIDFILE, sizeof(depth0_pidfile)); - TAILQ_INIT(&depth0_listen); - strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4, - sizeof(depth0_listen_tcp4)); - strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6, - sizeof(depth0_listen_tcp6)); - depth0_exec[0] = '\0'; - depth0_metaflush = 1; +checksum_type: + NONE { $$ = HAST_CHECKSUM_NONE; } + | + CRC32 { $$ = HAST_CHECKSUM_CRC32; } + | + SHA256 { $$ = HAST_CHECKSUM_SHA256; } + ; - lconfig = calloc(1, sizeof(*lconfig)); - if (lconfig == NULL) { - pjdlog_error("Unable to allocate memory for configuration."); - if (exitonerror) - exit(EX_TEMPFAIL); - return (NULL); +compression_statement: COMPRESSION compression_type + { + switch (depth) { + case 0: + depth0_compression = $2; + break; + case 1: + PJDLOG_ASSERT(curres != NULL); + curres->hr_compression = $2; + break; + default: + PJDLOG_ABORT("compression at wrong depth level"); + } } + ; - TAILQ_INIT(&lconfig->hc_listen); - TAILQ_INIT(&lconfig->hc_resources); - - yyin = fopen(config, "r"); - if (yyin == NULL) { - pjdlog_errno(LOG_ERR, "Unable to open configuration file %s", - config); - yy_config_free(lconfig); - if (exitonerror) - exit(EX_OSFILE); - return (NULL); - } - yyrestart(yyin); - ret = yyparse(); - fclose(yyin); - if (ret != 0) { - yy_config_free(lconfig); - if (exitonerror) - exit(EX_CONFIG); - return (NULL); - } +compression_type: + NONE { $$ = HAST_COMPRESSION_NONE; } + | + HOLE { $$ = HAST_COMPRESSION_HOLE; } + | + LZF { $$ = HAST_COMPRESSION_LZF; } + ; - /* - * Let's see if everything is set up. - */ - if (lconfig->hc_controladdr[0] == '\0') { - strlcpy(lconfig->hc_controladdr, depth0_control, - sizeof(lconfig->hc_controladdr)); - } - if (lconfig->hc_pidfile[0] == '\0') { - strlcpy(lconfig->hc_pidfile, depth0_pidfile, - sizeof(lconfig->hc_pidfile)); +timeout_statement: TIMEOUT NUM + { + if ($2 <= 0) { + pjdlog_error("Negative or zero timeout."); + return (1); + } + switch (depth) { + case 0: + depth0_timeout = $2; + break; + case 1: + PJDLOG_ASSERT(curres != NULL); + curres->hr_timeout = $2; + break; + default: + PJDLOG_ABORT("timeout at wrong depth level"); + } } - if (!TAILQ_EMPTY(&depth0_listen)) - TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next); - if (TAILQ_EMPTY(&lconfig->hc_listen)) { - struct hastd_listen *lst; + ; - if (family_supported(AF_INET)) { - lst = calloc(1, sizeof(*lst)); - if (lst == NULL) { - pjdlog_error("Unable to allocate memory for listen address."); - yy_config_free(lconfig); - if (exitonerror) - exit(EX_TEMPFAIL); - return (NULL); +exec_statement: EXEC STR + { + switch (depth) { + case 0: + if (strlcpy(depth0_exec, $2, sizeof(depth0_exec)) >= + sizeof(depth0_exec)) { + pjdlog_error("Exec path is too long."); + free($2); + return (1); } - (void)strlcpy(lst->hl_addr, depth0_listen_tcp4, - sizeof(lst->hl_addr)); - TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next); - } else { - pjdlog_debug(1, - "No IPv4 support in the kernel, not listening on IPv4 address."); - } - if (family_supported(AF_INET6)) { - lst = calloc(1, sizeof(*lst)); - if (lst == NULL) { - pjdlog_error("Unable to allocate memory for listen address."); - yy_config_free(lconfig); - if (exitonerror) - exit(EX_TEMPFAIL); - return (NULL); + break; + case 1: + PJDLOG_ASSERT(curres != NULL); + if (strlcpy(curres->hr_exec, $2, + sizeof(curres->hr_exec)) >= + sizeof(curres->hr_exec)) { + pjdlog_error("Exec path is too long."); + free($2); + return (1); } - (void)strlcpy(lst->hl_addr, depth0_listen_tcp6, - sizeof(lst->hl_addr)); - TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next); - } else { - pjdlog_debug(1, - "No IPv6 support in the kernel, not listening on IPv6 address."); - } - if (TAILQ_EMPTY(&lconfig->hc_listen)) { - pjdlog_error("No address to listen on."); - yy_config_free(lconfig); - if (exitonerror) - exit(EX_TEMPFAIL); - return (NULL); + break; + default: + PJDLOG_ABORT("exec at wrong depth level"); } + free($2); } - TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) { - PJDLOG_ASSERT(curres->hr_provname[0] != '\0'); - PJDLOG_ASSERT(curres->hr_localpath[0] != '\0'); - PJDLOG_ASSERT(curres->hr_remoteaddr[0] != '\0'); + ; - if (curres->hr_replication == -1) { - /* - * Replication is not set at resource-level. - * Use global or default setting. - */ - curres->hr_replication = depth0_replication; - } - if (curres->hr_replication == HAST_REPLICATION_MEMSYNC) { - pjdlog_warning("Replication mode \"%s\" is not implemented, falling back to \"%s\".", - "memsync", "fullsync"); - curres->hr_replication = HAST_REPLICATION_FULLSYNC; - } - if (curres->hr_checksum == -1) { - /* - * Checksum is not set at resource-level. - * Use global or default setting. - */ - curres->hr_checksum = depth0_checksum; - } - if (curres->hr_compression == -1) { - /* - * Compression is not set at resource-level. - * Use global or default setting. - */ - curres->hr_compression = depth0_compression; - } - if (curres->hr_timeout == -1) { - /* - * Timeout is not set at resource-level. - * Use global or default setting. - */ - curres->hr_timeout = depth0_timeout; - } - if (curres->hr_exec[0] == '\0') { - /* - * Exec is not set at resource-level. - * Use global or default setting. - */ - strlcpy(curres->hr_exec, depth0_exec, - sizeof(curres->hr_exec)); - } - if (curres->hr_metaflush == -1) { - /* - * Metaflush is not set at resource-level. - * Use global or default setting. - */ - curres->hr_metaflush = depth0_metaflush; +metaflush_statement: METAFLUSH boolean + { + switch (depth) { + case 0: + depth0_metaflush = $2; + break; + case 1: + PJDLOG_ASSERT(curres != NULL); + depth1_metaflush = $2; + break; + case 2: + if (!mynode) + break; + PJDLOG_ASSERT(curres != NULL); + curres->hr_metaflush = $2; + break; + default: + PJDLOG_ABORT("metaflush at wrong depth level"); } } + ; - return (lconfig); -} - -void -yy_config_free(struct hastd_config *config) -{ - struct hastd_listen *lst; - struct hast_resource *res; +boolean: + ON { $$ = 1; } + | + OFF { $$ = 0; } + ; - while ((lst = TAILQ_FIRST(&depth0_listen)) != NULL) { - TAILQ_REMOVE(&depth0_listen, lst, hl_next); - free(lst); +node_statement: ON node_start OB node_entries CB + { + mynode = false; } - while ((lst = TAILQ_FIRST(&config->hc_listen)) != NULL) { - TAILQ_REMOVE(&config->hc_listen, lst, hl_next); - free(lst); - } - while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) { - TAILQ_REMOVE(&config->hc_resources, res, hr_next); - free(res); - } - free(config); -} -%} - -%token CONTROL PIDFILE LISTEN REPLICATION CHECKSUM COMPRESSION METAFLUSH -%token TIMEOUT EXEC RESOURCE NAME LOCAL REMOTE SOURCE ON OFF -%token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF -%token NUM STR OB CB - -%type remote_str -%type replication_type -%type checksum_type -%type compression_type -%type boolean - -%union -{ - int num; - char *str; -} - -%token NUM -%token STR + ; -%% +node_start: STR + { + switch (isitme($1)) { + case -1: + free($1); + return (1); + case 0: + break; + case 1: + mynode = true; + break; + default: + PJDLOG_ABORT("invalid isitme() return value"); + } + free($1); + } + ; -statements: +node_entries: | - statements statement + node_entries node_entry ; -statement: +node_entry: control_statement | pidfile_statement | listen_statement + ; + +resource_statement: RESOURCE resource_start OB resource_entries CB + { + if (curres != NULL) { + /* + * There must be section for this node, at least with + * remote address configuration. + */ + if (!hadmynode) { + char *names; + + if (node_names(&names) != 0) + return (1); + pjdlog_error("No resource %s configuration for this node (acceptable node names: %s).", + curres->hr_name, names); + return (1); + } + + /* + * Let's see if there are some resource-level settings + * that we can use for node-level settings. + */ + if (curres->hr_provname[0] == '\0' && + depth1_provname[0] != '\0') { + /* + * Provider name is not set at node-level, + * but is set at resource-level, use it. + */ + strlcpy(curres->hr_provname, depth1_provname, + sizeof(curres->hr_provname)); + } + if (curres->hr_localpath[0] == '\0' && + depth1_localpath[0] != '\0') { + /* + * Path to local provider is not set at + * node-level, but is set at resource-level, + * use it. + */ + strlcpy(curres->hr_localpath, depth1_localpath, + sizeof(curres->hr_localpath)); + } + if (curres->hr_metaflush == -1 && depth1_metaflush != -1) { + /* + * Metaflush is not set at node-level, + * but is set at resource-level, use it. + */ + curres->hr_metaflush = depth1_metaflush; + } + + /* + * If provider name is not given, use resource name + * as provider name. + */ + if (curres->hr_provname[0] == '\0') { + strlcpy(curres->hr_provname, curres->hr_name, + sizeof(curres->hr_provname)); + } + + /* + * Remote address has to be configured at this point. + */ + if (curres->hr_remoteaddr[0] == '\0') { + pjdlog_error("Remote address not configured for resource %s.", + curres->hr_name); + return (1); + } + /* + * Path to local provider has to be configured at this + * point. + */ + if (curres->hr_localpath[0] == '\0') { + pjdlog_error("Path to local component not configured for resource %s.", + curres->hr_name); + return (1); + } + + /* Put it onto resource list. */ + TAILQ_INSERT_TAIL(&lconfig->hc_resources, curres, hr_next); + curres = NULL; + } + } + ; + +resource_start: STR + { + /* Check if there is no duplicate entry. */ + TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) { + if (strcmp(curres->hr_name, $1) == 0) { + pjdlog_error("Resource %s configured more than once.", + curres->hr_name); + free($1); + return (1); + } + } + + /* + * Clear those, so we can tell if they were set at + * resource-level or not. + */ + depth1_provname[0] = '\0'; + depth1_localpath[0] = '\0'; + depth1_metaflush = -1; + hadmynode = false; + + curres = calloc(1, sizeof(*curres)); + if (curres == NULL) { + pjdlog_error("Unable to allocate memory for resource."); + free($1); + return (1); + } + if (strlcpy(curres->hr_name, $1, + sizeof(curres->hr_name)) >= + sizeof(curres->hr_name)) { + pjdlog_error("Resource name is too long."); + free(curres); + free($1); + return (1); + } + free($1); + curres->hr_role = HAST_ROLE_INIT; + curres->hr_previous_role = HAST_ROLE_INIT; + curres->hr_replication = -1; + curres->hr_checksum = -1; + curres->hr_compression = -1; + curres->hr_timeout = -1; + curres->hr_exec[0] = '\0'; + curres->hr_provname[0] = '\0'; + curres->hr_localpath[0] = '\0'; + curres->hr_localfd = -1; + curres->hr_localflush = true; + curres->hr_metaflush = -1; + curres->hr_remoteaddr[0] = '\0'; + curres->hr_sourceaddr[0] = '\0'; + curres->hr_ggateunit = -1; + } + ; + +resource_entries: | + resource_entries resource_entry + ; + +resource_entry: replication_statement | checksum_statement @@ -415,592 +566,447 @@ statement: | metaflush_statement | - node_statement + name_statement | - resource_statement + local_statement + | + resource_node_statement ; -control_statement: CONTROL STR +name_statement: NAME STR { switch (depth) { - case 0: - if (strlcpy(depth0_control, $2, - sizeof(depth0_control)) >= - sizeof(depth0_control)) { - pjdlog_error("control argument is too long."); + case 1: + if (strlcpy(depth1_provname, $2, + sizeof(depth1_provname)) >= + sizeof(depth1_provname)) { + pjdlog_error("name argument is too long."); free($2); return (1); } break; - case 1: + case 2: if (!mynode) break; - if (strlcpy(lconfig->hc_controladdr, $2, - sizeof(lconfig->hc_controladdr)) >= - sizeof(lconfig->hc_controladdr)) { - pjdlog_error("control argument is too long."); + PJDLOG_ASSERT(curres != NULL); + if (strlcpy(curres->hr_provname, $2, + sizeof(curres->hr_provname)) >= + sizeof(curres->hr_provname)) { + pjdlog_error("name argument is too long."); free($2); return (1); } break; default: - PJDLOG_ABORT("control at wrong depth level"); + PJDLOG_ABORT("name at wrong depth level"); } free($2); } ; -pidfile_statement: PIDFILE STR +local_statement: LOCAL STR { switch (depth) { - case 0: - if (strlcpy(depth0_pidfile, $2, - sizeof(depth0_pidfile)) >= - sizeof(depth0_pidfile)) { - pjdlog_error("pidfile argument is too long."); + case 1: + if (strlcpy(depth1_localpath, $2, + sizeof(depth1_localpath)) >= + sizeof(depth1_localpath)) { + pjdlog_error("local argument is too long."); free($2); return (1); } break; - case 1: + case 2: if (!mynode) break; - if (strlcpy(lconfig->hc_pidfile, $2, - sizeof(lconfig->hc_pidfile)) >= - sizeof(lconfig->hc_pidfile)) { - pjdlog_error("pidfile argument is too long."); + PJDLOG_ASSERT(curres != NULL); + if (strlcpy(curres->hr_localpath, $2, + sizeof(curres->hr_localpath)) >= + sizeof(curres->hr_localpath)) { + pjdlog_error("local argument is too long."); free($2); return (1); } break; default: - PJDLOG_ABORT("pidfile at wrong depth level"); + PJDLOG_ABORT("local at wrong depth level"); } free($2); } ; -listen_statement: LISTEN STR +resource_node_statement:ON resource_node_start OB resource_node_entries CB { - struct hastd_listen *lst; - - lst = calloc(1, sizeof(*lst)); - if (lst == NULL) { - pjdlog_error("Unable to allocate memory for listen address."); - free($2); - return (1); - } - if (strlcpy(lst->hl_addr, $2, sizeof(lst->hl_addr)) >= - sizeof(lst->hl_addr)) { - pjdlog_error("listen argument is too long."); - free($2); - free(lst); - return (1); - } - switch (depth) { - case 0: - TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next); - break; - case 1: - if (mynode) - TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next); - else - free(lst); - break; - default: - PJDLOG_ABORT("listen at wrong depth level"); - } - free($2); + mynode = false; } ; -replication_statement: REPLICATION replication_type +resource_node_start: STR { - switch (depth) { - case 0: - depth0_replication = $2; - break; - case 1: - PJDLOG_ASSERT(curres != NULL); - curres->hr_replication = $2; - break; - default: - PJDLOG_ABORT("replication at wrong depth level"); + if (curres != NULL) { + switch (isitme($1)) { + case -1: + free($1); + return (1); + case 0: + break; + case 1: + mynode = hadmynode = true; + break; + default: + PJDLOG_ABORT("invalid isitme() return value"); + } } + free($1); } ; -replication_type: - FULLSYNC { $$ = HAST_REPLICATION_FULLSYNC; } - | - MEMSYNC { $$ = HAST_REPLICATION_MEMSYNC; } +resource_node_entries: | - ASYNC { $$ = HAST_REPLICATION_ASYNC; } - ; - -checksum_statement: CHECKSUM checksum_type - { - switch (depth) { - case 0: - depth0_checksum = $2; - break; - case 1: - PJDLOG_ASSERT(curres != NULL); - curres->hr_checksum = $2; - break; - default: - PJDLOG_ABORT("checksum at wrong depth level"); - } - } + resource_node_entries resource_node_entry ; -checksum_type: - NONE { $$ = HAST_CHECKSUM_NONE; } +resource_node_entry: + name_statement | - CRC32 { $$ = HAST_CHECKSUM_CRC32; } + local_statement | - SHA256 { $$ = HAST_CHECKSUM_SHA256; } + remote_statement + | + source_statement + | + metaflush_statement ; -compression_statement: COMPRESSION compression_type +remote_statement: REMOTE remote_str { - switch (depth) { - case 0: - depth0_compression = $2; - break; - case 1: + PJDLOG_ASSERT(depth == 2); + if (mynode) { PJDLOG_ASSERT(curres != NULL); - curres->hr_compression = $2; - break; - default: - PJDLOG_ABORT("compression at wrong depth level"); + if (strlcpy(curres->hr_remoteaddr, $2, + sizeof(curres->hr_remoteaddr)) >= + sizeof(curres->hr_remoteaddr)) { + pjdlog_error("remote argument is too long."); + free($2); + return (1); + } } + free($2); } ; -compression_type: - NONE { $$ = HAST_COMPRESSION_NONE; } - | - HOLE { $$ = HAST_COMPRESSION_HOLE; } +remote_str: + NONE { $$ = strdup("none"); } | - LZF { $$ = HAST_COMPRESSION_LZF; } - ; - -timeout_statement: TIMEOUT NUM - { - if ($2 <= 0) { - pjdlog_error("Negative or zero timeout."); - return (1); - } - switch (depth) { - case 0: - depth0_timeout = $2; - break; - case 1: - PJDLOG_ASSERT(curres != NULL); - curres->hr_timeout = $2; - break; - default: - PJDLOG_ABORT("timeout at wrong depth level"); - } - } + STR { } ; -exec_statement: EXEC STR +source_statement: SOURCE STR { - switch (depth) { - case 0: - if (strlcpy(depth0_exec, $2, sizeof(depth0_exec)) >= - sizeof(depth0_exec)) { - pjdlog_error("Exec path is too long."); - free($2); - return (1); - } - break; - case 1: + PJDLOG_ASSERT(depth == 2); + if (mynode) { PJDLOG_ASSERT(curres != NULL); - if (strlcpy(curres->hr_exec, $2, - sizeof(curres->hr_exec)) >= - sizeof(curres->hr_exec)) { - pjdlog_error("Exec path is too long."); + if (strlcpy(curres->hr_sourceaddr, $2, + sizeof(curres->hr_sourceaddr)) >= + sizeof(curres->hr_sourceaddr)) { + pjdlog_error("source argument is too long."); free($2); return (1); } - break; - default: - PJDLOG_ABORT("exec at wrong depth level"); } free($2); } ; -metaflush_statement: METAFLUSH boolean - { - switch (depth) { - case 0: - depth0_metaflush = $2; - break; - case 1: - PJDLOG_ASSERT(curres != NULL); - depth1_metaflush = $2; - break; - case 2: - if (!mynode) - break; - PJDLOG_ASSERT(curres != NULL); - curres->hr_metaflush = $2; - break; - default: - PJDLOG_ABORT("metaflush at wrong depth level"); - } - } - ; +%% -boolean: - ON { $$ = 1; } - | - OFF { $$ = 0; } - ; +static int +isitme(const char *name) +{ + char buf[MAXHOSTNAMELEN]; + char *pos; + size_t bufsize; -node_statement: ON node_start OB node_entries CB - { - mynode = false; + /* + * First check if the given name matches our full hostname. + */ + if (gethostname(buf, sizeof(buf)) < 0) { + pjdlog_errno(LOG_ERR, "gethostname() failed"); + return (-1); } - ; + if (strcmp(buf, name) == 0) + return (1); -node_start: STR - { - switch (isitme($1)) { - case -1: - free($1); - return (1); - case 0: - break; - case 1: - mynode = true; - break; - default: - PJDLOG_ABORT("invalid isitme() return value"); - } - free($1); + /* + * Now check if it matches first part of the host name. + */ + pos = strchr(buf, '.'); + if (pos != NULL && (size_t)(pos - buf) == strlen(name) && + strncmp(buf, name, pos - buf) == 0) { + return (1); } - ; - -node_entries: - | - node_entries node_entry - ; -node_entry: - control_statement - | - pidfile_statement - | - listen_statement - ; + /* + * At the end check if name is equal to our host's UUID. + */ + bufsize = sizeof(buf); + if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) { + pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed"); + return (-1); + } + if (strcasecmp(buf, name) == 0) + return (1); -resource_statement: RESOURCE resource_start OB resource_entries CB - { - if (curres != NULL) { - /* - * There must be section for this node, at least with - * remote address configuration. - */ - if (!hadmynode) { - char *names; - - if (node_names(&names) != 0) - return (1); - pjdlog_error("No resource %s configuration for this node (acceptable node names: %s).", - curres->hr_name, names); - return (1); - } + /* + * Looks like this isn't about us. + */ + return (0); +} - /* - * Let's see if there are some resource-level settings - * that we can use for node-level settings. - */ - if (curres->hr_provname[0] == '\0' && - depth1_provname[0] != '\0') { - /* - * Provider name is not set at node-level, - * but is set at resource-level, use it. - */ - strlcpy(curres->hr_provname, depth1_provname, - sizeof(curres->hr_provname)); - } - if (curres->hr_localpath[0] == '\0' && - depth1_localpath[0] != '\0') { - /* - * Path to local provider is not set at - * node-level, but is set at resource-level, - * use it. - */ - strlcpy(curres->hr_localpath, depth1_localpath, - sizeof(curres->hr_localpath)); - } - if (curres->hr_metaflush == -1 && depth1_metaflush != -1) { - /* - * Metaflush is not set at node-level, - * but is set at resource-level, use it. - */ - curres->hr_metaflush = depth1_metaflush; - } +static bool +family_supported(int family) +{ + int sock; - /* - * If provider name is not given, use resource name - * as provider name. - */ - if (curres->hr_provname[0] == '\0') { - strlcpy(curres->hr_provname, curres->hr_name, - sizeof(curres->hr_provname)); - } + sock = socket(family, SOCK_STREAM, 0); + if (sock == -1 && errno == EPROTONOSUPPORT) + return (false); + if (sock >= 0) + (void)close(sock); + return (true); +} - /* - * Remote address has to be configured at this point. - */ - if (curres->hr_remoteaddr[0] == '\0') { - pjdlog_error("Remote address not configured for resource %s.", - curres->hr_name); - return (1); - } - /* - * Path to local provider has to be configured at this - * point. - */ - if (curres->hr_localpath[0] == '\0') { - pjdlog_error("Path to local component not configured for resource %s.", - curres->hr_name); - return (1); - } +static int +node_names(char **namesp) +{ + static char names[MAXHOSTNAMELEN * 3]; + char buf[MAXHOSTNAMELEN]; + char *pos; + size_t bufsize; - /* Put it onto resource list. */ - TAILQ_INSERT_TAIL(&lconfig->hc_resources, curres, hr_next); - curres = NULL; - } + if (gethostname(buf, sizeof(buf)) < 0) { + pjdlog_errno(LOG_ERR, "gethostname() failed"); + return (-1); } - ; -resource_start: STR - { - /* Check if there is no duplicate entry. */ - TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) { - if (strcmp(curres->hr_name, $1) == 0) { - pjdlog_error("Resource %s configured more than once.", - curres->hr_name); - free($1); - return (1); - } - } + /* First component of the host name. */ + pos = strchr(buf, '.'); + if (pos != NULL && pos != buf) { + (void)strlcpy(names, buf, MIN((size_t)(pos - buf + 1), + sizeof(names))); + (void)strlcat(names, ", ", sizeof(names)); + } - /* - * Clear those, so we can tell if they were set at - * resource-level or not. - */ - depth1_provname[0] = '\0'; - depth1_localpath[0] = '\0'; - depth1_metaflush = -1; - hadmynode = false; + /* Full host name. */ + (void)strlcat(names, buf, sizeof(names)); + (void)strlcat(names, ", ", sizeof(names)); - curres = calloc(1, sizeof(*curres)); - if (curres == NULL) { - pjdlog_error("Unable to allocate memory for resource."); - free($1); - return (1); - } - if (strlcpy(curres->hr_name, $1, - sizeof(curres->hr_name)) >= - sizeof(curres->hr_name)) { - pjdlog_error("Resource name is too long."); - free(curres); - free($1); - return (1); - } - free($1); - curres->hr_role = HAST_ROLE_INIT; - curres->hr_previous_role = HAST_ROLE_INIT; - curres->hr_replication = -1; - curres->hr_checksum = -1; - curres->hr_compression = -1; - curres->hr_timeout = -1; - curres->hr_exec[0] = '\0'; - curres->hr_provname[0] = '\0'; - curres->hr_localpath[0] = '\0'; - curres->hr_localfd = -1; - curres->hr_localflush = true; - curres->hr_metaflush = -1; - curres->hr_remoteaddr[0] = '\0'; - curres->hr_sourceaddr[0] = '\0'; - curres->hr_ggateunit = -1; + /* Host UUID. */ + bufsize = sizeof(buf); + if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) { + pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed"); + return (-1); } - ; + (void)strlcat(names, buf, sizeof(names)); -resource_entries: - | - resource_entries resource_entry - ; + *namesp = names; -resource_entry: - replication_statement - | - checksum_statement - | - compression_statement - | - timeout_statement - | - exec_statement - | - metaflush_statement - | - name_statement - | - local_statement - | - resource_node_statement - ; + return (0); +} -name_statement: NAME STR - { - switch (depth) { - case 1: - if (strlcpy(depth1_provname, $2, - sizeof(depth1_provname)) >= - sizeof(depth1_provname)) { - pjdlog_error("name argument is too long."); - free($2); - return (1); - } - break; - case 2: - if (!mynode) - break; - PJDLOG_ASSERT(curres != NULL); - if (strlcpy(curres->hr_provname, $2, - sizeof(curres->hr_provname)) >= - sizeof(curres->hr_provname)) { - pjdlog_error("name argument is too long."); - free($2); - return (1); - } - break; - default: - PJDLOG_ABORT("name at wrong depth level"); - } - free($2); +void +yyerror(const char *str) +{ + + pjdlog_error("Unable to parse configuration file at line %d near '%s': %s", + lineno, yytext, str); +} + +struct hastd_config * +yy_config_parse(const char *config, bool exitonerror) +{ + int ret; + + curres = NULL; + mynode = false; + depth = 0; + lineno = 0; + + depth0_timeout = HAST_TIMEOUT; + depth0_replication = HAST_REPLICATION_FULLSYNC; + depth0_checksum = HAST_CHECKSUM_NONE; + depth0_compression = HAST_COMPRESSION_HOLE; + strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control)); + strlcpy(depth0_pidfile, HASTD_PIDFILE, sizeof(depth0_pidfile)); + TAILQ_INIT(&depth0_listen); + strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4, + sizeof(depth0_listen_tcp4)); + strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6, + sizeof(depth0_listen_tcp6)); + depth0_exec[0] = '\0'; + depth0_metaflush = 1; + + lconfig = calloc(1, sizeof(*lconfig)); + if (lconfig == NULL) { + pjdlog_error("Unable to allocate memory for configuration."); + if (exitonerror) + exit(EX_TEMPFAIL); + return (NULL); } - ; -local_statement: LOCAL STR - { - switch (depth) { - case 1: - if (strlcpy(depth1_localpath, $2, - sizeof(depth1_localpath)) >= - sizeof(depth1_localpath)) { - pjdlog_error("local argument is too long."); - free($2); - return (1); - } - break; - case 2: - if (!mynode) - break; - PJDLOG_ASSERT(curres != NULL); - if (strlcpy(curres->hr_localpath, $2, - sizeof(curres->hr_localpath)) >= - sizeof(curres->hr_localpath)) { - pjdlog_error("local argument is too long."); - free($2); - return (1); - } - break; - default: - PJDLOG_ABORT("local at wrong depth level"); - } - free($2); + TAILQ_INIT(&lconfig->hc_listen); + TAILQ_INIT(&lconfig->hc_resources); + + yyin = fopen(config, "r"); + if (yyin == NULL) { + pjdlog_errno(LOG_ERR, "Unable to open configuration file %s", + config); + yy_config_free(lconfig); + if (exitonerror) + exit(EX_OSFILE); + return (NULL); + } + yyrestart(yyin); + ret = yyparse(); + fclose(yyin); + if (ret != 0) { + yy_config_free(lconfig); + if (exitonerror) + exit(EX_CONFIG); + return (NULL); } - ; -resource_node_statement:ON resource_node_start OB resource_node_entries CB - { - mynode = false; + /* + * Let's see if everything is set up. + */ + if (lconfig->hc_controladdr[0] == '\0') { + strlcpy(lconfig->hc_controladdr, depth0_control, + sizeof(lconfig->hc_controladdr)); } - ; + if (lconfig->hc_pidfile[0] == '\0') { + strlcpy(lconfig->hc_pidfile, depth0_pidfile, + sizeof(lconfig->hc_pidfile)); + } + if (!TAILQ_EMPTY(&depth0_listen)) + TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next); + if (TAILQ_EMPTY(&lconfig->hc_listen)) { + struct hastd_listen *lst; -resource_node_start: STR - { - if (curres != NULL) { - switch (isitme($1)) { - case -1: - free($1); - return (1); - case 0: - break; - case 1: - mynode = hadmynode = true; - break; - default: - PJDLOG_ABORT("invalid isitme() return value"); + if (family_supported(AF_INET)) { + lst = calloc(1, sizeof(*lst)); + if (lst == NULL) { + pjdlog_error("Unable to allocate memory for listen address."); + yy_config_free(lconfig); + if (exitonerror) + exit(EX_TEMPFAIL); + return (NULL); } + (void)strlcpy(lst->hl_addr, depth0_listen_tcp4, + sizeof(lst->hl_addr)); + TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next); + } else { + pjdlog_debug(1, + "No IPv4 support in the kernel, not listening on IPv4 address."); + } + if (family_supported(AF_INET6)) { + lst = calloc(1, sizeof(*lst)); + if (lst == NULL) { + pjdlog_error("Unable to allocate memory for listen address."); + yy_config_free(lconfig); + if (exitonerror) + exit(EX_TEMPFAIL); + return (NULL); + } + (void)strlcpy(lst->hl_addr, depth0_listen_tcp6, + sizeof(lst->hl_addr)); + TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next); + } else { + pjdlog_debug(1, + "No IPv6 support in the kernel, not listening on IPv6 address."); + } + if (TAILQ_EMPTY(&lconfig->hc_listen)) { + pjdlog_error("No address to listen on."); + yy_config_free(lconfig); + if (exitonerror) + exit(EX_TEMPFAIL); + return (NULL); } - free($1); } - ; - -resource_node_entries: - | - resource_node_entries resource_node_entry - ; - -resource_node_entry: - name_statement - | - local_statement - | - remote_statement - | - source_statement - | - metaflush_statement - ; + TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) { + PJDLOG_ASSERT(curres->hr_provname[0] != '\0'); + PJDLOG_ASSERT(curres->hr_localpath[0] != '\0'); + PJDLOG_ASSERT(curres->hr_remoteaddr[0] != '\0'); -remote_statement: REMOTE remote_str - { - PJDLOG_ASSERT(depth == 2); - if (mynode) { - PJDLOG_ASSERT(curres != NULL); - if (strlcpy(curres->hr_remoteaddr, $2, - sizeof(curres->hr_remoteaddr)) >= - sizeof(curres->hr_remoteaddr)) { - pjdlog_error("remote argument is too long."); - free($2); - return (1); - } + if (curres->hr_replication == -1) { + /* + * Replication is not set at resource-level. + * Use global or default setting. + */ + curres->hr_replication = depth0_replication; + } + if (curres->hr_replication == HAST_REPLICATION_MEMSYNC) { + pjdlog_warning("Replication mode \"%s\" is not implemented, falling back to \"%s\".", + "memsync", "fullsync"); + curres->hr_replication = HAST_REPLICATION_FULLSYNC; + } + if (curres->hr_checksum == -1) { + /* + * Checksum is not set at resource-level. + * Use global or default setting. + */ + curres->hr_checksum = depth0_checksum; + } + if (curres->hr_compression == -1) { + /* + * Compression is not set at resource-level. + * Use global or default setting. + */ + curres->hr_compression = depth0_compression; + } + if (curres->hr_timeout == -1) { + /* + * Timeout is not set at resource-level. + * Use global or default setting. + */ + curres->hr_timeout = depth0_timeout; + } + if (curres->hr_exec[0] == '\0') { + /* + * Exec is not set at resource-level. + * Use global or default setting. + */ + strlcpy(curres->hr_exec, depth0_exec, + sizeof(curres->hr_exec)); + } + if (curres->hr_metaflush == -1) { + /* + * Metaflush is not set at resource-level. + * Use global or default setting. + */ + curres->hr_metaflush = depth0_metaflush; } - free($2); } - ; -remote_str: - NONE { $$ = strdup("none"); } - | - STR { } - ; + return (lconfig); +} -source_statement: SOURCE STR - { - PJDLOG_ASSERT(depth == 2); - if (mynode) { - PJDLOG_ASSERT(curres != NULL); - if (strlcpy(curres->hr_sourceaddr, $2, - sizeof(curres->hr_sourceaddr)) >= - sizeof(curres->hr_sourceaddr)) { - pjdlog_error("source argument is too long."); - free($2); - return (1); - } - } - free($2); +void +yy_config_free(struct hastd_config *config) +{ + struct hastd_listen *lst; + struct hast_resource *res; + + while ((lst = TAILQ_FIRST(&depth0_listen)) != NULL) { + TAILQ_REMOVE(&depth0_listen, lst, hl_next); + free(lst); } - ; + while ((lst = TAILQ_FIRST(&config->hc_listen)) != NULL) { + TAILQ_REMOVE(&config->hc_listen, lst, hl_next); + free(lst); + } + while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) { + TAILQ_REMOVE(&config->hc_resources, res, hr_next); + free(res); + } + free(config); +} diff --git a/usr.bin/ar/acpyacc.y b/usr.bin/ar/acpyacc.y index 99a23c7..5d15e8d 100644 --- a/usr.bin/ar/acpyacc.y +++ b/usr.bin/ar/acpyacc.y @@ -54,7 +54,6 @@ struct list { extern int yylex(void); -extern int yyparse(void); static void yyerror(const char *); static void arscp_addlib(char *archive, struct list *list); diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y index 55df7b3..f7425f2 100644 --- a/usr.bin/bc/bc.y +++ b/usr.bin/bc/bc.y @@ -69,7 +69,6 @@ struct tree { ssize_t index; }; -int yyparse(void); int yywrap(void); int fileindex; diff --git a/usr.bin/find/getdate.y b/usr.bin/find/getdate.y index 81a9c47..16ffb6e 100644 --- a/usr.bin/find/getdate.y +++ b/usr.bin/find/getdate.y @@ -60,11 +60,9 @@ __FBSDID("$FreeBSD$"); #include -#define yyparse getdate_yyparse #define yylex getdate_yylex #define yyerror getdate_yyerror -static int yyparse(void); static int yylex(void); static int yyerror(const char *); diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y index 21243bb..1495973 100644 --- a/usr.bin/m4/parser.y +++ b/usr.bin/m4/parser.y @@ -23,7 +23,6 @@ extern int32_t end_result; extern int yylex(void); extern int yyerror(const char *); -extern int yyparse(void); %} %token NUMBER %token ERROR diff --git a/usr.bin/mkcsmapper/ldef.h b/usr.bin/mkcsmapper/ldef.h index d0adf9a..70c3122 100644 --- a/usr.bin/mkcsmapper/ldef.h +++ b/usr.bin/mkcsmapper/ldef.h @@ -39,4 +39,3 @@ extern int debug; extern int line_number; extern int yyerror(const char *); extern int yylex(void); -extern int yyparse(void); diff --git a/usr.bin/mklocale/extern.h b/usr.bin/mklocale/extern.h index c5b7080..60268cc 100644 --- a/usr.bin/mklocale/extern.h +++ b/usr.bin/mklocale/extern.h @@ -33,4 +33,3 @@ */ int yylex(void); -int yyparse(void); diff --git a/usr.sbin/bluetooth/bthidd/parser.y b/usr.sbin/bluetooth/bthidd/parser.y index ca49059..50468f4 100644 --- a/usr.sbin/bluetooth/bthidd/parser.y +++ b/usr.sbin/bluetooth/bthidd/parser.y @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +62,6 @@ #include "bthid_config.h" - int yyparse (void); int yylex (void); void yyerror (char const *); static int32_t check_hid_device(hid_device_p hid_device); diff --git a/usr.sbin/bluetooth/hcsecd/parser.y b/usr.sbin/bluetooth/hcsecd/parser.y index 385bff2..ec91c48 100644 --- a/usr.sbin/bluetooth/hcsecd/parser.y +++ b/usr.sbin/bluetooth/hcsecd/parser.y @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index 6d66167..f275749 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -171,7 +171,6 @@ char *path(const char *); char *raisestr(char *); void remember(const char *); void moveifchanged(const char *, const char *); -int yyparse(void); int yylex(void); void options(void); void makefile(void); diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 28d4f8a..14061c2 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -91,6 +91,7 @@ static void usage(void); static void cleanheaders(char *); static void kernconfdump(const char *); static void checkversion(void); +extern int yyparse(void); struct hdr_list { char *h_name; diff --git a/usr.sbin/fifolog/lib/getdate.y b/usr.sbin/fifolog/lib/getdate.y index 8e63e81..53a515c 100644 --- a/usr.sbin/fifolog/lib/getdate.y +++ b/usr.sbin/fifolog/lib/getdate.y @@ -24,11 +24,9 @@ #include "libfifolog.h" -#define yyparse getdate_yyparse #define yylex getdate_yylex #define yyerror getdate_yyerror -static int yyparse(void); static int yylex(void); static int yyerror(const char *); diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c index 16f5095..7a7917d 100644 --- a/usr.sbin/jail/config.c +++ b/usr.sbin/jail/config.c @@ -52,6 +52,8 @@ struct ipspec { extern FILE *yyin; extern int yynerrs; +extern int yyparse(void); + struct cfjails cfjails = TAILQ_HEAD_INITIALIZER(cfjails); static void free_param(struct cfparams *pp, struct cfparam *p); diff --git a/usr.sbin/jail/jailp.h b/usr.sbin/jail/jailp.h index 4bf7929..31a2aba 100644 --- a/usr.sbin/jail/jailp.h +++ b/usr.sbin/jail/jailp.h @@ -222,7 +222,6 @@ extern void requeue(struct cfjail *j, struct cfjails *queue); extern void yyerror(const char *); extern int yylex(void); -extern int yyparse(void); extern struct cfjails cfjails; extern struct cfjails ready; -- cgit v1.1