ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
(Generate patch)

Comparing ircd-hybrid/trunk/src/conf_parser.y (file contents):
Revision 7105 by michael, Sat Jan 23 20:11:27 2016 UTC vs.
Revision 7282 by michael, Sun Feb 7 18:04:26 2016 UTC

# Line 27 | Line 27
27  
28   %{
29  
30 #include <sys/types.h>
31 #include <string.h>
32
30   #include "config.h"
31   #include "stdinc.h"
32   #include "ircd.h"
33   #include "list.h"
34   #include "conf.h"
35   #include "conf_class.h"
36 + #include "conf_cluster.h"
37   #include "conf_pseudo.h"
38 + #include "conf_resv.h"
39 + #include "conf_service.h"
40 + #include "conf_shared.h"
41   #include "event.h"
42   #include "id.h"
43   #include "log.h"
43 #include "client.h"     /* for UMODE_SERVNOTICE only */
44   #include "irc_string.h"
45   #include "memory.h"
46   #include "modules.h"
47   #include "server.h"
48   #include "hostmask.h"
49 #include "send.h"
49   #include "listener.h"
51 #include "resv.h"
52 #include "numeric.h"
50   #include "user.h"
51   #include "motd.h"
52  
# Line 158 | Line 155 | reset_block_state(void)
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
157   %token  CHANNEL
158 + %token  CHECK_CACHE
159   %token  CIDR_BITLEN_IPV4
160   %token  CIDR_BITLEN_IPV6
161   %token  CLASS
# Line 219 | Line 217 | reset_block_state(void)
217   %token  KNOCK_CLIENT_TIME
218   %token  KNOCK_DELAY_CHANNEL
219   %token  LEAF_MASK
220 + %token  LIBGEOIP_DATABASE_OPTIONS
221 + %token  LIBGEOIP_IPV4_DATABASE_FILE
222 + %token  LIBGEOIP_IPV6_DATABASE_FILE
223   %token  LISTEN
224   %token  MASK
225   %token  MAX_ACCEPT
# Line 235 | Line 236 | reset_block_state(void)
236   %token  MAX_TARGETS
237   %token  MAX_TOPIC_LENGTH
238   %token  MAX_WATCH
239 + %token  MEMORY_CACHE
240   %token  MIN_IDLE
241   %token  MIN_NONWILDCARD
242   %token  MIN_NONWILDCARD_SIMPLE
243 + %token  MMAP_CACHE
244   %token  MODULE
245   %token  MODULES
246   %token  MOTD
# Line 289 | Line 292 | reset_block_state(void)
292   %token  SSL_DH_ELLIPTIC_CURVE
293   %token  SSL_DH_PARAM_FILE
294   %token  SSL_MESSAGE_DIGEST_ALGORITHM
295 + %token  STANDARD
296   %token  STATS_E_DISABLED
297   %token  STATS_I_OPER_ONLY
298   %token  STATS_K_OPER_ONLY
# Line 465 | Line 469 | serverinfo_item:        serverinfo_name
469                          serverinfo_ssl_certificate_file |
470                          serverinfo_ssl_cipher_list |
471                          serverinfo_ssl_message_digest_algorithm |
472 +                        serverinfo_libgeoip_database_options |
473 +                        serverinfo_libgeoip_ipv4_database_file |
474 +                        serverinfo_libgeoip_ipv6_database_file |
475                          error ';' ;
476  
477  
# Line 472 | Line 479 | serverinfo_ssl_certificate_file: SSL_CER
479   {
480    if (conf_parser_ctx.pass == 2)
481    {
482 <    if (!ConfigServerInfo.rsa_private_key_file)
476 <    {
477 <      conf_error_report("No rsa_private_key_file specified, SSL disabled");
478 <      break;
479 <    }
480 <
481 <    if (ConfigServerInfo.ssl_certificate_file)
482 <      xfree(ConfigServerInfo.ssl_certificate_file);
483 <
482 >    xfree(ConfigServerInfo.ssl_certificate_file);
483      ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
484    }
485   };
486  
487   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
488   {
489 <  if (conf_parser_ctx.pass != 1)
490 <    break;
491 <
492 <  xfree(ConfigServerInfo.rsa_private_key_file);
493 <  ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
489 >  if (conf_parser_ctx.pass == 2)
490 >  {
491 >    xfree(ConfigServerInfo.rsa_private_key_file);
492 >    ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
493 >  }
494   };
495  
496   serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
# Line 530 | Line 529 | serverinfo_ssl_dh_elliptic_curve: SSL_DH
529    }
530   };
531  
532 + serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS
533 + {
534 +  if (conf_parser_ctx.pass == 1)
535 +    ConfigServerInfo.libgeoip_database_options = 0;
536 + } '='  options_items ';';
537 +
538 + options_items: options_items ',' options_item | options_item;
539 + options_item: STANDARD
540 + {
541 + #ifdef HAVE_LIBGEOIP
542 +  if (conf_parser_ctx.pass == 1)
543 +    ConfigServerInfo.libgeoip_database_options |= GEOIP_STANDARD;
544 + #endif
545 + } | MEMORY_CACHE
546 + {
547 + #ifdef HAVE_LIBGEOIP
548 +  if (conf_parser_ctx.pass == 1)
549 +    ConfigServerInfo.libgeoip_database_options |= GEOIP_MEMORY_CACHE;
550 + #endif
551 + } | MMAP_CACHE
552 + {
553 + #ifdef HAVE_LIBGEOIP
554 +  if (conf_parser_ctx.pass == 1)
555 +    ConfigServerInfo.libgeoip_database_options |= GEOIP_MMAP_CACHE;
556 + #endif
557 + } | CHECK_CACHE
558 + {
559 + #ifdef HAVE_LIBGEOIP
560 +  if (conf_parser_ctx.pass == 1)
561 +    ConfigServerInfo.libgeoip_database_options |= GEOIP_CHECK_CACHE;
562 + #endif
563 + };
564 +
565 + serverinfo_libgeoip_ipv4_database_file:  LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';'
566 + {
567 +  if (conf_parser_ctx.pass == 2)
568 +  {
569 +    xfree(ConfigServerInfo.libgeoip_ipv4_database_file);
570 +    ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string);
571 +
572 + #ifdef HAVE_LIBGEOIP
573 +    if (GeoIPv4_ctx)
574 +      GeoIP_delete(GeoIPv4_ctx);
575 +    GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
576 + #endif
577 +  }
578 + };
579 +
580 + serverinfo_libgeoip_ipv6_database_file:  LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';'
581 + {
582 +  if (conf_parser_ctx.pass == 2)
583 +  {
584 +    xfree(ConfigServerInfo.libgeoip_ipv6_database_file);
585 +    ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string);
586 +
587 + #ifdef HAVE_LIBGEOIP
588 +    if (GeoIPv6_ctx)
589 +      GeoIP_delete(GeoIPv6_ctx);
590 +    GeoIPv6_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
591 + #endif
592 +  }
593 + };
594 +
595   serverinfo_name: NAME '=' QSTRING ';'
596   {
597    /* This isn't rehashable */
# Line 1771 | Line 1833 | resv_entry: RESV
1833    if (conf_parser_ctx.pass != 2)
1834      break;
1835  
1836 <  create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1836 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1837   };
1838  
1839   resv_items:     resv_items resv_item | resv_item;
# Line 1811 | Line 1873 | service_name: NAME '=' QSTRING ';'
1873  
1874    if (valid_servname(yylval.string))
1875    {
1876 <    struct MaskItem *conf = conf_make(CONF_SERVICE);
1877 <    conf->name = xstrdup(yylval.string);
1876 >    struct ServiceItem *service = service_make();
1877 >    service->name = xstrdup(yylval.string);
1878    }
1879   };
1880  
# Line 1833 | Line 1895 | shared_entry: T_SHARED
1895    block_state.flags.value = SHARED_ALL;
1896   } '{' shared_items '}' ';'
1897   {
1836  struct MaskItem *conf = NULL;
1837
1898    if (conf_parser_ctx.pass != 2)
1899      break;
1900  
1901 <  conf = conf_make(CONF_SHARED);
1902 <  conf->flags = block_state.flags.value;
1903 <  conf->name = xstrdup(block_state.name.buf);
1904 <  conf->user = xstrdup(block_state.user.buf);
1905 <  conf->host = xstrdup(block_state.host.buf);
1901 >  struct SharedItem *shared = shared_make();
1902 >  shared->type = block_state.flags.value;
1903 >  shared->server = xstrdup(block_state.name.buf);
1904 >  shared->user = xstrdup(block_state.user.buf);
1905 >  shared->host = xstrdup(block_state.host.buf);
1906   };
1907  
1908   shared_items: shared_items shared_item | shared_item;
# Line 1934 | Line 1994 | cluster_entry: T_CLUSTER
1994    reset_block_state();
1995  
1996    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1997 <  block_state.flags.value = SHARED_ALL;
1997 >  block_state.flags.value = CLUSTER_ALL;
1998   } '{' cluster_items '}' ';'
1999   {
1940  struct MaskItem *conf = NULL;
1941
2000    if (conf_parser_ctx.pass != 2)
2001      break;
2002  
2003 <  conf = conf_make(CONF_CLUSTER);
2004 <  conf->flags = block_state.flags.value;
2005 <  conf->name = xstrdup(block_state.name.buf);
2003 >  struct ClusterItem *cluster = cluster_make();
2004 >  cluster->type = block_state.flags.value;
2005 >  cluster->server = xstrdup(block_state.name.buf);
2006   };
2007  
2008   cluster_items:  cluster_items cluster_item | cluster_item;
# Line 1966 | Line 2024 | cluster_types:  cluster_types ',' cluste
2024   cluster_type_item: KLINE
2025   {
2026    if (conf_parser_ctx.pass == 2)
2027 <    block_state.flags.value |= SHARED_KLINE;
2027 >    block_state.flags.value |= CLUSTER_KLINE;
2028   } | UNKLINE
2029   {
2030    if (conf_parser_ctx.pass == 2)
2031 <    block_state.flags.value |= SHARED_UNKLINE;
2031 >    block_state.flags.value |= CLUSTER_UNKLINE;
2032   } | T_DLINE
2033   {
2034    if (conf_parser_ctx.pass == 2)
2035 <    block_state.flags.value |= SHARED_DLINE;
2035 >    block_state.flags.value |= CLUSTER_DLINE;
2036   } | T_UNDLINE
2037   {
2038    if (conf_parser_ctx.pass == 2)
2039 <    block_state.flags.value |= SHARED_UNDLINE;
2039 >    block_state.flags.value |= CLUSTER_UNDLINE;
2040   } | XLINE
2041   {
2042    if (conf_parser_ctx.pass == 2)
2043 <    block_state.flags.value |= SHARED_XLINE;
2043 >    block_state.flags.value |= CLUSTER_XLINE;
2044   } | T_UNXLINE
2045   {
2046    if (conf_parser_ctx.pass == 2)
2047 <    block_state.flags.value |= SHARED_UNXLINE;
2047 >    block_state.flags.value |= CLUSTER_UNXLINE;
2048   } | RESV
2049   {
2050    if (conf_parser_ctx.pass == 2)
2051 <    block_state.flags.value |= SHARED_RESV;
2051 >    block_state.flags.value |= CLUSTER_RESV;
2052   } | T_UNRESV
2053   {
2054    if (conf_parser_ctx.pass == 2)
2055 <    block_state.flags.value |= SHARED_UNRESV;
2055 >    block_state.flags.value |= CLUSTER_UNRESV;
2056   } | T_LOCOPS
2057   {
2058    if (conf_parser_ctx.pass == 2)
2059 <    block_state.flags.value |= SHARED_LOCOPS;
2059 >    block_state.flags.value |= CLUSTER_LOCOPS;
2060   } | T_ALL
2061   {
2062    if (conf_parser_ctx.pass == 2)
2063 <    block_state.flags.value = SHARED_ALL;
2063 >    block_state.flags.value = CLUSTER_ALL;
2064   };
2065  
2066  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)