annotate libfdcore/fdd.y @ 1554:566bb46cc73f

Updated copyright information
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 06 Oct 2020 21:34:53 +0800
parents 239ba25870d8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
740
4a9f08d6b6ba Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 706
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
1554
566bb46cc73f Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1397
diff changeset
5 * Copyright (c) 2019, WIDE Project and NICT *
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
36 /* Yacc configuration parser.
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37 *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 * This file defines the grammar of the configuration file.
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39 * Note that each extension has a separate independant configuration file.
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 *
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41 * Note : This module is NOT thread-safe. All processing must be done from one thread only.
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
42 */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
43
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
44 /* For development only : */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
45 %debug
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 %error-verbose
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 %parse-param {struct fd_config * conf}
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50 /* Keep track of location */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 %locations
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
52 %pure-parser
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54 %{
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 578
diff changeset
55 #include "fdcore-internal.h"
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 #include "fdd.tab.h" /* bug : bison does not define the YYLTYPE before including this bloc, so... */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
57
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58 /* The Lex parser prototype */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 int fddlex(YYSTYPE *lvalp, YYLTYPE *llocp);
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 /* Function to report error */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62 void yyerror (YYLTYPE *ploc, struct fd_config * conf, char const *s)
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
63 {
918
46f9982b7d26 Use logging routines for configuration file parsing (based on patch by Thomas)
Sebastien Decugis <sdecugis@freediameter.net>
parents: 808
diff changeset
64 if (ploc->first_line != ploc->last_line) {
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
65 TRACE_ERROR("%s:%d.%d-%d.%d : %s", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
918
46f9982b7d26 Use logging routines for configuration file parsing (based on patch by Thomas)
Sebastien Decugis <sdecugis@freediameter.net>
parents: 808
diff changeset
66 } else if (ploc->first_column != ploc->last_column) {
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
67 TRACE_ERROR("%s:%d.%d-%d : %s", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
918
46f9982b7d26 Use logging routines for configuration file parsing (based on patch by Thomas)
Sebastien Decugis <sdecugis@freediameter.net>
parents: 808
diff changeset
68 } else {
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
69 TRACE_ERROR("%s:%d.%d : %s", conf->cnf_file, ploc->first_line, ploc->first_column, s);
918
46f9982b7d26 Use logging routines for configuration file parsing (based on patch by Thomas)
Sebastien Decugis <sdecugis@freediameter.net>
parents: 808
diff changeset
70 }
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
71 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
72
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
73 int got_peer_noip = 0;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
74 int got_peer_noipv6 = 0;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
75 int got_peer_notcp = 0;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
76 int got_peer_nosctp = 0;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
77
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
78 struct peer_info fddpi;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
79
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
80 %}
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
81
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
82 /* Values returned by lex for token */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
83 %union {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
84 char *string; /* The string is allocated by strdup in lex.*/
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
85 int integer; /* Store integer values */
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
86 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
87
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
88 /* In case of error in the lexical analysis */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
89 %token LEX_ERROR
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
90
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
91 %token <string> QSTRING
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
92 %token <integer> INTEGER
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
93
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
94 %type <string> extconf
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
95
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
96 %token IDENTITY
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
97 %token REALM
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
98 %token PORT
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
99 %token SECPORT
1180
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
100 %token SEC3436
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
101 %token NOIP
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
102 %token NOIP6
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
103 %token NOTCP
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
104 %token NOSCTP
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
105 %token PREFERTCP
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
106 %token OLDTLS
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
107 %token NOTLS
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
108 %token SCTPSTREAMS
253
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
109 %token APPSERVTHREADS
1397
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
110 %token ROUTINGINTHREADS
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
111 %token ROUTINGOUTTHREADS
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
112 %token QINLIMIT
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
113 %token QOUTLIMIT
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
114 %token QLOCALLIMIT
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
115 %token LISTENON
1189
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
116 %token THRPERSRV
1396
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
117 %token PROCESSINGPEERSPATTERN
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
118 %token PROCESSINGPEERSMINIMUM
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
119 %token TCTIMER
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
120 %token TWTIMER
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
121 %token NORELAY
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
122 %token LOADEXT
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
123 %token CONNPEER
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
124 %token CONNTO
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
125 %token TLS_CRED
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
126 %token TLS_CA
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
127 %token TLS_CRL
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
128 %token TLS_PRIO
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
129 %token TLS_DH_BITS
578
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
130 %token TLS_DH_FILE
1326
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
131 %token RR_IN_ANSWERS
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
132 %token ALWAYS
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
133 %token NEVER
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
134
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
135
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
136 /* -------------------------------------- */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
137 %%
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
138
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
139 /* The grammar definition - Sections blocs. */
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
140 conffile: /* Empty is OK -- for simplicity here, we reject in daemon later */
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
141 | conffile identity
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
142 | conffile realm
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
143 | conffile tctimer
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
144 | conffile twtimer
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
145 | conffile port
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
146 | conffile secport
1180
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
147 | conffile sec3436
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
148 | conffile sctpstreams
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
149 | conffile listenon
1189
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
150 | conffile thrpersrv
1396
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
151 | conffile processingpeerspattern
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
152 | conffile processingpeersminimum
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
153 | conffile norelay
253
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
154 | conffile appservthreads
1397
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
155 | conffile routinginthreads
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
156 | conffile routingoutthreads
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
157 | conffile qinlimit
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
158 | conffile qoutlimit
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
159 | conffile qlocallimit
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
160 | conffile noip
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
161 | conffile noip6
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
162 | conffile notcp
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
163 | conffile nosctp
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
164 | conffile prefertcp
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
165 | conffile oldtls
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
166 | conffile loadext
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
167 | conffile connpeer
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
168 | conffile tls_cred
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
169 | conffile tls_ca
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
170 | conffile tls_crl
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
171 | conffile tls_prio
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
172 | conffile tls_dh
1326
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
173 | conffile rr_in_answers
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
174 | conffile errors
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
175 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
176 yyerror(&yylloc, conf, "An error occurred while parsing the configuration file");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
177 return EINVAL;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
178 }
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
179 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
180
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
181 /* Lexical or syntax error */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
182 errors: LEX_ERROR
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
183 | error
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
184 ;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
185
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
186 identity: IDENTITY '=' QSTRING ';'
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
187 {
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
188 conf->cnf_diamid = $3;
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
189 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
190 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
191
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
192 realm: REALM '=' QSTRING ';'
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
193 {
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
194 conf->cnf_diamrlm = $3;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
195 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
196 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
197
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
198 tctimer: TCTIMER '=' INTEGER ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
199 {
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
200 CHECK_PARAMS_DO( ($3 > 0),
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
201 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
202 conf->cnf_timer_tc = (unsigned int)$3;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
203 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
204 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
205
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
206 twtimer: TWTIMER '=' INTEGER ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
207 {
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
208 CHECK_PARAMS_DO( ($3 > 5),
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
209 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
210 conf->cnf_timer_tw = (unsigned int)$3;
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
211 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
212 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
213
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
214 port: PORT '=' INTEGER ';'
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
215 {
1012
cafdcbcb5e79 Allow port value 0 in the configuration to disable a server
Sebastien Decugis <sdecugis@freediameter.net>
parents: 974
diff changeset
216 CHECK_PARAMS_DO( ($3 >= 0) && ($3 < 1<<16),
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
217 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
218 conf->cnf_port = (uint16_t)$3;
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
219 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
220 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
221
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
222 secport: SECPORT '=' INTEGER ';'
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
223 {
1012
cafdcbcb5e79 Allow port value 0 in the configuration to disable a server
Sebastien Decugis <sdecugis@freediameter.net>
parents: 974
diff changeset
224 CHECK_PARAMS_DO( ($3 >= 0) && ($3 < 1<<16),
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
225 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
226 conf->cnf_port_tls = (uint16_t)$3;
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
227 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
228 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
229
1180
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
230 sec3436: SEC3436 '=' INTEGER ';'
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
231 {
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
232 CHECK_PARAMS_DO( ($3 >= 0) && ($3 < 1<<16),
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
233 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
234 conf->cnf_port_3436 = (uint16_t)$3;
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
235 }
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
236 ;
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
237
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
238 sctpstreams: SCTPSTREAMS '=' INTEGER ';'
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
239 {
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
240 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16),
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
241 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
242 conf->cnf_sctp_str = (uint16_t)$3;
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
243 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
244 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
245
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
246 listenon: LISTENON '=' QSTRING ';'
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
247 {
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
248 struct addrinfo hints, *ai;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
249 int ret;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
250
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
251 memset(&hints, 0, sizeof(hints));
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
252 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
253 ret = getaddrinfo($3, NULL, &hints, &ai);
23
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 22
diff changeset
254 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; }
24
bd83ce9328ed Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 23
diff changeset
255 CHECK_FCT_DO( fd_ep_add_merge( &conf->cnf_endpoints, ai->ai_addr, ai->ai_addrlen, EP_FL_CONF ), YYERROR );
23
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 22
diff changeset
256 freeaddrinfo(ai);
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
257 free($3);
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
258 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
259 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
260
1189
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
261 thrpersrv: THRPERSRV '=' INTEGER ';'
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
262 {
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
263 CHECK_PARAMS_DO( ($3 > 0),
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
264 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
265 conf->cnf_thr_srv = $3;
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
266 }
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
267 ;
50bf33dc8fe0 Limit number of incoming connections under processing to configurable value
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1180
diff changeset
268
1396
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
269 processingpeerspattern: PROCESSINGPEERSPATTERN '=' QSTRING ';'
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
270 {
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
271 char *pattern = $3;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
272 int err;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
273 CHECK_FCT_DO( err=regcomp(&conf->cnf_processing_peers_pattern_regex, pattern, REG_EXTENDED | REG_NOSUB),
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
274 {
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
275 char * buf;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
276 size_t bl;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
277
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
278 /* Error while compiling the regex */
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
279 TRACE_DEBUG(INFO, "error while compiling the regular expression '%s':", pattern);
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
280
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
281 /* Get the error message size */
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
282 bl = regerror(err, &conf->cnf_processing_peers_pattern_regex, NULL, 0);
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
283
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
284 /* Alloc the buffer for error message */
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
285 CHECK_MALLOC( buf = malloc(bl) );
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
286
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
287 /* Get the error message content */
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
288 regerror(err, &conf->cnf_processing_peers_pattern_regex, buf, bl);
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
289 TRACE_DEBUG(INFO, "\t%s", buf);
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
290
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
291 /* Free the buffer, return the error */
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
292 free(buf);
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
293
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
294 yyerror (&yylloc, conf, "Invalid regular expression in ProcessingPeersPattern");
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
295 YYERROR;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
296 } );
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
297 }
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
298 ;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
299
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
300 processingpeersminimum: PROCESSINGPEERSMINIMUM '=' INTEGER ';'
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
301 {
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
302 CHECK_PARAMS_DO( ($3 >= 0),
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
303 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
304 conf->cnf_processing_peers_minimum = $3;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
305 }
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
306 ;
188c82b6690b Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
Thomas Klausner <tk@giga.or.at>
parents: 1326
diff changeset
307
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
308 norelay: NORELAY ';'
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
309 {
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
310 conf->cnf_flags.no_fwd = 1;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
311 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
312 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
313
253
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
314 appservthreads: APPSERVTHREADS '=' INTEGER ';'
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
315 {
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
316 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 256),
253
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
317 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
318 conf->cnf_dispthr = (uint16_t)$3;
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
319 }
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
320 ;
ad6c0118fb50 Configurable number of server threads
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 142
diff changeset
321
1397
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
322 routinginthreads: ROUTINGINTHREADS '=' INTEGER ';'
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
323 {
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
324 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 256),
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
325 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
326 conf->cnf_rtinthr = (uint16_t)$3;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
327 }
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
328 ;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
329
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
330 routingoutthreads: ROUTINGOUTTHREADS '=' INTEGER ';'
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
331 {
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
332 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 256),
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
333 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
334 conf->cnf_rtoutthr = (uint16_t)$3;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
335 }
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
336 ;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
337
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
338 qinlimit: QINLIMIT '=' INTEGER ';'
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
339 {
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
340 CHECK_PARAMS_DO( ($3 >= 0),
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
341 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
342 conf->cnf_qin_limit = $3;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
343 }
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
344 ;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
345
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
346 qoutlimit: QOUTLIMIT '=' INTEGER ';'
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
347 {
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
348 CHECK_PARAMS_DO( ($3 >= 0),
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
349 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
350 conf->cnf_qout_limit = $3;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
351 }
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
352 ;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
353
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
354 qlocallimit: QLOCALLIMIT '=' INTEGER ';'
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
355 {
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
356 CHECK_PARAMS_DO( ($3 >= 0),
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
357 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
358 conf->cnf_qlocal_limit = $3;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
359 }
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
360 ;
239ba25870d8 Allow parametrizing the number of threads for routing in/out.
Thomas Klausner <tk@giga.or.at>
parents: 1396
diff changeset
361
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
362 noip: NOIP ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
363 {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
364 if (got_peer_noipv6) {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
365 yyerror (&yylloc, conf, "No_IP conflicts with a ConnectPeer directive No_IPv6.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
366 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
367 }
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
368 conf->cnf_flags.no_ip4 = 1;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
369 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
370 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
371
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
372 noip6: NOIP6 ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
373 {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
374 if (got_peer_noip) {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
375 yyerror (&yylloc, conf, "No_IP conflicts with a ConnectPeer directive No_IP.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
376 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
377 }
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
378 conf->cnf_flags.no_ip6 = 1;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
379 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
380 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
381
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
382 notcp: NOTCP ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
383 {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
384 #ifdef DISABLE_SCTP
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
385 yyerror (&yylloc, conf, "No_TCP cannot be specified for daemon compiled with DISABLE_SCTP option.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
386 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
387 #endif
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
388 if (conf->cnf_flags.no_sctp)
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
389 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
390 yyerror (&yylloc, conf, "No_TCP conflicts with No_SCTP directive." );
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
391 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
392 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
393 if (got_peer_nosctp) {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
394 yyerror (&yylloc, conf, "No_TCP conflicts with a ConnectPeer directive No_SCTP.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
395 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
396 }
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
397 conf->cnf_flags.no_tcp = 1;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
398 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
399 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
400
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
401 nosctp: NOSCTP ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
402 {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
403 if (conf->cnf_flags.no_tcp)
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
404 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
405 yyerror (&yylloc, conf, "No_SCTP conflicts with No_TCP directive." );
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
406 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
407 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
408 if (got_peer_notcp) {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
409 yyerror (&yylloc, conf, "No_SCTP conflicts with a ConnectPeer directive No_TCP.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
410 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
411 }
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
412 conf->cnf_flags.no_sctp = 1;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
413 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
414 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
415
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
416 prefertcp: PREFERTCP ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
417 {
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
418 conf->cnf_flags.pr_tcp = 1;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
419 }
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
420 ;
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
421
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
422 oldtls: OLDTLS ';'
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
423 {
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
424 conf->cnf_flags.tls_alg = 1;
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
425 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
426 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
427
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
428 loadext: LOADEXT '=' QSTRING extconf ';'
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
429 {
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
430 char * fname;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
431 char * cfname;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
432 FILE * fd;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
433
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
434 /* Try and open the extension file */
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
435 fname = $3;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
436 fd = fopen(fname, "r");
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
437 if ((fd == NULL) && (*fname != '/')) {
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
438 char * bkp = fname;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
439 CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ),
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
440 { yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
441 sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
442 fd = fopen(fname, "r");
937
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
443 if (fd == NULL) {
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
444 free(fname);
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
445 fname = bkp;
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
446 } else {
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
447 free(bkp);
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
448 }
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
449 }
937
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
450 if (fd != NULL) {
936
8ee9f8183ab8 Allow freeDiameter extensions to be found by dl_open via the LD_LIBRARY_PATH method rather than default freeDiameter mechanism.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 928
diff changeset
451 fclose(fd);
937
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
452 } /* otherwise, LD_LIBRARY_PATH will be tested by dl_open.
6e7437162f26 Do not change the default file name if extension is not found during configuration parsing, so that dl_open can use LD_LIBRARY_PATH successfully
Sebastien Decugis <sdecugis@freediameter.net>
parents: 936
diff changeset
453 This should not give any security issue, otherwise we can add an "else fail" here. */
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
454
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
455 /* Try and open the configuration file (optional) */
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
456 cfname = $4;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
457 if (cfname) {
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
458 fd = fopen(cfname, "r");
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
459 if ((fd == NULL) && (*cfname != '/')) {
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
460 char * test;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
461 CHECK_MALLOC_DO( test = malloc( strlen(cfname) + strlen(DEFAULT_CONF_PATH) + 2 ),
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
462 { yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
463 sprintf(test, DEFAULT_CONF_PATH "/%s", cfname);
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
464 fd = fopen(test, "r");
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
465 if (fd) {
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
466 free(cfname);
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
467 cfname=test;
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
468 } else {
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
469 /* This is not an error, we allow an extension to wait for something else than a real conf file. */
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
470 free(test);
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
471 }
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
472 }
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
473 if (fd)
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
474 fclose(fd);
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
475 }
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
476
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
477 CHECK_FCT_DO( fd_ext_add( fname, cfname ),
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
478 { yyerror (&yylloc, conf, "Error adding extension"); YYERROR; } );
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
479 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
480 ;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
481
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
482 extconf: /* empty */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
483 {
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
484 $$ = NULL;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
485 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
486 | ':' QSTRING
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
487 {
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
488 $$ = $2;
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
489 }
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
490 ;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
491
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
492 connpeer: {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
493 memset(&fddpi, 0, sizeof(fddpi));
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
494 fddpi.config.pic_flags.persist = PI_PRST_ALWAYS;
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
495 fd_list_init( &fddpi.pi_endpoints, NULL );
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
496 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
497 CONNPEER '=' QSTRING peerinfo ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
498 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
499 fddpi.pi_diamid = $4;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
500 CHECK_FCT_DO( fd_peer_add ( &fddpi, conf->cnf_file, NULL, NULL ),
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
501 { yyerror (&yylloc, conf, "Error adding ConnectPeer information"); YYERROR; } );
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
502
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
503 /* Now destroy any content in the structure */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
504 free(fddpi.pi_diamid);
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
505 free(fddpi.config.pic_realm);
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
506 free(fddpi.config.pic_priority);
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
507 while (!FD_IS_LIST_EMPTY(&fddpi.pi_endpoints)) {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
508 struct fd_list * li = fddpi.pi_endpoints.next;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
509 fd_list_unlink(li);
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
510 free(li);
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
511 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
512 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
513 ;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
514
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
515 peerinfo: /* empty */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
516 | '{' peerparams '}'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
517 ;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
518
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
519 peerparams: /* empty */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
520 | peerparams NOIP ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
521 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
522 if ((conf->cnf_flags.no_ip6) || (fddpi.config.pic_flags.pro3 == PI_P3_IP)) {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
523 yyerror (&yylloc, conf, "No_IP conflicts with a No_IPv6 directive.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
524 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
525 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
526 got_peer_noip++;
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
527 fddpi.config.pic_flags.pro3 = PI_P3_IPv6;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
528 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
529 | peerparams NOIP6 ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
530 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
531 if ((conf->cnf_flags.no_ip4) || (fddpi.config.pic_flags.pro3 == PI_P3_IPv6)) {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
532 yyerror (&yylloc, conf, "No_IPv6 conflicts with a No_IP directive.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
533 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
534 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
535 got_peer_noipv6++;
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
536 fddpi.config.pic_flags.pro3 = PI_P3_IP;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
537 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
538 | peerparams NOTCP ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
539 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
540 #ifdef DISABLE_SCTP
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
541 yyerror (&yylloc, conf, "No_TCP cannot be specified in daemon compiled with DISABLE_SCTP option.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
542 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
543 #endif
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
544 if ((conf->cnf_flags.no_sctp) || (fddpi.config.pic_flags.pro4 == PI_P4_TCP)) {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
545 yyerror (&yylloc, conf, "No_TCP conflicts with a No_SCTP directive.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
546 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
547 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
548 got_peer_notcp++;
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
549 fddpi.config.pic_flags.pro4 = PI_P4_SCTP;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
550 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
551 | peerparams NOSCTP ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
552 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
553 if ((conf->cnf_flags.no_tcp) || (fddpi.config.pic_flags.pro4 == PI_P4_SCTP)) {
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
554 yyerror (&yylloc, conf, "No_SCTP conflicts with a No_TCP directive.");
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
555 YYERROR;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
556 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
557 got_peer_nosctp++;
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
558 fddpi.config.pic_flags.pro4 = PI_P4_TCP;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
559 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
560 | peerparams PREFERTCP ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
561 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
562 fddpi.config.pic_flags.alg = PI_ALGPREF_TCP;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
563 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
564 | peerparams OLDTLS ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
565 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
566 fddpi.config.pic_flags.sec |= PI_SEC_TLS_OLD;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
567 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
568 | peerparams NOTLS ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
569 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
570 fddpi.config.pic_flags.sec |= PI_SEC_NONE;
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
571 }
1180
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
572 | peerparams SEC3436 ';'
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
573 {
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
574 fddpi.config.pic_flags.sctpsec |= PI_SCTPSEC_3436;
773498f59520 Preparing for future DTLS/SCTP support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1012
diff changeset
575 }
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
576 | peerparams REALM '=' QSTRING ';'
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
577 {
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
578 fddpi.config.pic_realm = $4;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
579 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
580 | peerparams PORT '=' INTEGER ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
581 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
582 CHECK_PARAMS_DO( ($4 > 0) && ($4 < 1<<16),
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
583 { yyerror (&yylloc, conf, "Invalid port value"); YYERROR; } );
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
584 fddpi.config.pic_port = (uint16_t)$4;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
585 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
586 | peerparams TCTIMER '=' INTEGER ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
587 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
588 fddpi.config.pic_tctimer = $4;
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
589 }
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
590 | peerparams TWTIMER '=' INTEGER ';'
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
591 {
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
592 fddpi.config.pic_twtimer = $4;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
593 }
22
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 20
diff changeset
594 | peerparams TLS_PRIO '=' QSTRING ';'
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 20
diff changeset
595 {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
596 fddpi.config.pic_priority = $4;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
597 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
598 | peerparams CONNTO '=' QSTRING ';'
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
599 {
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
600 struct addrinfo hints, *ai;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
601 int ret;
23
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 22
diff changeset
602 int disc = 0;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
603
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
604 memset(&hints, 0, sizeof(hints));
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
605 hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
606 ret = getaddrinfo($4, NULL, &hints, &ai);
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
607 if (ret == EAI_NONAME) {
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
608 /* The name was maybe not numeric, try again */
24
bd83ce9328ed Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 23
diff changeset
609 disc = EP_FL_DISC;
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
610 hints.ai_flags &= ~ AI_NUMERICHOST;
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
611 ret = getaddrinfo($4, NULL, &hints, &ai);
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
612 }
23
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 22
diff changeset
613 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; }
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
614
756
36caa2c02d1e Enable running two freeDiameter instances on a single host
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
615 CHECK_FCT_DO( fd_ep_add_merge( &fddpi.pi_endpoints, ai->ai_addr, ai->ai_addrlen, EP_FL_CONF | (disc ?: EP_ACCEPTALL) ), YYERROR );
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
616 free($4);
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
617 freeaddrinfo(ai);
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
618 }
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
619 ;
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
620
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
621 tls_cred: TLS_CRED '=' QSTRING ',' QSTRING ';'
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
622 {
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
623 FILE * fd;
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
624 fd = fopen($3, "r");
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
625 if (fd == NULL) {
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
626 int ret = errno;
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
627 TRACE_ERROR("Unable to open certificate file %s for reading: %s", $3, strerror(ret));
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
628 yyerror (&yylloc, conf, "Error on file name");
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
629 YYERROR;
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
630 }
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
631 fclose(fd);
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
632 fd = fopen($5, "r");
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
633 if (fd == NULL) {
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
634 int ret = errno;
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
635 TRACE_ERROR("Unable to open private key file %s for reading: %s", $5, strerror(ret));
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
636 yyerror (&yylloc, conf, "Error on file name");
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
637 YYERROR;
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
638 }
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
639 fclose(fd);
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
640 conf->cnf_sec_data.cert_file = $3;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
641 conf->cnf_sec_data.key_file = $5;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
642
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
643 CHECK_GNUTLS_DO( gnutls_certificate_set_x509_key_file(
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
644 conf->cnf_sec_data.credentials,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
645 conf->cnf_sec_data.cert_file,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
646 conf->cnf_sec_data.key_file,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
647 GNUTLS_X509_FMT_PEM),
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
648 { yyerror (&yylloc, conf, "Error opening certificate or private key file."); YYERROR; } );
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
649 }
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
650 ;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
651
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
652 tls_ca: TLS_CA '=' QSTRING ';'
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
653 {
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
654 FILE * fd;
805
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
655 fd = fopen($3, "rb");
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
656 if (fd == NULL) {
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
657 int ret = errno;
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
658 TRACE_ERROR("Unable to open CA file %s for reading: %s", $3, strerror(ret));
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
659 yyerror (&yylloc, conf, "Error on file name");
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
660 YYERROR;
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
661 }
805
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
662 #ifdef GNUTLS_VERSION_300
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
663 {
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
664 /* We import these CA in the trust list */
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
665 gnutls_x509_crt_t * calist;
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
666 unsigned int cacount;
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
667 gnutls_datum_t cafile;
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
668
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
669 CHECK_FCT_DO( fd_conf_stream_to_gnutls_datum(fd, &cafile),
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
670 { yyerror (&yylloc, conf, "Error reading CA file."); YYERROR; } );
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
671
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
672 CHECK_GNUTLS_DO( gnutls_x509_crt_list_import2(&calist, &cacount, &cafile, GNUTLS_X509_FMT_PEM,
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
673 GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED),
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
674 { yyerror (&yylloc, conf, "Error importing CA file."); YYERROR; } );
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
675 free(cafile.data);
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
676
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
677 CHECK_GNUTLS_DO( gnutls_x509_trust_list_add_cas (fd_g_config->cnf_sec_data.trustlist, calist, cacount, 0),
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
678 { yyerror (&yylloc, conf, "Error saving CA in trust list."); YYERROR; } );
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
679 }
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
680 #endif /* GNUTLS_VERSION_300 */
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
681 fclose(fd);
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
682 conf->cnf_sec_data.ca_file = $3;
142
dee0a871abcd Added number of CA certificates for debug
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
683 CHECK_GNUTLS_DO( conf->cnf_sec_data.ca_file_nr += gnutls_certificate_set_x509_trust_file(
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
684 conf->cnf_sec_data.credentials,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
685 conf->cnf_sec_data.ca_file,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
686 GNUTLS_X509_FMT_PEM),
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
687 { yyerror (&yylloc, conf, "Error setting CA parameters."); YYERROR; } );
805
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
688
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
689 }
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
690 ;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
691
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
692 tls_crl: TLS_CRL '=' QSTRING ';'
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
693 {
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
694 FILE * fd;
805
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
695 fd = fopen($3, "rb");
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
696 if (fd == NULL) {
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
697 int ret = errno;
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
698 TRACE_ERROR("Unable to open CRL file %s for reading: %s", $3, strerror(ret));
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
699 yyerror (&yylloc, conf, "Error on file name");
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
700 YYERROR;
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
701 }
805
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
702 #ifdef GNUTLS_VERSION_300
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
703 {
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
704 /* We import these CRL in the trust list */
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
705 gnutls_x509_crl_t * crllist;
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
706 unsigned int crlcount;
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
707 gnutls_datum_t crlfile;
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
708
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
709 CHECK_FCT_DO( fd_conf_stream_to_gnutls_datum(fd, &crlfile),
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
710 { yyerror (&yylloc, conf, "Error reading CRL file."); YYERROR; } );
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
711
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
712 CHECK_GNUTLS_DO( gnutls_x509_crl_list_import2(&crllist, &crlcount, &crlfile, GNUTLS_X509_FMT_PEM, 0),
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
713 { yyerror (&yylloc, conf, "Error importing CRL file."); YYERROR; } );
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
714 free(crlfile.data);
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
715
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
716 CHECK_GNUTLS_DO( gnutls_x509_trust_list_add_crls (fd_g_config->cnf_sec_data.trustlist, crllist, crlcount,
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
717 GNUTLS_TL_VERIFY_CRL,
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
718 0),
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
719 { yyerror (&yylloc, conf, "Error importing CRL in trust list."); YYERROR; } );
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
720 }
fb5e0fd923ff Updated verification of the local certificate following GnuTLS 3.x guideline
Sebastien Decugis <sdecugis@freediameter.net>
parents: 756
diff changeset
721 #endif /* GNUTLS_VERSION_300 */
308
5f882de409eb Added test for file access
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
722 fclose(fd);
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
723 conf->cnf_sec_data.crl_file = $3;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
724 CHECK_GNUTLS_DO( gnutls_certificate_set_x509_crl_file(
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
725 conf->cnf_sec_data.credentials,
1255
c6a4bda62ccc Fix typo on TLS_CRL parsing
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1189
diff changeset
726 conf->cnf_sec_data.crl_file,
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
727 GNUTLS_X509_FMT_PEM),
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
728 { yyerror (&yylloc, conf, "Error setting CRL parameters."); YYERROR; } );
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
729 }
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
730 ;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
731
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
732 tls_prio: TLS_PRIO '=' QSTRING ';'
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
733 {
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
734 const char * err_pos = NULL;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
735 conf->cnf_sec_data.prio_string = $3;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
736 CHECK_GNUTLS_DO( gnutls_priority_init(
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
737 &conf->cnf_sec_data.prio_cache,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
738 conf->cnf_sec_data.prio_string,
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
739 &err_pos),
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
740 { yyerror (&yylloc, conf, "Error setting Priority parameter.");
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
741 TRACE_ERROR("Error at position : %s", err_pos);
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
742 YYERROR; } );
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
743 }
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
744 ;
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
745
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
746 tls_dh: TLS_DH_BITS '=' INTEGER ';'
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
747 {
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
748 conf->cnf_sec_data.dh_bits = $3;
578
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
749 }
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
750 | TLS_DH_FILE '=' QSTRING ';'
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
751 {
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
752 FILE * fd;
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
753 free(conf->cnf_sec_data.dh_file);
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
754 conf->cnf_sec_data.dh_file = $3;
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
755 fd = fopen($3, "r");
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
756 if (fd == NULL) {
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
757 int ret = errno;
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 969
diff changeset
758 TRACE_ERROR("Unable to open DH file %s for reading: %s", $3, strerror(ret));
578
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
759 yyerror (&yylloc, conf, "Error on file name");
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
760 YYERROR;
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
761 }
7c9a00bfd115 Allow TLS Diffie-Hellmann parameters to be loaded from a file (ticket #17)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 308
diff changeset
762 fclose(fd);
18
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
763 }
e7187583dcf8 Added CA helper script
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
764 ;
1326
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
765
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
766 rr_values: ALWAYS
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
767 {
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
768 conf->cnf_rr_in_answers = 1;
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
769 }
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
770 | NEVER
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
771 {
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
772 conf->cnf_rr_in_answers = 0;
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
773 }
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
774 ;
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
775
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
776 rr_in_answers: RR_IN_ANSWERS '=' rr_values ';'
afe0ecdb0692 Add config option if Route-Record AVPs should be added in Answers.
Thomas Klausner <tk@giga.or.at>
parents: 1281
diff changeset
777 ;
"Welcome to our mercurial repository"