GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/npppd/npppd/parse.c Lines: 0 541 0.0 %
Date: 2017-11-07 Branches: 0 340 0.0 %

Line Branch Exec Source
1
#include <stdlib.h>
2
#include <string.h>
3
#define YYBYACC 1
4
#define YYMAJOR 1
5
#define YYMINOR 9
6
#define YYLEX yylex()
7
#define YYEMPTY -1
8
#define yyclearin (yychar=(YYEMPTY))
9
#define yyerrok (yyerrflag=0)
10
#define YYRECOVERING() (yyerrflag!=0)
11
#define YYPREFIX "yy"
12
#line 23 "parse.y"
13
#include <sys/types.h>
14
#include <sys/socket.h>
15
#include <sys/queue.h>
16
#include <netinet/in.h>
17
#include <arpa/inet.h>
18
#include <net/if.h>
19
20
#include <ctype.h>
21
#include <errno.h>
22
#include <inttypes.h>
23
#include <limits.h>
24
#include <stdarg.h>
25
#include <stdio.h>
26
#include <stdlib.h>
27
#include <string.h>
28
#include <syslog.h>
29
#include <netdb.h>
30
#include <event.h>
31
32
#include <stdbool.h>
33
#include <stdarg.h>
34
#include "npppd_auth.h"
35
#include "slist.h"
36
#include "npppd.h"
37
#ifdef USE_NPPPD_RADIUS
38
#include "radius_req.h"
39
#endif
40
#include "privsep.h"
41
#include "log.h"
42
43
TAILQ_HEAD(files, file)		 files = TAILQ_HEAD_INITIALIZER(files);
44
static struct file {
45
	TAILQ_ENTRY(file)	 entry;
46
	FILE			*stream;
47
	char			*name;
48
	int			 lineno;
49
	int			 errors;
50
} *file, *topfile;
51
struct file	*pushfile(const char *);
52
int		 popfile(void);
53
int		 yyparse(void);
54
int		 yylex(void);
55
int		 yyerror(const char *, ...)
56
    __attribute__((__format__ (printf, 1, 2)))
57
    __attribute__((__nonnull__ (1)));
58
int		 kw_cmp(const void *, const void *);
59
int		 lookup(char *);
60
int		 lgetc(int);
61
int		 lungetc(int);
62
int		 findeol(void);
63
64
static void		 tunnconf_init (struct tunnconf *, int);
65
static void		 tunnconf_fini (struct tunnconf *);
66
static struct tunnconf	*tunnconf_find (const char *);
67
static void		 authconf_init (struct authconf *);
68
static void		 authconf_fini (struct authconf *);
69
static void		 radconf_fini (struct radconf *);
70
static struct authconf	*authconf_find (const char *);
71
static void		 ipcpconf_init (struct ipcpconf *);
72
static void		 ipcpconf_fini (struct ipcpconf *);
73
static struct ipcpconf	*ipcpconf_find (const char *);
74
static struct iface	*iface_find (const char *);
75
static void		 sa_set_in_addr_any(struct sockaddr *);
76
77
struct npppd_conf	*conf;
78
struct ipcpconf		*curr_ipcpconf;
79
struct tunnconf		*curr_tunnconf;
80
struct authconf		*curr_authconf;
81
struct radconf		*curr_radconf;
82
83
typedef struct {
84
	union {
85
		int64_t			 number;
86
		char			*string;
87
		struct sockaddr_storage  address;
88
		struct in_addr           in4_addr;
89
		bool                     yesno;
90
	} v;
91
	int lineno;
92
} YYSTYPE;
93
94
#line 95 "parse.c"
95
#define SET 257
96
#define MAX_SESSION 258
97
#define USER_MAX_SESSION 259
98
#define TUNNEL 260
99
#define LISTEN 261
100
#define ON 262
101
#define PROTOCOL 263
102
#define MRU 264
103
#define IP 265
104
#define LCP 266
105
#define PAP 267
106
#define CHAP 268
107
#define EAP 269
108
#define MPPE 270
109
#define CCP 271
110
#define MSCHAPV2 272
111
#define STATEFUL 273
112
#define STATELESS 274
113
#define REQUIRED 275
114
#define YES 276
115
#define NO 277
116
#define L2TP 278
117
#define PPTP 279
118
#define PPPOE 280
119
#define L2TP_HOSTNAME 281
120
#define L2TP_VENDOR_NAME 282
121
#define L2TP_DATA_USE_SEQ 283
122
#define L2TP_REQUIRE_IPSEC 284
123
#define L2TP_LCP_RENEGOTIATION 285
124
#define L2TP_FORCE_LCP_RENEGOTIATION 286
125
#define L2TP_CTRL_IN_PKTDUMP 287
126
#define L2TP_CTRL_OUT_PKTDUMP 288
127
#define L2TP_DATA_IN_PKTDUMP 289
128
#define L2TP_DATA_OUT_PKTDUMP 290
129
#define PPTP_HOSTNAME 291
130
#define PPTP_VENDOR_NAME 292
131
#define PPTP_ECHO_INTERVAL 293
132
#define PPTP_ECHO_TIMEOUT 294
133
#define PPTP_CTRL_IN_PKTDUMP 295
134
#define PPTP_CTRL_OUT_PKTDUMP 296
135
#define PPTP_DATA_IN_PKTDUMP 297
136
#define PPTP_DATA_OUT_PKTDUMP 298
137
#define PPPOE_SERVICE_NAME 299
138
#define PPPOE_ACCEPT_ANY_SERVICE 300
139
#define PPPOE_AC_NAME 301
140
#define PPPOE_DESC_IN_PKTDUMP 302
141
#define PPPOE_DESC_OUT_PKTDUMP 303
142
#define PPPOE_SESSION_IN_PKTDUMP 304
143
#define PPPOE_SESSION_OUT_PKTDUMP 305
144
#define LCP_TIMEOUT 306
145
#define LCP_MAX_CONFIGURE 307
146
#define LCP_MAX_TERMINATE 308
147
#define LCP_MAX_NAK_LOOP 309
148
#define LCP_KEEPALIVE 310
149
#define LCP_KEEPALIVE_INTERVAL 311
150
#define LCP_KEEPALIVE_RETRY_INTERVAL 312
151
#define LCP_KEEPALIVE_MAX_RETRIES 313
152
#define AUTHENTICATION_METHOD 314
153
#define CHAP_NAME 315
154
#define IPCP_TIMEOUT 316
155
#define IPCP_MAX_CONFIGURE 317
156
#define IPCP_MAX_TERMINATE 318
157
#define IPCP_MAX_NAK_LOOP 319
158
#define CCP_TIMEOUT 320
159
#define CCP_MAX_CONFIGURE 321
160
#define CCP_MAX_TERMINATE 322
161
#define CCP_MAX_NAK_LOOP 323
162
#define L2TP_HELLO_INTERVAL 324
163
#define L2TP_HELLO_TIMEOUT 325
164
#define L2TP_ACCEPT_DIALIN 326
165
#define MPPE_KEY_LENGTH 327
166
#define MPPE_KEY_STATE 328
167
#define IDLE_TIMEOUT 329
168
#define TCP_MSS_ADJUST 330
169
#define INGRESS_FILTER 331
170
#define CALLNUM_CHECK 332
171
#define PIPEX 333
172
#define DEBUG_DUMP_PKTIN 334
173
#define DEBUG_DUMP_PKTOUT 335
174
#define AUTHENTICATION 336
175
#define TYPE 337
176
#define LOCAL 338
177
#define USERNAME_SUFFIX 339
178
#define USERNAME_PREFIX 340
179
#define EAP_CAPABLE 341
180
#define STRIP_NT_DOMAIN 342
181
#define STRIP_ATMARK_REALM 343
182
#define USERS_FILE 344
183
#define RADIUS 345
184
#define AUTHENTICATION_SERVER 346
185
#define ACCOUNTING_SERVER 347
186
#define PORT 348
187
#define X_TIMEOUT 349
188
#define MAX_TRIES 350
189
#define MAX_FAILOVERS 351
190
#define SECRET 352
191
#define POOL_ADDRESS 353
192
#define DNS_SERVERS 354
193
#define NBNS_SERVERS 355
194
#define FOR 356
195
#define STATIC 357
196
#define DYNAMIC 358
197
#define RESOLVER 359
198
#define ALLOW_USER_SELECTED_ADDRESS 360
199
#define INTERFACE 361
200
#define ADDRESS 362
201
#define IPCP 363
202
#define BIND 364
203
#define FROM 365
204
#define AUTHENTICATED 366
205
#define BY 367
206
#define TO 368
207
#define ERROR 369
208
#define STRING 370
209
#define NUMBER 371
210
#define YYERRCODE 256
211
const short yylhs[] =
212
	{                                        -1,
213
    0,    0,    0,    0,    0,    0,    0,    0,    0,   18,
214
   18,   25,   19,   24,   24,   27,   27,   27,   28,   28,
215
   28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
216
   28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
217
   28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
218
   28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
219
   28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
220
   28,   28,   28,   28,   28,   28,   28,    6,    6,    6,
221
    7,    7,    7,    2,    3,    5,   16,   16,   15,   15,
222
   15,    9,    9,    8,   11,   11,   10,   10,   13,   13,
223
   12,   12,   12,   12,   12,   12,   12,   12,   30,   20,
224
   31,   31,   31,   32,   32,   32,   32,   32,   32,   33,
225
   32,   35,   32,    4,    4,   14,   14,   34,   34,   34,
226
   36,   36,   36,   36,   37,   21,   38,   38,   38,   39,
227
   39,   39,   39,   39,   39,   39,   39,   17,   17,   17,
228
   22,   23,    1,    1,   26,   26,   29,
229
};
230
const short yylen[] =
231
	{                                         2,
232
    0,    2,    3,    3,    3,    3,    3,    3,    3,    3,
233
    3,    0,    6,    0,    4,    0,    3,    2,    3,    4,
234
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
235
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
236
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
237
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
238
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
239
    2,    2,    2,    2,    2,    2,    2,    1,    1,    1,
240
    1,    1,    1,    1,    2,    1,    1,    2,    1,    1,
241
    1,    1,    2,    1,    1,    2,    1,    1,    1,    2,
242
    1,    1,    1,    1,    1,    1,    1,    1,    0,    9,
243
    0,    3,    2,    2,    2,    2,    2,    2,    2,    0,
244
    6,    0,    6,    0,    2,    1,    1,    0,    3,    2,
245
    5,    2,    2,    2,    0,    7,    0,    3,    2,    3,
246
    2,    3,    2,    3,    2,    2,    2,    0,    2,    2,
247
    6,    9,    1,    1,    2,    0,    2,
248
};
249
const short yydefred[] =
250
	{                                      1,
251
    0,    0,    0,    0,    0,    0,    0,    0,    2,    0,
252
    0,    0,    0,    0,    0,    9,    0,    0,    0,    0,
253
    0,  135,    0,    3,    4,    5,    6,    7,    8,   10,
254
   11,    0,    0,    0,    0,    0,   78,   79,   80,   12,
255
  126,  127,  109,   86,    0,    0,    0,    0,    0,    0,
256
    0,    0,    0,    0,   13,    0,  151,  155,    0,    0,
257
    0,    0,    0,    0,    0,    0,    0,    0,  147,    0,
258
  141,    0,    0,  153,  154,  146,  136,    0,  139,    0,
259
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
260
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
261
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
262
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
263
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
264
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
265
    0,    0,    0,    0,    0,    0,  120,  122,    0,    0,
266
    0,  140,  142,  144,    0,  138,    0,    0,   25,   83,
267
   81,   82,   68,   40,   41,   45,   46,   47,   48,   49,
268
   50,   51,   52,   53,   54,   55,   56,   57,   58,   59,
269
   60,   61,   62,   63,   64,   65,   66,   67,   21,   22,
270
   23,   24,   26,   27,   28,   29,   89,   90,   91,   87,
271
    0,   31,   32,   33,   34,   35,   36,   37,   38,   39,
272
   42,   43,   44,   94,   92,    0,   97,   98,   95,    0,
273
   72,   71,   73,   74,   75,  101,  102,  103,  104,  105,
274
  106,  107,  108,   99,    0,    0,   15,    0,   18,  119,
275
  114,  115,  116,  117,  118,    0,    0,  110,    0,  113,
276
  150,  149,  157,  152,    0,   84,    0,   19,   88,   93,
277
   96,  100,   17,    0,    0,  112,   20,    0,   85,    0,
278
    0,  125,    0,    0,    0,    0,    0,    0,    0,  132,
279
  133,  134,    0,  121,    0,  130,  123,    0,  129,    0,
280
  131,
281
};
282
const short yydgoto[] =
283
	{                                       1,
284
   76,  257,  258,  269,   45,   40,  163,  215,  216,  219,
285
  220,  234,  235,   43,  200,  201,  152,   10,   11,   12,
286
   13,   14,   15,   55,   48,   52,  139,  140,  156,   49,
287
  149,  150,  246,  277,  247,  278,   35,   64,   65,
288
};
289
const short yysindex[] =
290
	{                                      0,
291
  -10,   14, -249, -335, -321, -314, -311, -194,    0,   57,
292
   58,   60,   61,   62,   63,    0, -297, -296, -187, -259,
293
 -285,    0, -286,    0,    0,    0,    0,    0,    0,    0,
294
    0, -240, -304, -290,  -42, -288,    0,    0,    0,    0,
295
    0,    0,    0,    0, -280,   75, -276,  -30,  -28, -274,
296
   75, -256, -273,   75,    0,   75,    0,    0, -271, -269,
297
 -344, -290, -225,  -97,   75, -268,  424, -255,    0, -253,
298
    0, -290, -290,    0,    0,    0,    0,   95,    0, -262,
299
 -155, -263, -230, -261, -258, -225, -225, -225, -225, -225,
300
 -225, -225, -225, -257, -254, -252, -250, -225, -225, -225,
301
 -225, -247, -225, -246, -225, -225, -225, -225, -245, -244,
302
 -242, -241, -225, -239, -238, -237, -260, -234, -233, -232,
303
 -231, -228, -226, -223, -222, -221, -219, -218, -225, -216,
304
 -220, -215, -225, -225, -225, -225, -248, -248,  867,   75,
305
 -214, -212, -225, -225, -225, -210,    0,    0, -124,   75,
306
 -295,    0,    0,    0,   75,    0, -208, -334,    0,    0,
307
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
308
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
309
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
310
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
311
 -260,    0,    0,    0,    0,    0,    0,    0,    0,    0,
312
    0,    0,    0,    0,    0, -216,    0,    0,    0, -220,
313
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
314
    0,    0,    0,    0, -248, -248,    0,   95,    0,    0,
315
    0,    0,    0,    0,    0,  -13,   -9,    0,   95,    0,
316
    0,    0,    0,    0, -207,    0, -211,    0,    0,    0,
317
    0,    0,    0,   75,   75,    0,    0, -206,    0, -320,
318
 -320,    0, -205, -204, -203, -201, -122,   75, -119,    0,
319
    0,    0, -211,    0,   95,    0,    0, -235,    0, -199,
320
    0,};
321
const short yyrindex[] =
322
	{                                      0,
323
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
324
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
325
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
326
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
327
    0,    0,    0,    0,    0,  -88,    0,  108,    0,    0,
328
  732,   -3,    0,  943,    0,  -68,    0,    0,    0,    0,
329
    0,    0,    0,    0,  -88,    0,   16,   17,    0,   -5,
330
    0,    3,    6,    0,    0,    0,    0,    0,    0,    0,
331
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
332
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
333
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
334
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
335
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
336
    0,    0,    0,    0,    0,    0,    0,    0,    0,  943,
337
    0,    0,    0,    0,    0,    0,    0,    0,    0,  -68,
338
    0,    0,    0,    0,  732,    0,    0,    0,    0,    0,
339
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
340
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
341
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
342
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
343
  101,    0,    0,    0,    0,    0,    0,    0,    0,    0,
344
    0,    0,    0,    0,    0,  176,    0,    0,    0,  252,
345
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
346
    0,    0,    0,    0,  579,  654,    0,    0,    0,    0,
347
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
348
    0,    0,    0,    0,    0,    0,  327,    0,    0,    0,
349
    0,    0,    0, -114, -114,    0,    0,    0,    0,   21,
350
   21,    0,    0,    0,    0,    0,    0, -114,    0,    0,
351
    0,    0, -227,    0,    0,    0,    0,    0,    0,    0,
352
    0,};
353
const short yygindex[] =
354
	{                                      0,
355
  199, -129,    0, -132,  -29,    0,    0,  -52,    0,  -48,
356
    0, -171,   35,    0,  -27,    0,    0,    0,    0,    0,
357
    0,    0,    0,    0,    0,    4,    0,   36, -224,    0,
358
    0,   27,    0,  -94,    0, -229,    0,    0,  114,
359
};
360
#define YYTABLESIZE 1278
361
const short yytable[] =
362
	{                                       9,
363
  248,   59,  284,  141,  148,  287,  197,  198,   17,   18,
364
  156,  199,  143,  263,   71,  145,  226,  227,  228,  229,
365
  230,  231,  232,   16,  266,   44,  255,   77,  273,  274,
366
  275,   72,   73,   41,   19,  256,  156,   37,   38,   39,
367
   42,  276,  153,  154,  160,  161,  162,  285,   20,  285,
368
   74,   75,  217,  218,   58,   21,  156,   67,   22,   68,
369
  289,  251,  252,  262,  262,   23,   24,   25,   79,   26,
370
   27,   28,   29,   30,   31,   32,   34,   33,   36,   44,
371
   46,   47,   50,  142,   51,  143,  144,  145,  146,   53,
372
  147,  148,   54,   66,   56,   57,   60,   61,   62,   69,
373
   70,   80,  151,   63,  155,  157,  158,  159,  164,  264,
374
   30,  165,  174,  265,  233,  175,  290,   14,  176,  148,
375
  177,  137,  182,  184,  124,  189,  190,  143,  191,  192,
376
  145,  194,  195,  196,  141,  202,  268,  203,  204,  205,
377
   16,  111,  206,  239,  207,  128,  283,  208,  209,  210,
378
  288,  211,  212,  250,  214,  221,  240,  241,  253,  245,
379
   59,  254,  267,  260,  272,  280,  281,  282,  256,  156,
380
  291,  261,  236,  259,  238,  249,  279,   78,    0,    0,
381
    0,    0,    0,    0,    0,   69,    0,    0,    0,    0,
382
  156,    0,    0,    0,    0,    0,    0,    0,    0,    0,
383
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
384
    0,    0,    0,    0,  142,    0,  143,  144,  145,  146,
385
    0,  147,  148,    0,    0,   30,  273,  274,  275,  273,
386
  274,  275,    0,    0,  156,  156,  156,    0,    0,  276,
387
    0,    0,  276,    0,    0,    2,    3,  156,    0,    4,
388
    0,    0,  148,    0,    0,   60,   61,   62,    0,    0,
389
  143,   70,   63,  145,  156,  156,  156,  270,  271,    0,
390
  156,  156,  156,  156,  156,  156,    0,  156,  156,    0,
391
    0,  286,    0,    0,  166,  167,  168,  169,  170,  171,
392
  172,  173,    0,    0,    0,    0,  178,  179,  180,  181,
393
   69,  183,    0,  185,  186,  187,  188,    0,    0,    0,
394
    0,  193,    0,    0,    0,    0,    0,    0,    0,    0,
395
    0,    0,    0,    0,    0,    5,    0,  213,    0,    0,
396
    0,  222,  223,  224,  225,    0,  124,    0,    0,    0,
397
    0,  242,  243,  244,    0,    0,    0,  148,  148,  148,
398
    6,    0,    7,    8,  148,  143,  143,  143,  145,  145,
399
  145,   30,  143,    0,   30,  145,    0,    0,    0,    0,
400
   30,    0,    0,    0,    0,    0,   70,    0,    0,    0,
401
    0,   30,   30,   30,   30,   30,   30,   30,   30,   30,
402
   30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
403
   30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
404
   30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
405
   30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
406
   30,   30,   30,   30,   30,   30,   69,    0,    0,   69,
407
    0,    0,    0,    0,    0,   69,    0,    0,    0,    0,
408
    0,  124,    0,    0,    0,    0,   69,   69,   69,   69,
409
   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
410
   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
411
   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
412
   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
413
   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
414
   69,    0,   70,    0,    0,   70,    0,    0,    0,    0,
415
    0,   70,    0,    0,    0,    0,    0,    0,    0,    0,
416
    0,    0,   70,   70,   70,   70,   70,   70,   70,   70,
417
   70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
418
   70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
419
   70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
420
   70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
421
   70,   70,   70,   70,   70,   70,   70,  124,   76,    0,
422
  124,    0,    0,    0,    0,    0,  124,    0,    0,    0,
423
    0,    0,    0,    0,    0,    0,    0,  124,  124,  124,
424
  124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
425
  124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
426
  124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
427
  124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
428
  124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
429
  124,  124,    0,   77,    0,    0,    0,    0,    0,    0,
430
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
431
    0,    0,    0,    0,   81,    0,    0,   82,    0,    0,
432
    0,    0,    0,   83,    0,    0,    0,    0,    0,    0,
433
    0,    0,    0,   76,   84,   85,   86,   87,   88,   89,
434
   90,   91,   92,   93,   94,   95,   96,   97,   98,   99,
435
  100,  101,  102,  103,  104,  105,  106,  107,  108,  109,
436
  110,  111,  112,  113,  114,  115,  116,  117,  118,  119,
437
  120,  121,  122,  123,  124,  125,  126,  127,  128,  129,
438
  130,  131,  132,  133,  134,  135,  136,  137,  138,    0,
439
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
440
    0,    0,    0,    0,    0,    0,    0,    0,   77,    0,
441
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
442
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
443
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
444
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
445
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
446
    0,    0,    0,    0,    0,    0,    0,    0,    0,   76,
447
    0,    0,   76,    0,    0,    0,    0,    0,    0,    0,
448
    0,    0,    0,    0,    0,    0,  156,    0,    0,   76,
449
   76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
450
   76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
451
   76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
452
   76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
453
   76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
454
   76,   76,   76,   76,   77,    0,    0,   77,    0,    0,
455
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
456
    0,    0,    0,    0,   77,   77,   77,   77,   77,   77,
457
   77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
458
   77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
459
   77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
460
   77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
461
   77,   77,   77,   77,   77,   77,   77,   77,   77,  156,
462
  156,  237,  156,    0,    0,  156,    0,    0,    0,    0,
463
    0,  156,    0,    0,    0,    0,    0,    0,    0,    0,
464
    0,    0,  156,  156,  156,  156,  156,  156,  156,  156,
465
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
466
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
467
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
468
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
469
  156,  156,  156,  156,  156,  156,  156,  156,    0,    0,
470
  156,    0,  156,  156,  156,  156,    0,  156,  156,    0,
471
  156,  156,  156,    0,  156,  156,  156,    0,    0,    0,
472
    0,  156,    0,  156,    0,    0,    0,    0,    0,    0,
473
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
474
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
475
    0,    0,    0,    0,    0,    0,    0,   81,    0,    0,
476
   82,    0,    0,    0,    0,    0,   83,    0,    0,    0,
477
    0,    0,    0,    0,    0,    0,    0,   84,   85,   86,
478
   87,   88,   89,   90,   91,   92,   93,   94,   95,   96,
479
   97,   98,   99,  100,  101,  102,  103,  104,  105,  106,
480
  107,  108,  109,  110,  111,  112,  113,  114,  115,  116,
481
  117,  118,  119,  120,  121,  122,  123,  124,  125,  126,
482
  127,  128,  129,  130,  131,  132,  133,  134,  135,  136,
483
  137,  138,    0,  156,    0,    0,  156,    0,    0,    0,
484
    0,    0,  156,    0,    0,    0,    0,    0,    0,    0,
485
    0,    0,    0,  156,  156,  156,  156,  156,  156,  156,
486
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
487
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
488
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
489
  156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
490
  156,  156,  156,  156,  156,  156,  156,  156,
491
};
492
const short yycheck[] =
493
	{                                      10,
494
  125,  258,  125,  259,   10,  125,  267,  268,  258,  259,
495
  125,  272,   10,  238,  359,   10,  265,  266,  267,  268,
496
  269,  270,  271,   10,  249,  370,  361,  125,  349,  350,
497
  351,   61,   62,  338,  370,  370,  125,  278,  279,  280,
498
  345,  362,   72,   73,  275,  276,  277,  277,  370,  279,
499
  276,  277,  273,  274,   51,  370,  125,   54,  370,   56,
500
  285,  357,  358,  235,  236,  260,   10,   10,   65,   10,
501
   10,   10,   10,  371,  371,  263,  362,  337,  365,  370,
502
  123,  370,  363,  339,   10,  341,  342,  343,  344,  366,
503
  346,  347,  123,  367,  123,  370,  353,  354,  355,  371,
504
  370,  370,  356,  360,   10,  368,  262,  371,  370,  123,
505
   10,  370,  370,  123,  363,  370,  352,   10,  371,  125,
506
  371,  125,  370,  370,  352,  371,  371,  125,  371,  371,
507
  125,  371,  371,  371,  259,  370,  348,  371,  371,  371,
508
  125,  125,  371,  140,  371,  125,  276,  371,  371,  371,
509
  283,  371,  371,  150,  371,  371,  371,  370,  155,  370,
510
  258,  370,  370,  216,  371,  371,  371,  371,  370,  258,
511
  370,  220,  138,  201,  139,  149,  271,   64,   -1,   -1,
512
   -1,   -1,   -1,   -1,   -1,   10,   -1,   -1,   -1,   -1,
513
  259,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
514
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
515
   -1,   -1,   -1,   -1,  339,   -1,  341,  342,  343,  344,
516
   -1,  346,  347,   -1,   -1,  125,  349,  350,  351,  349,
517
  350,  351,   -1,   -1,  349,  350,  351,   -1,   -1,  362,
518
   -1,   -1,  362,   -1,   -1,  256,  257,  362,   -1,  260,
519
   -1,   -1,  258,   -1,   -1,  353,  354,  355,   -1,   -1,
520
  258,   10,  360,  258,  353,  354,  355,  264,  265,   -1,
521
  339,  360,  341,  342,  343,  344,   -1,  346,  347,   -1,
522
   -1,  278,   -1,   -1,   86,   87,   88,   89,   90,   91,
523
   92,   93,   -1,   -1,   -1,   -1,   98,   99,  100,  101,
524
  125,  103,   -1,  105,  106,  107,  108,   -1,   -1,   -1,
525
   -1,  113,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
526
   -1,   -1,   -1,   -1,   -1,  336,   -1,  129,   -1,   -1,
527
   -1,  133,  134,  135,  136,   -1,   10,   -1,   -1,   -1,
528
   -1,  143,  144,  145,   -1,   -1,   -1,  353,  354,  355,
529
  361,   -1,  363,  364,  360,  353,  354,  355,  353,  354,
530
  355,  261,  360,   -1,  264,  360,   -1,   -1,   -1,   -1,
531
  270,   -1,   -1,   -1,   -1,   -1,  125,   -1,   -1,   -1,
532
   -1,  281,  282,  283,  284,  285,  286,  287,  288,  289,
533
  290,  291,  292,  293,  294,  295,  296,  297,  298,  299,
534
  300,  301,  302,  303,  304,  305,  306,  307,  308,  309,
535
  310,  311,  312,  313,  314,  315,  316,  317,  318,  319,
536
  320,  321,  322,  323,  324,  325,  326,  327,  328,  329,
537
  330,  331,  332,  333,  334,  335,  261,   -1,   -1,  264,
538
   -1,   -1,   -1,   -1,   -1,  270,   -1,   -1,   -1,   -1,
539
   -1,  125,   -1,   -1,   -1,   -1,  281,  282,  283,  284,
540
  285,  286,  287,  288,  289,  290,  291,  292,  293,  294,
541
  295,  296,  297,  298,  299,  300,  301,  302,  303,  304,
542
  305,  306,  307,  308,  309,  310,  311,  312,  313,  314,
543
  315,  316,  317,  318,  319,  320,  321,  322,  323,  324,
544
  325,  326,  327,  328,  329,  330,  331,  332,  333,  334,
545
  335,   -1,  261,   -1,   -1,  264,   -1,   -1,   -1,   -1,
546
   -1,  270,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
547
   -1,   -1,  281,  282,  283,  284,  285,  286,  287,  288,
548
  289,  290,  291,  292,  293,  294,  295,  296,  297,  298,
549
  299,  300,  301,  302,  303,  304,  305,  306,  307,  308,
550
  309,  310,  311,  312,  313,  314,  315,  316,  317,  318,
551
  319,  320,  321,  322,  323,  324,  325,  326,  327,  328,
552
  329,  330,  331,  332,  333,  334,  335,  261,   10,   -1,
553
  264,   -1,   -1,   -1,   -1,   -1,  270,   -1,   -1,   -1,
554
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  281,  282,  283,
555
  284,  285,  286,  287,  288,  289,  290,  291,  292,  293,
556
  294,  295,  296,  297,  298,  299,  300,  301,  302,  303,
557
  304,  305,  306,  307,  308,  309,  310,  311,  312,  313,
558
  314,  315,  316,  317,  318,  319,  320,  321,  322,  323,
559
  324,  325,  326,  327,  328,  329,  330,  331,  332,  333,
560
  334,  335,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,
561
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
562
   -1,   -1,   -1,   -1,  261,   -1,   -1,  264,   -1,   -1,
563
   -1,   -1,   -1,  270,   -1,   -1,   -1,   -1,   -1,   -1,
564
   -1,   -1,   -1,  125,  281,  282,  283,  284,  285,  286,
565
  287,  288,  289,  290,  291,  292,  293,  294,  295,  296,
566
  297,  298,  299,  300,  301,  302,  303,  304,  305,  306,
567
  307,  308,  309,  310,  311,  312,  313,  314,  315,  316,
568
  317,  318,  319,  320,  321,  322,  323,  324,  325,  326,
569
  327,  328,  329,  330,  331,  332,  333,  334,  335,   -1,
570
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
571
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  125,   -1,
572
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
573
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
574
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
575
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
576
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
577
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  261,
578
   -1,   -1,  264,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
579
   -1,   -1,   -1,   -1,   -1,   -1,  125,   -1,   -1,  281,
580
  282,  283,  284,  285,  286,  287,  288,  289,  290,  291,
581
  292,  293,  294,  295,  296,  297,  298,  299,  300,  301,
582
  302,  303,  304,  305,  306,  307,  308,  309,  310,  311,
583
  312,  313,  314,  315,  316,  317,  318,  319,  320,  321,
584
  322,  323,  324,  325,  326,  327,  328,  329,  330,  331,
585
  332,  333,  334,  335,  261,   -1,   -1,  264,   -1,   -1,
586
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
587
   -1,   -1,   -1,   -1,  281,  282,  283,  284,  285,  286,
588
  287,  288,  289,  290,  291,  292,  293,  294,  295,  296,
589
  297,  298,  299,  300,  301,  302,  303,  304,  305,  306,
590
  307,  308,  309,  310,  311,  312,  313,  314,  315,  316,
591
  317,  318,  319,  320,  321,  322,  323,  324,  325,  326,
592
  327,  328,  329,  330,  331,  332,  333,  334,  335,  258,
593
  259,  125,  261,   -1,   -1,  264,   -1,   -1,   -1,   -1,
594
   -1,  270,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
595
   -1,   -1,  281,  282,  283,  284,  285,  286,  287,  288,
596
  289,  290,  291,  292,  293,  294,  295,  296,  297,  298,
597
  299,  300,  301,  302,  303,  304,  305,  306,  307,  308,
598
  309,  310,  311,  312,  313,  314,  315,  316,  317,  318,
599
  319,  320,  321,  322,  323,  324,  325,  326,  327,  328,
600
  329,  330,  331,  332,  333,  334,  335,  125,   -1,   -1,
601
  339,   -1,  341,  342,  343,  344,   -1,  346,  347,   -1,
602
  349,  350,  351,   -1,  353,  354,  355,   -1,   -1,   -1,
603
   -1,  360,   -1,  362,   -1,   -1,   -1,   -1,   -1,   -1,
604
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
605
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
606
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  261,   -1,   -1,
607
  264,   -1,   -1,   -1,   -1,   -1,  270,   -1,   -1,   -1,
608
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  281,  282,  283,
609
  284,  285,  286,  287,  288,  289,  290,  291,  292,  293,
610
  294,  295,  296,  297,  298,  299,  300,  301,  302,  303,
611
  304,  305,  306,  307,  308,  309,  310,  311,  312,  313,
612
  314,  315,  316,  317,  318,  319,  320,  321,  322,  323,
613
  324,  325,  326,  327,  328,  329,  330,  331,  332,  333,
614
  334,  335,   -1,  261,   -1,   -1,  264,   -1,   -1,   -1,
615
   -1,   -1,  270,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
616
   -1,   -1,   -1,  281,  282,  283,  284,  285,  286,  287,
617
  288,  289,  290,  291,  292,  293,  294,  295,  296,  297,
618
  298,  299,  300,  301,  302,  303,  304,  305,  306,  307,
619
  308,  309,  310,  311,  312,  313,  314,  315,  316,  317,
620
  318,  319,  320,  321,  322,  323,  324,  325,  326,  327,
621
  328,  329,  330,  331,  332,  333,  334,  335,
622
};
623
#define YYFINAL 1
624
#ifndef YYDEBUG
625
#define YYDEBUG 0
626
#endif
627
#define YYMAXTOKEN 371
628
#if YYDEBUG
629
const char * const yyname[] =
630
	{
631
"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
632
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
633
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
634
0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
635
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
636
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
637
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"SET","MAX_SESSION",
638
"USER_MAX_SESSION","TUNNEL","LISTEN","ON","PROTOCOL","MRU","IP","LCP","PAP",
639
"CHAP","EAP","MPPE","CCP","MSCHAPV2","STATEFUL","STATELESS","REQUIRED","YES",
640
"NO","L2TP","PPTP","PPPOE","L2TP_HOSTNAME","L2TP_VENDOR_NAME",
641
"L2TP_DATA_USE_SEQ","L2TP_REQUIRE_IPSEC","L2TP_LCP_RENEGOTIATION",
642
"L2TP_FORCE_LCP_RENEGOTIATION","L2TP_CTRL_IN_PKTDUMP","L2TP_CTRL_OUT_PKTDUMP",
643
"L2TP_DATA_IN_PKTDUMP","L2TP_DATA_OUT_PKTDUMP","PPTP_HOSTNAME",
644
"PPTP_VENDOR_NAME","PPTP_ECHO_INTERVAL","PPTP_ECHO_TIMEOUT",
645
"PPTP_CTRL_IN_PKTDUMP","PPTP_CTRL_OUT_PKTDUMP","PPTP_DATA_IN_PKTDUMP",
646
"PPTP_DATA_OUT_PKTDUMP","PPPOE_SERVICE_NAME","PPPOE_ACCEPT_ANY_SERVICE",
647
"PPPOE_AC_NAME","PPPOE_DESC_IN_PKTDUMP","PPPOE_DESC_OUT_PKTDUMP",
648
"PPPOE_SESSION_IN_PKTDUMP","PPPOE_SESSION_OUT_PKTDUMP","LCP_TIMEOUT",
649
"LCP_MAX_CONFIGURE","LCP_MAX_TERMINATE","LCP_MAX_NAK_LOOP","LCP_KEEPALIVE",
650
"LCP_KEEPALIVE_INTERVAL","LCP_KEEPALIVE_RETRY_INTERVAL",
651
"LCP_KEEPALIVE_MAX_RETRIES","AUTHENTICATION_METHOD","CHAP_NAME","IPCP_TIMEOUT",
652
"IPCP_MAX_CONFIGURE","IPCP_MAX_TERMINATE","IPCP_MAX_NAK_LOOP","CCP_TIMEOUT",
653
"CCP_MAX_CONFIGURE","CCP_MAX_TERMINATE","CCP_MAX_NAK_LOOP",
654
"L2TP_HELLO_INTERVAL","L2TP_HELLO_TIMEOUT","L2TP_ACCEPT_DIALIN",
655
"MPPE_KEY_LENGTH","MPPE_KEY_STATE","IDLE_TIMEOUT","TCP_MSS_ADJUST",
656
"INGRESS_FILTER","CALLNUM_CHECK","PIPEX","DEBUG_DUMP_PKTIN","DEBUG_DUMP_PKTOUT",
657
"AUTHENTICATION","TYPE","LOCAL","USERNAME_SUFFIX","USERNAME_PREFIX",
658
"EAP_CAPABLE","STRIP_NT_DOMAIN","STRIP_ATMARK_REALM","USERS_FILE","RADIUS",
659
"AUTHENTICATION_SERVER","ACCOUNTING_SERVER","PORT","X_TIMEOUT","MAX_TRIES",
660
"MAX_FAILOVERS","SECRET","POOL_ADDRESS","DNS_SERVERS","NBNS_SERVERS","FOR",
661
"STATIC","DYNAMIC","RESOLVER","ALLOW_USER_SELECTED_ADDRESS","INTERFACE",
662
"ADDRESS","IPCP","BIND","FROM","AUTHENTICATED","BY","TO","ERROR","STRING",
663
"NUMBER",
664
};
665
const char * const yyrule[] =
666
	{"$accept : grammar",
667
"grammar :",
668
"grammar : grammar '\\n'",
669
"grammar : grammar set '\\n'",
670
"grammar : grammar tunnel '\\n'",
671
"grammar : grammar authentication '\\n'",
672
"grammar : grammar ipcp '\\n'",
673
"grammar : grammar interface '\\n'",
674
"grammar : grammar bind '\\n'",
675
"grammar : grammar error '\\n'",
676
"set : SET MAX_SESSION NUMBER",
677
"set : SET USER_MAX_SESSION NUMBER",
678
"$$1 :",
679
"tunnel : TUNNEL STRING PROTOCOL tunnelproto $$1 tunnopts",
680
"tunnopts :",
681
"tunnopts : '{' optnl tunnopt_l '}'",
682
"tunnopt_l :",
683
"tunnopt_l : tunnopt_l tunnopt nl",
684
"tunnopt_l : tunnopt optnl",
685
"tunnopt : LISTEN ON addressport",
686
"tunnopt : LISTEN ON INTERFACE STRING",
687
"tunnopt : LCP_TIMEOUT NUMBER",
688
"tunnopt : LCP_MAX_CONFIGURE NUMBER",
689
"tunnopt : LCP_MAX_TERMINATE NUMBER",
690
"tunnopt : LCP_MAX_NAK_LOOP NUMBER",
691
"tunnopt : MRU NUMBER",
692
"tunnopt : LCP_KEEPALIVE yesno",
693
"tunnopt : LCP_KEEPALIVE_INTERVAL NUMBER",
694
"tunnopt : LCP_KEEPALIVE_RETRY_INTERVAL NUMBER",
695
"tunnopt : LCP_KEEPALIVE_MAX_RETRIES NUMBER",
696
"tunnopt : AUTHENTICATION_METHOD authmethod_l",
697
"tunnopt : CHAP_NAME STRING",
698
"tunnopt : IPCP_TIMEOUT NUMBER",
699
"tunnopt : IPCP_MAX_CONFIGURE NUMBER",
700
"tunnopt : IPCP_MAX_TERMINATE NUMBER",
701
"tunnopt : IPCP_MAX_NAK_LOOP NUMBER",
702
"tunnopt : CCP_TIMEOUT NUMBER",
703
"tunnopt : CCP_MAX_CONFIGURE NUMBER",
704
"tunnopt : CCP_MAX_TERMINATE NUMBER",
705
"tunnopt : CCP_MAX_NAK_LOOP NUMBER",
706
"tunnopt : L2TP_HOSTNAME STRING",
707
"tunnopt : L2TP_VENDOR_NAME STRING",
708
"tunnopt : L2TP_HELLO_INTERVAL NUMBER",
709
"tunnopt : L2TP_HELLO_TIMEOUT NUMBER",
710
"tunnopt : L2TP_ACCEPT_DIALIN yesno",
711
"tunnopt : L2TP_DATA_USE_SEQ yesno",
712
"tunnopt : L2TP_REQUIRE_IPSEC yesno",
713
"tunnopt : L2TP_LCP_RENEGOTIATION yesno",
714
"tunnopt : L2TP_FORCE_LCP_RENEGOTIATION yesno",
715
"tunnopt : L2TP_CTRL_IN_PKTDUMP yesno",
716
"tunnopt : L2TP_CTRL_OUT_PKTDUMP yesno",
717
"tunnopt : L2TP_DATA_IN_PKTDUMP yesno",
718
"tunnopt : L2TP_DATA_OUT_PKTDUMP yesno",
719
"tunnopt : PPTP_HOSTNAME STRING",
720
"tunnopt : PPTP_VENDOR_NAME STRING",
721
"tunnopt : PPTP_ECHO_INTERVAL NUMBER",
722
"tunnopt : PPTP_ECHO_TIMEOUT NUMBER",
723
"tunnopt : PPTP_CTRL_IN_PKTDUMP yesno",
724
"tunnopt : PPTP_CTRL_OUT_PKTDUMP yesno",
725
"tunnopt : PPTP_DATA_IN_PKTDUMP yesno",
726
"tunnopt : PPTP_DATA_OUT_PKTDUMP yesno",
727
"tunnopt : PPPOE_SERVICE_NAME STRING",
728
"tunnopt : PPPOE_ACCEPT_ANY_SERVICE yesno",
729
"tunnopt : PPPOE_AC_NAME STRING",
730
"tunnopt : PPPOE_DESC_IN_PKTDUMP yesno",
731
"tunnopt : PPPOE_DESC_OUT_PKTDUMP yesno",
732
"tunnopt : PPPOE_SESSION_IN_PKTDUMP yesno",
733
"tunnopt : PPPOE_SESSION_OUT_PKTDUMP yesno",
734
"tunnopt : MPPE mppeyesno",
735
"tunnopt : MPPE_KEY_LENGTH mppekeylen_l",
736
"tunnopt : MPPE_KEY_STATE mppekeystate_l",
737
"tunnopt : TCP_MSS_ADJUST yesno",
738
"tunnopt : IDLE_TIMEOUT NUMBER",
739
"tunnopt : INGRESS_FILTER yesno",
740
"tunnopt : CALLNUM_CHECK yesno",
741
"tunnopt : PIPEX yesno",
742
"tunnopt : DEBUG_DUMP_PKTIN protobit_l",
743
"tunnopt : DEBUG_DUMP_PKTOUT protobit_l",
744
"tunnelproto : L2TP",
745
"tunnelproto : PPTP",
746
"tunnelproto : PPPOE",
747
"mppeyesno : YES",
748
"mppeyesno : NO",
749
"mppeyesno : REQUIRED",
750
"address : STRING",
751
"addressport : address optport",
752
"in4_addr : STRING",
753
"authmethod_l : authmethod",
754
"authmethod_l : authmethod_l authmethod",
755
"authmethod : PAP",
756
"authmethod : CHAP",
757
"authmethod : MSCHAPV2",
758
"mppekeylen_l : mppekeylen",
759
"mppekeylen_l : mppekeylen_l mppekeylen",
760
"mppekeylen : NUMBER",
761
"mppekeystate_l : mppekeystate",
762
"mppekeystate_l : mppekeystate_l mppekeystate",
763
"mppekeystate : STATEFUL",
764
"mppekeystate : STATELESS",
765
"protobit_l : protobit",
766
"protobit_l : protobit_l protobit",
767
"protobit : IP",
768
"protobit : LCP",
769
"protobit : PAP",
770
"protobit : CHAP",
771
"protobit : EAP",
772
"protobit : MPPE",
773
"protobit : CCP",
774
"protobit : IPCP",
775
"$$2 :",
776
"authentication : AUTHENTICATION STRING TYPE authtype $$2 '{' optnl authopt_l '}'",
777
"authopt_l :",
778
"authopt_l : authopt_l authopt nl",
779
"authopt_l : authopt optnl",
780
"authopt : USERNAME_SUFFIX STRING",
781
"authopt : EAP_CAPABLE yesno",
782
"authopt : STRIP_NT_DOMAIN yesno",
783
"authopt : STRIP_ATMARK_REALM yesno",
784
"authopt : USERS_FILE STRING",
785
"authopt : USER_MAX_SESSION NUMBER",
786
"$$3 :",
787
"authopt : AUTHENTICATION_SERVER $$3 '{' optnl radopt_l '}'",
788
"$$4 :",
789
"authopt : ACCOUNTING_SERVER $$4 '{' optnl radopt_l '}'",
790
"optport :",
791
"optport : PORT NUMBER",
792
"authtype : LOCAL",
793
"authtype : RADIUS",
794
"radopt_l :",
795
"radopt_l : radopt_l radopt nl",
796
"radopt_l : radopt optnl",
797
"radopt : ADDRESS address optport SECRET STRING",
798
"radopt : X_TIMEOUT NUMBER",
799
"radopt : MAX_TRIES NUMBER",
800
"radopt : MAX_FAILOVERS NUMBER",
801
"$$5 :",
802
"ipcp : IPCP STRING $$5 '{' optnl ipcpopt_l '}'",
803
"ipcpopt_l :",
804
"ipcpopt_l : ipcpopt_l ipcpopt nl",
805
"ipcpopt_l : ipcpopt optnl",
806
"ipcpopt : POOL_ADDRESS STRING ipcppooltype",
807
"ipcpopt : DNS_SERVERS RESOLVER",
808
"ipcpopt : DNS_SERVERS in4_addr in4_addr",
809
"ipcpopt : DNS_SERVERS in4_addr",
810
"ipcpopt : NBNS_SERVERS in4_addr in4_addr",
811
"ipcpopt : NBNS_SERVERS in4_addr",
812
"ipcpopt : ALLOW_USER_SELECTED_ADDRESS yesno",
813
"ipcpopt : MAX_SESSION NUMBER",
814
"ipcppooltype :",
815
"ipcppooltype : FOR DYNAMIC",
816
"ipcppooltype : FOR STATIC",
817
"interface : INTERFACE STRING ADDRESS in4_addr IPCP STRING",
818
"bind : BIND TUNNEL FROM STRING AUTHENTICATED BY STRING TO STRING",
819
"yesno : YES",
820
"yesno : NO",
821
"optnl : '\\n' optnl",
822
"optnl :",
823
"nl : '\\n' optnl",
824
};
825
#endif
826
#ifdef YYSTACKSIZE
827
#undef YYMAXDEPTH
828
#define YYMAXDEPTH YYSTACKSIZE
829
#else
830
#ifdef YYMAXDEPTH
831
#define YYSTACKSIZE YYMAXDEPTH
832
#else
833
#define YYSTACKSIZE 10000
834
#define YYMAXDEPTH 10000
835
#endif
836
#endif
837
#define YYINITSTACKSIZE 200
838
/* LINTUSED */
839
int yydebug;
840
int yynerrs;
841
int yyerrflag;
842
int yychar;
843
short *yyssp;
844
YYSTYPE *yyvsp;
845
YYSTYPE yyval;
846
YYSTYPE yylval;
847
short *yyss;
848
short *yysslim;
849
YYSTYPE *yyvs;
850
unsigned int yystacksize;
851
int yyparse(void);
852
#line 954 "parse.y"
853
854
struct keywords {
855
	const char	*k_name;
856
	int		 k_val;
857
};
858
859
int
860
yyerror(const char *fmt, ...)
861
{
862
	va_list		 ap;
863
	char		*msg;
864
865
	file->errors++;
866
	va_start(ap, fmt);
867
	if (vasprintf(&msg, fmt, ap) == -1)
868
		fatalx("yyerror vasprintf");
869
	va_end(ap);
870
	logit(LOG_CRIT, "%s:%d: %s", file->name, yylval.lineno, msg);
871
	free(msg);
872
	return (0);
873
}
874
875
int
876
kw_cmp(const void *k, const void *e)
877
{
878
	return (strcmp(k, ((const struct keywords *)e)->k_name));
879
}
880
881
int
882
lookup(char *s)
883
{
884
	/* this has to be sorted always */
885
	static const struct keywords keywords[] = {
886
		{ "accounting-server",            ACCOUNTING_SERVER},
887
		{ "address",                      ADDRESS},
888
		{ "allow-user-selected-address",  ALLOW_USER_SELECTED_ADDRESS},
889
		{ "authenticated",                AUTHENTICATED},
890
		{ "authentication",               AUTHENTICATION},
891
		{ "authentication-method",        AUTHENTICATION_METHOD},
892
		{ "authentication-server",        AUTHENTICATION_SERVER},
893
		{ "bind",                         BIND},
894
		{ "by",                           BY},
895
		{ "callnum-check",                CALLNUM_CHECK},
896
		{ "ccp",                          CCP},
897
		{ "ccp-max-configure",            CCP_MAX_CONFIGURE},
898
		{ "ccp-max-nak-loop",             CCP_MAX_NAK_LOOP},
899
		{ "ccp-max-terminate",            CCP_MAX_TERMINATE},
900
		{ "ccp-timeout",                  CCP_TIMEOUT},
901
		{ "chap",                         CHAP},
902
		{ "chap-name",                    CHAP_NAME},
903
		{ "debug-dump-pktin",             DEBUG_DUMP_PKTIN},
904
		{ "debug-dump-pktout",            DEBUG_DUMP_PKTOUT},
905
		{ "dns-servers",                  DNS_SERVERS},
906
		{ "dynamic",                      DYNAMIC},
907
		{ "eap",                          EAP},
908
		{ "eap-capable",                  EAP_CAPABLE},
909
		{ "for",                          FOR},
910
		{ "from",                         FROM},
911
		{ "idle-timeout",                 IDLE_TIMEOUT},
912
		{ "ingress-filter",               INGRESS_FILTER},
913
		{ "interface",                    INTERFACE},
914
		{ "ip",                           IP},
915
		{ "ipcp",                         IPCP},
916
		{ "ipcp-max-configure",           IPCP_MAX_CONFIGURE},
917
		{ "ipcp-max-nak-loop",            IPCP_MAX_NAK_LOOP},
918
		{ "ipcp-max-terminate",           IPCP_MAX_TERMINATE},
919
		{ "ipcp-timeout",                 IPCP_TIMEOUT},
920
		{ "l2tp",                         L2TP},
921
		{ "l2tp-accept-dialin",           L2TP_ACCEPT_DIALIN},
922
		{ "l2tp-ctrl-in-pktdump",         L2TP_CTRL_IN_PKTDUMP},
923
		{ "l2tp-ctrl-out-pktdump",        L2TP_CTRL_OUT_PKTDUMP},
924
		{ "l2tp-data-in-pktdump",         L2TP_DATA_IN_PKTDUMP},
925
		{ "l2tp-data-out-pktdump",        L2TP_DATA_OUT_PKTDUMP},
926
		{ "l2tp-data-use-seq",            L2TP_DATA_USE_SEQ},
927
		{ "l2tp-force-lcp-renegotiation", L2TP_FORCE_LCP_RENEGOTIATION},
928
		{ "l2tp-hello-interval",          L2TP_HELLO_INTERVAL},
929
		{ "l2tp-hello-timeout",           L2TP_HELLO_TIMEOUT},
930
		{ "l2tp-hostname",                L2TP_HOSTNAME},
931
		{ "l2tp-lcp-renegotiation",       L2TP_LCP_RENEGOTIATION},
932
		{ "l2tp-require-ipsec",           L2TP_REQUIRE_IPSEC},
933
		{ "l2tp-vendor-name",             L2TP_VENDOR_NAME},
934
		{ "lcp",                          LCP},
935
		{ "lcp-keepalive",                LCP_KEEPALIVE},
936
		{ "lcp-keepalive-interval",       LCP_KEEPALIVE_INTERVAL},
937
		{ "lcp-keepalive-max-retries",    LCP_KEEPALIVE_MAX_RETRIES },
938
		{ "lcp-keepalive-retry-interval", LCP_KEEPALIVE_RETRY_INTERVAL},
939
		{ "lcp-max-configure",            LCP_MAX_CONFIGURE},
940
		{ "lcp-max-nak-loop",             LCP_MAX_NAK_LOOP},
941
		{ "lcp-max-terminate",            LCP_MAX_TERMINATE},
942
		{ "lcp-timeout",                  LCP_TIMEOUT},
943
		{ "listen",                       LISTEN},
944
		{ "local",                        LOCAL},
945
		{ "max-failovers",                MAX_FAILOVERS},
946
		{ "max-session",                  MAX_SESSION},
947
		{ "max-tries",                    MAX_TRIES},
948
		{ "mppe",                         MPPE},
949
		{ "mppe-key-length",              MPPE_KEY_LENGTH},
950
		{ "mppe-key-state",               MPPE_KEY_STATE},
951
		{ "mru",                          MRU},
952
		{ "mschapv2",                     MSCHAPV2},
953
		{ "nbns-servers",                 NBNS_SERVERS},
954
		{ "no",                           NO},
955
		{ "on",                           ON},
956
		{ "pap",                          PAP},
957
		{ "pipex",                        PIPEX},
958
		{ "pool-address",                 POOL_ADDRESS},
959
		{ "port",                         PORT},
960
		{ "pppoe",                        PPPOE},
961
		{ "pppoe-ac-name",                PPPOE_AC_NAME},
962
		{ "pppoe-accept-any-service",     PPPOE_ACCEPT_ANY_SERVICE},
963
		{ "pppoe-desc-in-pktdump",        PPPOE_DESC_IN_PKTDUMP},
964
		{ "pppoe-desc-out-pktdump",       PPPOE_DESC_OUT_PKTDUMP},
965
		{ "pppoe-service-name",           PPPOE_SERVICE_NAME},
966
		{ "pppoe-session-in-pktdump",     PPPOE_SESSION_IN_PKTDUMP},
967
		{ "pppoe-session-out-pktdump",    PPPOE_SESSION_OUT_PKTDUMP},
968
		{ "pptp",                         PPTP},
969
		{ "pptp-ctrl-in-pktdump",         PPTP_CTRL_IN_PKTDUMP},
970
		{ "pptp-ctrl-out-pktdump",        PPTP_CTRL_OUT_PKTDUMP},
971
		{ "pptp-data-in-pktdump",         PPTP_DATA_IN_PKTDUMP},
972
		{ "pptp-data-out-pktdump",        PPTP_DATA_OUT_PKTDUMP},
973
		{ "pptp-echo-interval",           PPTP_ECHO_INTERVAL},
974
		{ "pptp-echo-timeout",            PPTP_ECHO_TIMEOUT},
975
		{ "pptp-hostname",                PPTP_HOSTNAME},
976
		{ "pptp-vendor-name",             PPTP_VENDOR_NAME},
977
		{ "protocol",                     PROTOCOL},
978
		{ "radius",                       RADIUS},
979
		{ "required",                     REQUIRED},
980
		{ "resolver",                     RESOLVER},
981
		{ "secret",                       SECRET},
982
		{ "set",                          SET},
983
		{ "stateful",                     STATEFUL},
984
		{ "stateless",                    STATELESS},
985
		{ "static",                       STATIC},
986
		{ "strip-atmark-realm",           STRIP_ATMARK_REALM},
987
		{ "strip-nt-domain",              STRIP_NT_DOMAIN},
988
		{ "tcp-mss-adjust",               TCP_MSS_ADJUST},
989
		{ "timeout",                      X_TIMEOUT},
990
		{ "to",                           TO},
991
		{ "tunnel",                       TUNNEL},
992
		{ "type",                         TYPE},
993
		{ "user-max-session",             USER_MAX_SESSION},
994
		{ "username-suffix",              USERNAME_SUFFIX},
995
		{ "users-file",                   USERS_FILE},
996
		{ "yes",                          YES}
997
	};
998
	const struct keywords	*p;
999
1000
	p = bsearch(s, keywords, sizeof(keywords)/sizeof(keywords[0]),
1001
	    sizeof(keywords[0]), kw_cmp);
1002
1003
	if (p)
1004
		return (p->k_val);
1005
	else
1006
		return (STRING);
1007
}
1008
1009
#define MAXPUSHBACK	128
1010
1011
u_char	*parsebuf;
1012
int	 parseindex;
1013
u_char	 pushback_buffer[MAXPUSHBACK];
1014
int	 pushback_index = 0;
1015
1016
int
1017
lgetc(int quotec)
1018
{
1019
	int		c, next;
1020
1021
	if (parsebuf) {
1022
		/* Read character from the parsebuffer instead of input. */
1023
		if (parseindex >= 0) {
1024
			c = parsebuf[parseindex++];
1025
			if (c != '\0')
1026
				return (c);
1027
			parsebuf = NULL;
1028
		} else
1029
			parseindex++;
1030
	}
1031
1032
	if (pushback_index)
1033
		return (pushback_buffer[--pushback_index]);
1034
1035
	if (quotec) {
1036
		if ((c = getc(file->stream)) == EOF) {
1037
			yyerror("reached end of file while parsing "
1038
			    "quoted string");
1039
			if (file == topfile || popfile() == EOF)
1040
				return (EOF);
1041
			return (quotec);
1042
		}
1043
		return (c);
1044
	}
1045
1046
	while ((c = getc(file->stream)) == '\\') {
1047
		next = getc(file->stream);
1048
		if (next != '\n') {
1049
			c = next;
1050
			break;
1051
		}
1052
		yylval.lineno = file->lineno;
1053
		file->lineno++;
1054
	}
1055
1056
	while (c == EOF) {
1057
		if (file == topfile || popfile() == EOF)
1058
			return (EOF);
1059
		c = getc(file->stream);
1060
	}
1061
	return (c);
1062
}
1063
1064
int
1065
lungetc(int c)
1066
{
1067
	if (c == EOF)
1068
		return (EOF);
1069
	if (parsebuf) {
1070
		parseindex--;
1071
		if (parseindex >= 0)
1072
			return (c);
1073
	}
1074
	if (pushback_index < MAXPUSHBACK-1)
1075
		return (pushback_buffer[pushback_index++] = c);
1076
	else
1077
		return (EOF);
1078
}
1079
1080
int
1081
findeol(void)
1082
{
1083
	int	c;
1084
1085
	parsebuf = NULL;
1086
1087
	/* skip to either EOF or the first real EOL */
1088
	while (1) {
1089
		if (pushback_index)
1090
			c = pushback_buffer[--pushback_index];
1091
		else
1092
			c = lgetc(0);
1093
		if (c == '\n') {
1094
			file->lineno++;
1095
			break;
1096
		}
1097
		if (c == EOF)
1098
			break;
1099
	}
1100
	return (ERROR);
1101
}
1102
1103
int
1104
yylex(void)
1105
{
1106
	u_char	 buf[8096];
1107
	u_char	*p;
1108
	int	 quotec, next, c;
1109
	int	 token;
1110
1111
	p = buf;
1112
	while ((c = lgetc(0)) == ' ' || c == '\t')
1113
		; /* nothing */
1114
1115
	yylval.lineno = file->lineno;
1116
	if (c == '#')
1117
		while ((c = lgetc(0)) != '\n' && c != EOF)
1118
			; /* nothing */
1119
1120
	switch (c) {
1121
	case '\'':
1122
	case '"':
1123
		quotec = c;
1124
		while (1) {
1125
			if ((c = lgetc(quotec)) == EOF)
1126
				return (0);
1127
			if (c == '\n') {
1128
				file->lineno++;
1129
				continue;
1130
			} else if (c == '\\') {
1131
				if ((next = lgetc(quotec)) == EOF)
1132
					return (0);
1133
				if (next == quotec || c == ' ' || c == '\t')
1134
					c = next;
1135
				else if (next == '\n') {
1136
					file->lineno++;
1137
					continue;
1138
				} else
1139
					lungetc(next);
1140
			} else if (c == quotec) {
1141
				*p = '\0';
1142
				break;
1143
			} else if (c == '\0') {
1144
				yyerror("syntax error");
1145
				return (findeol());
1146
			}
1147
			if (p + 1 >= buf + sizeof(buf) - 1) {
1148
				yyerror("string too long");
1149
				return (findeol());
1150
			}
1151
			*p++ = c;
1152
		}
1153
		yylval.v.string = strdup(buf);
1154
		if (yylval.v.string == NULL)
1155
			fatal("yylex: strdup");
1156
		return (STRING);
1157
	}
1158
1159
#define allowed_to_end_number(x) \
1160
	(isspace(x) || x == ')' || x ==',' || x == '/' || x == '}' || x == '=')
1161
1162
	if (c == '-' || isdigit(c)) {
1163
		do {
1164
			*p++ = c;
1165
			if ((unsigned)(p-buf) >= sizeof(buf)) {
1166
				yyerror("string too long");
1167
				return (findeol());
1168
			}
1169
		} while ((c = lgetc(0)) != EOF && isdigit(c));
1170
		lungetc(c);
1171
		if (p == buf + 1 && buf[0] == '-')
1172
			goto nodigits;
1173
		if (c == EOF || allowed_to_end_number(c)) {
1174
			const char *errstr = NULL;
1175
1176
			*p = '\0';
1177
			yylval.v.number = strtonum(buf, LLONG_MIN,
1178
			    LLONG_MAX, &errstr);
1179
			if (errstr) {
1180
				yyerror("\"%s\" invalid number: %s",
1181
				    buf, errstr);
1182
				return (findeol());
1183
			}
1184
			return (NUMBER);
1185
		} else {
1186
nodigits:
1187
			while (p > buf + 1)
1188
				lungetc(*--p);
1189
			c = *--p;
1190
			if (c == '-')
1191
				return (c);
1192
		}
1193
	}
1194
1195
#define allowed_in_string(x) \
1196
	(isalnum(x) || (ispunct(x) && x != '(' && x != ')' && \
1197
	x != '{' && x != '}' && x != '<' && x != '>' && \
1198
	x != '!' && x != '=' && x != '/' && x != '#' && \
1199
	x != ','))
1200
1201
	if (isalnum(c) || c == ':' || c == '_' || c == '*') {
1202
		do {
1203
			*p++ = c;
1204
			if ((unsigned)(p-buf) >= sizeof(buf)) {
1205
				yyerror("string too long");
1206
				return (findeol());
1207
			}
1208
		} while ((c = lgetc(0)) != EOF && (allowed_in_string(c)));
1209
		lungetc(c);
1210
		*p = '\0';
1211
		if ((token = lookup(buf)) == STRING)
1212
			if ((yylval.v.string = strdup(buf)) == NULL)
1213
				fatal("yylex: strdup");
1214
		return (token);
1215
	}
1216
	if (c == '\n') {
1217
		yylval.lineno = file->lineno;
1218
		file->lineno++;
1219
	}
1220
	if (c == EOF)
1221
		return (0);
1222
	return (c);
1223
}
1224
1225
struct file *
1226
pushfile(const char *name)
1227
{
1228
	struct file	*nfile;
1229
1230
	if ((nfile = calloc(1, sizeof(struct file))) == NULL) {
1231
		log_warn("malloc");
1232
		return (NULL);
1233
	}
1234
	if ((nfile->name = strdup(name)) == NULL) {
1235
		log_warn("malloc");
1236
		free(nfile);
1237
		return (NULL);
1238
	}
1239
#ifdef NO_PRIVSEP
1240
	if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
1241
#else
1242
	if ((nfile->stream = priv_fopen(nfile->name)) == NULL) {
1243
#endif
1244
		log_warn("%s", nfile->name);
1245
		free(nfile->name);
1246
		free(nfile);
1247
		return (NULL);
1248
	}
1249
	nfile->lineno = 1;
1250
	TAILQ_INSERT_TAIL(&files, nfile, entry);
1251
	return (nfile);
1252
}
1253
1254
int
1255
popfile(void)
1256
{
1257
	struct file	*prev;
1258
1259
	if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
1260
		prev->errors += file->errors;
1261
1262
	TAILQ_REMOVE(&files, file, entry);
1263
	fclose(file->stream);
1264
	free(file->name);
1265
	free(file);
1266
	file = prev;
1267
	return (file ? 0 : EOF);
1268
}
1269
1270
int
1271
npppd_conf_parse(struct npppd_conf *xconf, const char *filename)
1272
{
1273
	int  errors = 0;
1274
1275
	conf = xconf;
1276
1277
	if ((file = pushfile(filename)) == NULL) {
1278
		return (-1);
1279
	}
1280
	topfile = file;
1281
1282
	yyparse();
1283
	errors = file->errors;
1284
	popfile();
1285
1286
	if (curr_tunnconf != NULL) {
1287
		tunnconf_fini(curr_tunnconf);
1288
		free(curr_tunnconf);
1289
	}
1290
	curr_tunnconf = NULL;
1291
	if (curr_authconf != NULL) {
1292
		authconf_fini(curr_authconf);
1293
		free(curr_authconf);
1294
	}
1295
	curr_authconf = NULL;
1296
	if (curr_ipcpconf != NULL) {
1297
		ipcpconf_fini(curr_ipcpconf);
1298
		free(curr_ipcpconf);
1299
	}
1300
	curr_ipcpconf = NULL;
1301
1302
	if (errors)
1303
		npppd_conf_fini(xconf);
1304
1305
	return (errors ? -1 : 0);
1306
}
1307
1308
void
1309
npppd_conf_init(struct npppd_conf *xconf)
1310
{
1311
	memset(xconf, 0, sizeof(struct npppd_conf));
1312
	TAILQ_INIT(&xconf->tunnconfs);
1313
	TAILQ_INIT(&xconf->authconfs);
1314
	TAILQ_INIT(&xconf->ipcpconfs);
1315
	TAILQ_INIT(&xconf->ifaces);
1316
	TAILQ_INIT(&xconf->confbinds);
1317
	TAILQ_INIT(&xconf->l2tp_confs);
1318
	TAILQ_INIT(&xconf->pptp_confs);
1319
	TAILQ_INIT(&xconf->pppoe_confs);
1320
}
1321
1322
void
1323
npppd_conf_fini(struct npppd_conf *xconf)
1324
{
1325
	struct tunnconf *tunn, *tunn0;
1326
	struct authconf *auth, *auth0;
1327
	struct ipcpconf *ipcp, *ipcp0;
1328
	struct iface    *iface, *iface0;
1329
	struct confbind *confbind, *confbind0;
1330
1331
	TAILQ_FOREACH_SAFE(tunn, &xconf->tunnconfs, entry, tunn0) {
1332
		tunnconf_fini(tunn);
1333
	}
1334
	TAILQ_FOREACH_SAFE(auth, &xconf->authconfs, entry, auth0) {
1335
		authconf_fini(auth);
1336
	}
1337
	TAILQ_FOREACH_SAFE(ipcp, &xconf->ipcpconfs, entry, ipcp0) {
1338
		ipcpconf_fini(ipcp);
1339
	}
1340
	TAILQ_FOREACH_SAFE(iface, &xconf->ifaces, entry, iface0) {
1341
		free(iface);
1342
	}
1343
	TAILQ_FOREACH_SAFE(confbind, &xconf->confbinds, entry, confbind0) {
1344
		free(confbind);
1345
	}
1346
	TAILQ_INIT(&xconf->l2tp_confs);
1347
	TAILQ_INIT(&xconf->pptp_confs);
1348
	TAILQ_INIT(&xconf->pppoe_confs);
1349
}
1350
1351
void
1352
tunnconf_fini(struct tunnconf *tun)
1353
{
1354
	if (tun->chap_name != NULL)
1355
		free(tun->chap_name);
1356
	tun->chap_name = NULL;
1357
1358
	switch (tun->protocol) {
1359
	case NPPPD_TUNNEL_L2TP:
1360
	    {
1361
		struct l2tp_listen_addr	*l_addr, *l_tmp;
1362
1363
		if (tun->proto.l2tp.hostname != NULL)
1364
			free(tun->proto.l2tp.hostname);
1365
		tun->proto.l2tp.hostname = NULL;
1366
		if (tun->proto.l2tp.vendor_name != NULL)
1367
			free(tun->proto.l2tp.vendor_name);
1368
		tun->proto.l2tp.vendor_name = NULL;
1369
		TAILQ_FOREACH_SAFE(l_addr, &tun->proto.l2tp.listen, entry,
1370
		    l_tmp) {
1371
			TAILQ_REMOVE(&tun->proto.l2tp.listen, l_addr, entry);
1372
			free(l_addr);
1373
		}
1374
		break;
1375
	    }
1376
	case NPPPD_TUNNEL_PPTP:
1377
	    {
1378
		struct pptp_listen_addr	*p_addr, *p_tmp;
1379
1380
		if (tun->proto.pptp.hostname != NULL)
1381
			free(tun->proto.pptp.hostname);
1382
		tun->proto.pptp.hostname = NULL;
1383
		if (tun->proto.pptp.vendor_name != NULL)
1384
			free(tun->proto.pptp.vendor_name);
1385
		tun->proto.pptp.vendor_name = NULL;
1386
		TAILQ_FOREACH_SAFE(p_addr, &tun->proto.pptp.listen, entry,
1387
		    p_tmp) {
1388
			TAILQ_REMOVE(&tun->proto.pptp.listen, p_addr, entry);
1389
			free(p_addr);
1390
		}
1391
		break;
1392
	    }
1393
	case NPPPD_TUNNEL_PPPOE:
1394
		if (tun->proto.pppoe.service_name != NULL)
1395
			free(tun->proto.pppoe.service_name);
1396
		tun->proto.pppoe.service_name = NULL;
1397
		if (tun->proto.pppoe.ac_name != NULL)
1398
			free(tun->proto.pppoe.ac_name);
1399
		tun->proto.pppoe.ac_name = NULL;
1400
		break;
1401
	}
1402
}
1403
1404
void
1405
tunnconf_init(struct tunnconf *tun, int protocol)
1406
{
1407
	extern struct tunnconf tunnconf_default_l2tp, tunnconf_default_pptp;
1408
	extern struct tunnconf tunnconf_default_pppoe;
1409
1410
	switch (protocol) {
1411
	case NPPPD_TUNNEL_L2TP:
1412
		memcpy(tun, &tunnconf_default_l2tp, sizeof(struct tunnconf));
1413
		TAILQ_INIT(&tun->proto.l2tp.listen);
1414
		break;
1415
	case NPPPD_TUNNEL_PPTP:
1416
		memcpy(tun, &tunnconf_default_pptp, sizeof(struct tunnconf));
1417
		TAILQ_INIT(&tun->proto.pptp.listen);
1418
		break;
1419
	case NPPPD_TUNNEL_PPPOE:
1420
		memcpy(tun, &tunnconf_default_pppoe, sizeof(struct tunnconf));
1421
		break;
1422
	}
1423
}
1424
1425
struct tunnconf *
1426
tunnconf_find(const char *name)
1427
{
1428
	struct tunnconf *tunn;
1429
1430
	TAILQ_FOREACH(tunn, &conf->tunnconfs, entry) {
1431
		if (strcmp(tunn->name, name) == 0)
1432
			return tunn;
1433
	}
1434
1435
	return NULL;
1436
}
1437
1438
void
1439
authconf_init(struct authconf *auth)
1440
{
1441
	memset(auth, 0, sizeof(struct authconf));
1442
	auth->eap_capable = true;
1443
	auth->strip_nt_domain = true;
1444
	auth->strip_atmark_realm = false;
1445
}
1446
1447
void
1448
authconf_fini(struct authconf *auth)
1449
{
1450
	if (auth->username_suffix != NULL)
1451
		free(auth->username_suffix);
1452
	auth->username_suffix = NULL;
1453
1454
	switch (auth->auth_type) {
1455
	case NPPPD_AUTH_TYPE_RADIUS:
1456
		radconf_fini(&auth->data.radius.auth);
1457
		radconf_fini(&auth->data.radius.acct);
1458
		break;
1459
	}
1460
}
1461
1462
void
1463
radconf_fini(struct radconf *radconf)
1464
{
1465
	struct radserver *server, *server0;
1466
1467
	TAILQ_FOREACH_SAFE(server, &radconf->servers, entry, server0) {
1468
		if (server->secret != NULL)
1469
			free(server->secret);
1470
		server->secret = NULL;
1471
	}
1472
}
1473
1474
struct authconf *
1475
authconf_find(const char *name)
1476
{
1477
	struct authconf *auth;
1478
1479
	TAILQ_FOREACH(auth, &conf->authconfs, entry) {
1480
		if (strcmp(auth->name, name) == 0)
1481
			return auth;
1482
	}
1483
1484
	return NULL;
1485
}
1486
1487
void
1488
ipcpconf_init(struct ipcpconf *ipcp)
1489
{
1490
	memset(ipcp, 0, sizeof(struct ipcpconf));
1491
}
1492
1493
void
1494
ipcpconf_fini(struct ipcpconf *ipcp)
1495
{
1496
	if (ipcp->dynamic_pool != NULL)
1497
		in_addr_range_list_remove_all(&ipcp->dynamic_pool);
1498
	if (ipcp->static_pool != NULL)
1499
		in_addr_range_list_remove_all(&ipcp->static_pool);
1500
}
1501
1502
struct ipcpconf *
1503
ipcpconf_find(const char *name)
1504
{
1505
	struct ipcpconf *ipcp;
1506
1507
	TAILQ_FOREACH(ipcp, &conf->ipcpconfs, entry) {
1508
		if (strcmp(ipcp->name, name) == 0)
1509
			return ipcp;
1510
	}
1511
1512
	return NULL;
1513
}
1514
1515
struct iface *
1516
iface_find(const char *name)
1517
{
1518
	struct iface *iface;
1519
1520
	TAILQ_FOREACH(iface, &conf->ifaces, entry) {
1521
		if (strcmp(iface->name, name) == 0)
1522
			return iface;
1523
	}
1524
1525
	return NULL;
1526
}
1527
1528
void
1529
sa_set_in_addr_any(struct sockaddr *sa)
1530
{
1531
	memset(sa, 0, sizeof(struct sockaddr_in));
1532
1533
	sa->sa_family = AF_INET,
1534
	sa->sa_len = sizeof(struct sockaddr_in);
1535
	((struct sockaddr_in *)sa)->sin_addr.s_addr = htonl(INADDR_ANY);
1536
}
1537
#line 1530 "parse.c"
1538
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
1539
static int yygrowstack(void)
1540
{
1541
    unsigned int newsize;
1542
    long sslen;
1543
    short *newss;
1544
    YYSTYPE *newvs;
1545
1546
    if ((newsize = yystacksize) == 0)
1547
        newsize = YYINITSTACKSIZE;
1548
    else if (newsize >= YYMAXDEPTH)
1549
        return -1;
1550
    else if ((newsize *= 2) > YYMAXDEPTH)
1551
        newsize = YYMAXDEPTH;
1552
    sslen = yyssp - yyss;
1553
#ifdef SIZE_MAX
1554
#define YY_SIZE_MAX SIZE_MAX
1555
#else
1556
#define YY_SIZE_MAX 0xffffffffU
1557
#endif
1558
    if (newsize && YY_SIZE_MAX / newsize < sizeof *newss)
1559
        goto bail;
1560
    newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
1561
      (short *)malloc(newsize * sizeof *newss); /* overflow check above */
1562
    if (newss == NULL)
1563
        goto bail;
1564
    yyss = newss;
1565
    yyssp = newss + sslen;
1566
    if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs)
1567
        goto bail;
1568
    newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
1569
      (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
1570
    if (newvs == NULL)
1571
        goto bail;
1572
    yyvs = newvs;
1573
    yyvsp = newvs + sslen;
1574
    yystacksize = newsize;
1575
    yysslim = yyss + newsize - 1;
1576
    return 0;
1577
bail:
1578
    if (yyss)
1579
            free(yyss);
1580
    if (yyvs)
1581
            free(yyvs);
1582
    yyss = yyssp = NULL;
1583
    yyvs = yyvsp = NULL;
1584
    yystacksize = 0;
1585
    return -1;
1586
}
1587
1588
#define YYABORT goto yyabort
1589
#define YYREJECT goto yyabort
1590
#define YYACCEPT goto yyaccept
1591
#define YYERROR goto yyerrlab
1592
int
1593
yyparse(void)
1594
{
1595
    int yym, yyn, yystate;
1596
#if YYDEBUG
1597
    const char *yys;
1598
1599
    if ((yys = getenv("YYDEBUG")))
1600
    {
1601
        yyn = *yys;
1602
        if (yyn >= '0' && yyn <= '9')
1603
            yydebug = yyn - '0';
1604
    }
1605
#endif /* YYDEBUG */
1606
1607
    yynerrs = 0;
1608
    yyerrflag = 0;
1609
    yychar = (-1);
1610
1611
    if (yyss == NULL && yygrowstack()) goto yyoverflow;
1612
    yyssp = yyss;
1613
    yyvsp = yyvs;
1614
    *yyssp = yystate = 0;
1615
1616
yyloop:
1617
    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1618
    if (yychar < 0)
1619
    {
1620
        if ((yychar = yylex()) < 0) yychar = 0;
1621
#if YYDEBUG
1622
        if (yydebug)
1623
        {
1624
            yys = 0;
1625
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1626
            if (!yys) yys = "illegal-symbol";
1627
            printf("%sdebug: state %d, reading %d (%s)\n",
1628
                    YYPREFIX, yystate, yychar, yys);
1629
        }
1630
#endif
1631
    }
1632
    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
1633
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1634
    {
1635
#if YYDEBUG
1636
        if (yydebug)
1637
            printf("%sdebug: state %d, shifting to state %d\n",
1638
                    YYPREFIX, yystate, yytable[yyn]);
1639
#endif
1640
        if (yyssp >= yysslim && yygrowstack())
1641
        {
1642
            goto yyoverflow;
1643
        }
1644
        *++yyssp = yystate = yytable[yyn];
1645
        *++yyvsp = yylval;
1646
        yychar = (-1);
1647
        if (yyerrflag > 0)  --yyerrflag;
1648
        goto yyloop;
1649
    }
1650
    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
1651
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1652
    {
1653
        yyn = yytable[yyn];
1654
        goto yyreduce;
1655
    }
1656
    if (yyerrflag) goto yyinrecovery;
1657
#if defined(__GNUC__)
1658
    goto yynewerror;
1659
#endif
1660
yynewerror:
1661
    yyerror("syntax error");
1662
#if defined(__GNUC__)
1663
    goto yyerrlab;
1664
#endif
1665
yyerrlab:
1666
    ++yynerrs;
1667
yyinrecovery:
1668
    if (yyerrflag < 3)
1669
    {
1670
        yyerrflag = 3;
1671
        for (;;)
1672
        {
1673
            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
1674
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
1675
            {
1676
#if YYDEBUG
1677
                if (yydebug)
1678
                    printf("%sdebug: state %d, error recovery shifting\
1679
 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
1680
#endif
1681
                if (yyssp >= yysslim && yygrowstack())
1682
                {
1683
                    goto yyoverflow;
1684
                }
1685
                *++yyssp = yystate = yytable[yyn];
1686
                *++yyvsp = yylval;
1687
                goto yyloop;
1688
            }
1689
            else
1690
            {
1691
#if YYDEBUG
1692
                if (yydebug)
1693
                    printf("%sdebug: error recovery discarding state %d\n",
1694
                            YYPREFIX, *yyssp);
1695
#endif
1696
                if (yyssp <= yyss) goto yyabort;
1697
                --yyssp;
1698
                --yyvsp;
1699
            }
1700
        }
1701
    }
1702
    else
1703
    {
1704
        if (yychar == 0) goto yyabort;
1705
#if YYDEBUG
1706
        if (yydebug)
1707
        {
1708
            yys = 0;
1709
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1710
            if (!yys) yys = "illegal-symbol";
1711
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1712
                    YYPREFIX, yystate, yychar, yys);
1713
        }
1714
#endif
1715
        yychar = (-1);
1716
        goto yyloop;
1717
    }
1718
yyreduce:
1719
#if YYDEBUG
1720
    if (yydebug)
1721
        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1722
                YYPREFIX, yystate, yyn, yyrule[yyn]);
1723
#endif
1724
    yym = yylen[yyn];
1725
    if (yym)
1726
        yyval = yyvsp[1-yym];
1727
    else
1728
        memset(&yyval, 0, sizeof yyval);
1729
    switch (yyn)
1730
    {
1731
case 9:
1732
#line 169 "parse.y"
1733
{ file->errors++; }
1734
break;
1735
case 10:
1736
#line 173 "parse.y"
1737
{ conf->max_session = yyvsp[0].v.number; }
1738
break;
1739
case 11:
1740
#line 174 "parse.y"
1741
{ conf->user_max_session = yyvsp[0].v.number; }
1742
break;
1743
case 12:
1744
#line 180 "parse.y"
1745
{
1746
			struct tunnconf *n;
1747
1748
			if (tunnconf_find(yyvsp[-2].v.string) != NULL) {
1749
				yyerror("tunnel name = %s is already in use.",
1750
				    yyvsp[-2].v.string);
1751
				free(yyvsp[-2].v.string);
1752
				YYERROR;
1753
			}
1754
1755
			if ((n = malloc(sizeof(struct tunnconf))) == NULL) {
1756
				yyerror("out of memory");
1757
				free(yyvsp[-2].v.string);
1758
				YYERROR;
1759
			}
1760
			tunnconf_init(n, yyvsp[0].v.number);
1761
			switch (yyvsp[0].v.number) {
1762
			case NPPPD_TUNNEL_L2TP:
1763
				strlcpy(n->proto.l2tp.name, yyvsp[-2].v.string,
1764
				    sizeof(n->proto.l2tp.name));
1765
				n->name = n->proto.l2tp.name;
1766
				break;
1767
			case NPPPD_TUNNEL_PPTP:
1768
				strlcpy(n->proto.pptp.name, yyvsp[-2].v.string,
1769
				    sizeof(n->proto.pptp.name));
1770
				n->name = n->proto.pptp.name;
1771
				break;
1772
			case NPPPD_TUNNEL_PPPOE:
1773
				strlcpy(n->proto.pppoe.name, yyvsp[-2].v.string,
1774
				    sizeof(n->proto.pppoe.name));
1775
				n->name = n->proto.pppoe.name;
1776
				break;
1777
			}
1778
			free(yyvsp[-2].v.string);
1779
			n->protocol = yyvsp[0].v.number;
1780
			curr_tunnconf = n;
1781
		}
1782
break;
1783
case 13:
1784
#line 216 "parse.y"
1785
{
1786
			TAILQ_INSERT_TAIL(&conf->tunnconfs, curr_tunnconf,
1787
			    entry);
1788
			switch (curr_tunnconf->protocol) {
1789
#ifdef USE_NPPPD_L2TP
1790
			case NPPPD_TUNNEL_L2TP:
1791
				if (TAILQ_EMPTY(
1792
				    &curr_tunnconf->proto.l2tp.listen)) {
1793
					struct l2tp_listen_addr *addr;
1794
1795
					if ((addr = malloc(sizeof(struct
1796
					    l2tp_listen_addr))) == NULL) {
1797
						free(curr_tunnconf);
1798
						yyerror("out of memory");
1799
						YYERROR;
1800
					}
1801
					sa_set_in_addr_any(
1802
					    (struct sockaddr *)&addr->addr);
1803
					TAILQ_INSERT_TAIL(&curr_tunnconf->proto.
1804
					    l2tp.listen, addr, entry);
1805
				}
1806
				TAILQ_INSERT_TAIL(&conf->l2tp_confs,
1807
				    &curr_tunnconf->proto.l2tp, entry);
1808
				break;
1809
#endif
1810
#ifdef USE_NPPPD_PPTP
1811
			case NPPPD_TUNNEL_PPTP:
1812
				if (TAILQ_EMPTY(
1813
				    &curr_tunnconf->proto.pptp.listen)) {
1814
					struct pptp_listen_addr *addr;
1815
1816
					if ((addr = malloc(sizeof(struct
1817
					    pptp_listen_addr))) == NULL) {
1818
						free(curr_tunnconf);
1819
						yyerror("out of memory");
1820
						YYERROR;
1821
					}
1822
					sa_set_in_addr_any(
1823
					    (struct sockaddr *)&addr->addr);
1824
					TAILQ_INSERT_TAIL(&curr_tunnconf->proto.
1825
					    pptp.listen, addr, entry);
1826
				}
1827
				TAILQ_INSERT_TAIL(&conf->pptp_confs,
1828
				    &curr_tunnconf->proto.pptp, entry);
1829
				break;
1830
#endif
1831
#ifdef USE_NPPPD_PPPOE
1832
			case NPPPD_TUNNEL_PPPOE:
1833
				TAILQ_INSERT_TAIL(&conf->pppoe_confs,
1834
				    &curr_tunnconf->proto.pppoe, entry);
1835
				break;
1836
#endif
1837
			default:
1838
				yyerror("%s is not enabled.",
1839
				    npppd_tunnel_protocol_name(
1840
					    curr_tunnconf->protocol));
1841
				tunnconf_fini(curr_tunnconf);
1842
				free(curr_tunnconf);
1843
				YYERROR;
1844
			}
1845
			curr_tunnconf = NULL;
1846
		}
1847
break;
1848
case 19:
1849
#line 290 "parse.y"
1850
{
1851
1852
			switch (curr_tunnconf->protocol) {
1853
			case NPPPD_TUNNEL_L2TP:
1854
			    {
1855
				struct l2tp_listen_addr	*l_listen;
1856
1857
				if ((l_listen = malloc(sizeof(
1858
				    struct l2tp_listen_addr))) == NULL) {
1859
					yyerror("out of memory");
1860
					YYERROR;
1861
				}
1862
				l_listen->addr = yyvsp[0].v.address;
1863
				TAILQ_INSERT_TAIL(&curr_tunnconf->proto
1864
				    .l2tp.listen, l_listen, entry);
1865
				break;
1866
			    }
1867
			case NPPPD_TUNNEL_PPTP:
1868
				if (yyvsp[0].v.address.ss_family == AF_INET6) {
1869
					yyerror("listen on IPv6 address is not "
1870
					    "supported by pptp tunnel");
1871
					YYERROR;
1872
				}
1873
			    {
1874
				struct pptp_listen_addr	*p_listen;
1875
1876
				if ((p_listen = malloc(sizeof(
1877
				    struct pptp_listen_addr))) == NULL) {
1878
					yyerror("out of memory");
1879
					YYERROR;
1880
				}
1881
				p_listen->addr = yyvsp[0].v.address;
1882
				TAILQ_INSERT_TAIL(&curr_tunnconf->proto
1883
				    .pptp.listen, p_listen, entry);
1884
				break;
1885
			    }
1886
			default:
1887
				yyerror("listen on address is not supported "
1888
				    "for specified protocol.\n");
1889
				YYERROR;
1890
			}
1891
		}
1892
break;
1893
case 20:
1894
#line 332 "parse.y"
1895
{
1896
			switch (curr_tunnconf->protocol) {
1897
			case NPPPD_TUNNEL_PPPOE:
1898
				strlcpy(curr_tunnconf->proto.pppoe.if_name, yyvsp[0].v.string,
1899
				    sizeof(curr_tunnconf->proto.pppoe.if_name));
1900
				free(yyvsp[0].v.string);
1901
				break;
1902
			default:
1903
				free(yyvsp[0].v.string);
1904
				yyerror("listen on interface is not supported "
1905
				    "for specified protocol.\n");
1906
				YYERROR;
1907
			}
1908
		}
1909
break;
1910
case 21:
1911
#line 346 "parse.y"
1912
{
1913
			curr_tunnconf->lcp_timeout = yyvsp[0].v.number;
1914
		}
1915
break;
1916
case 22:
1917
#line 349 "parse.y"
1918
{
1919
			curr_tunnconf->lcp_max_configure = yyvsp[0].v.number;
1920
		}
1921
break;
1922
case 23:
1923
#line 352 "parse.y"
1924
{
1925
			curr_tunnconf->lcp_max_terminate = yyvsp[0].v.number;
1926
		}
1927
break;
1928
case 24:
1929
#line 355 "parse.y"
1930
{
1931
			curr_tunnconf->lcp_max_nak_loop = yyvsp[0].v.number;
1932
		}
1933
break;
1934
case 25:
1935
#line 358 "parse.y"
1936
{
1937
			curr_tunnconf->mru = yyvsp[0].v.number;
1938
		}
1939
break;
1940
case 26:
1941
#line 361 "parse.y"
1942
{
1943
			curr_tunnconf->lcp_keepalive = yyvsp[0].v.yesno;
1944
		}
1945
break;
1946
case 27:
1947
#line 364 "parse.y"
1948
{
1949
			curr_tunnconf->lcp_keepalive_interval = yyvsp[0].v.number;
1950
		}
1951
break;
1952
case 28:
1953
#line 367 "parse.y"
1954
{
1955
			curr_tunnconf->lcp_keepalive_retry_interval = yyvsp[0].v.number;
1956
		}
1957
break;
1958
case 29:
1959
#line 370 "parse.y"
1960
{
1961
			curr_tunnconf->lcp_keepalive_max_retries = yyvsp[0].v.number;
1962
		}
1963
break;
1964
case 30:
1965
#line 373 "parse.y"
1966
{
1967
			curr_tunnconf->auth_methods = yyvsp[0].v.number;
1968
		}
1969
break;
1970
case 31:
1971
#line 376 "parse.y"
1972
{
1973
			curr_tunnconf->chap_name = yyvsp[0].v.string;
1974
		}
1975
break;
1976
case 32:
1977
#line 379 "parse.y"
1978
{
1979
			curr_tunnconf->ipcp_timeout = yyvsp[0].v.number;
1980
		}
1981
break;
1982
case 33:
1983
#line 382 "parse.y"
1984
{
1985
			curr_tunnconf->ipcp_max_configure = yyvsp[0].v.number;
1986
		}
1987
break;
1988
case 34:
1989
#line 385 "parse.y"
1990
{
1991
			curr_tunnconf->ipcp_max_terminate = yyvsp[0].v.number;
1992
		}
1993
break;
1994
case 35:
1995
#line 388 "parse.y"
1996
{
1997
			curr_tunnconf->ipcp_max_nak_loop = yyvsp[0].v.number;
1998
		}
1999
break;
2000
case 36:
2001
#line 391 "parse.y"
2002
{
2003
			curr_tunnconf->ccp_timeout = yyvsp[0].v.number;
2004
		}
2005
break;
2006
case 37:
2007
#line 394 "parse.y"
2008
{
2009
			curr_tunnconf->ccp_max_configure = yyvsp[0].v.number;
2010
		}
2011
break;
2012
case 38:
2013
#line 397 "parse.y"
2014
{
2015
			curr_tunnconf->ccp_max_terminate = yyvsp[0].v.number;
2016
		}
2017
break;
2018
case 39:
2019
#line 400 "parse.y"
2020
{
2021
			curr_tunnconf->ccp_max_nak_loop = yyvsp[0].v.number;
2022
		}
2023
break;
2024
case 40:
2025
#line 403 "parse.y"
2026
{
2027
			curr_tunnconf->proto.l2tp.hostname = yyvsp[0].v.string;
2028
		}
2029
break;
2030
case 41:
2031
#line 406 "parse.y"
2032
{
2033
			curr_tunnconf->proto.l2tp.vendor_name = yyvsp[0].v.string;
2034
		}
2035
break;
2036
case 42:
2037
#line 409 "parse.y"
2038
{
2039
			curr_tunnconf->proto.l2tp.hello_interval = yyvsp[0].v.number;
2040
		}
2041
break;
2042
case 43:
2043
#line 412 "parse.y"
2044
{
2045
			curr_tunnconf->proto.l2tp.hello_timeout = yyvsp[0].v.number;
2046
		}
2047
break;
2048
case 44:
2049
#line 415 "parse.y"
2050
{
2051
			curr_tunnconf->proto.l2tp.accept_dialin = yyvsp[0].v.yesno;
2052
		}
2053
break;
2054
case 45:
2055
#line 418 "parse.y"
2056
{
2057
			curr_tunnconf->proto.l2tp.data_use_seq = yyvsp[0].v.yesno;
2058
		}
2059
break;
2060
case 46:
2061
#line 421 "parse.y"
2062
{
2063
			curr_tunnconf->proto.l2tp.require_ipsec = yyvsp[0].v.yesno;
2064
		}
2065
break;
2066
case 47:
2067
#line 424 "parse.y"
2068
{
2069
			curr_tunnconf->proto.l2tp.lcp_renegotiation = yyvsp[0].v.yesno;
2070
		}
2071
break;
2072
case 48:
2073
#line 427 "parse.y"
2074
{
2075
			curr_tunnconf->proto.l2tp.force_lcp_renegotiation = yyvsp[0].v.yesno;
2076
		}
2077
break;
2078
case 49:
2079
#line 430 "parse.y"
2080
{
2081
			curr_tunnconf->proto.l2tp.ctrl_in_pktdump = yyvsp[0].v.yesno;
2082
		}
2083
break;
2084
case 50:
2085
#line 433 "parse.y"
2086
{
2087
			curr_tunnconf->proto.l2tp.ctrl_out_pktdump = yyvsp[0].v.yesno;
2088
		}
2089
break;
2090
case 51:
2091
#line 436 "parse.y"
2092
{
2093
			curr_tunnconf->proto.l2tp.data_in_pktdump = yyvsp[0].v.yesno;
2094
		}
2095
break;
2096
case 52:
2097
#line 439 "parse.y"
2098
{
2099
			curr_tunnconf->proto.l2tp.data_out_pktdump = yyvsp[0].v.yesno;
2100
		}
2101
break;
2102
case 53:
2103
#line 442 "parse.y"
2104
{
2105
			curr_tunnconf->proto.pptp.hostname = yyvsp[0].v.string;
2106
		}
2107
break;
2108
case 54:
2109
#line 445 "parse.y"
2110
{
2111
			curr_tunnconf->proto.pptp.vendor_name = yyvsp[0].v.string;
2112
		}
2113
break;
2114
case 55:
2115
#line 448 "parse.y"
2116
{
2117
			curr_tunnconf->proto.pptp.echo_interval = yyvsp[0].v.number;
2118
		}
2119
break;
2120
case 56:
2121
#line 451 "parse.y"
2122
{
2123
			curr_tunnconf->proto.pptp.echo_timeout = yyvsp[0].v.number;
2124
		}
2125
break;
2126
case 57:
2127
#line 454 "parse.y"
2128
{
2129
			curr_tunnconf->proto.pptp.ctrl_in_pktdump = yyvsp[0].v.yesno;
2130
		}
2131
break;
2132
case 58:
2133
#line 457 "parse.y"
2134
{
2135
			curr_tunnconf->proto.pptp.ctrl_out_pktdump = yyvsp[0].v.yesno;
2136
		}
2137
break;
2138
case 59:
2139
#line 460 "parse.y"
2140
{
2141
			curr_tunnconf->proto.pptp.data_in_pktdump = yyvsp[0].v.yesno;
2142
		}
2143
break;
2144
case 60:
2145
#line 463 "parse.y"
2146
{
2147
			curr_tunnconf->proto.pptp.data_out_pktdump = yyvsp[0].v.yesno;
2148
		}
2149
break;
2150
case 61:
2151
#line 466 "parse.y"
2152
{
2153
			curr_tunnconf->proto.pppoe.service_name = yyvsp[0].v.string;
2154
		}
2155
break;
2156
case 62:
2157
#line 469 "parse.y"
2158
{
2159
			curr_tunnconf->proto.pppoe.accept_any_service = yyvsp[0].v.yesno;
2160
		}
2161
break;
2162
case 63:
2163
#line 472 "parse.y"
2164
{
2165
			curr_tunnconf->proto.pppoe.ac_name = yyvsp[0].v.string;
2166
		}
2167
break;
2168
case 64:
2169
#line 475 "parse.y"
2170
{
2171
			curr_tunnconf->proto.pppoe.desc_in_pktdump = yyvsp[0].v.yesno;
2172
		}
2173
break;
2174
case 65:
2175
#line 478 "parse.y"
2176
{
2177
			curr_tunnconf->proto.pppoe.desc_out_pktdump = yyvsp[0].v.yesno;
2178
		}
2179
break;
2180
case 66:
2181
#line 481 "parse.y"
2182
{
2183
			curr_tunnconf->proto.pppoe.session_in_pktdump = yyvsp[0].v.yesno;
2184
		}
2185
break;
2186
case 67:
2187
#line 484 "parse.y"
2188
{
2189
			curr_tunnconf->proto.pppoe.session_out_pktdump = yyvsp[0].v.yesno;
2190
		}
2191
break;
2192
case 68:
2193
#line 487 "parse.y"
2194
{
2195
			curr_tunnconf->mppe_yesno = yyvsp[0].v.number;
2196
		}
2197
break;
2198
case 69:
2199
#line 490 "parse.y"
2200
{
2201
			curr_tunnconf->mppe_keylen = yyvsp[0].v.number;
2202
		}
2203
break;
2204
case 70:
2205
#line 493 "parse.y"
2206
{
2207
			curr_tunnconf->mppe_keystate = yyvsp[0].v.number;
2208
		}
2209
break;
2210
case 71:
2211
#line 496 "parse.y"
2212
{
2213
			curr_tunnconf->tcp_mss_adjust = yyvsp[0].v.yesno;
2214
		}
2215
break;
2216
case 72:
2217
#line 499 "parse.y"
2218
{
2219
			curr_tunnconf->idle_timeout = yyvsp[0].v.number;
2220
		}
2221
break;
2222
case 73:
2223
#line 502 "parse.y"
2224
{
2225
			curr_tunnconf->ingress_filter = yyvsp[0].v.yesno;
2226
		}
2227
break;
2228
case 74:
2229
#line 505 "parse.y"
2230
{
2231
			curr_tunnconf->callnum_check = yyvsp[0].v.yesno;
2232
		}
2233
break;
2234
case 75:
2235
#line 508 "parse.y"
2236
{
2237
			curr_tunnconf->pipex = yyvsp[0].v.yesno;
2238
		}
2239
break;
2240
case 76:
2241
#line 511 "parse.y"
2242
{
2243
			curr_tunnconf->debug_dump_pktin = yyvsp[0].v.number;
2244
		}
2245
break;
2246
case 77:
2247
#line 514 "parse.y"
2248
{
2249
			curr_tunnconf->debug_dump_pktout = yyvsp[0].v.number;
2250
		}
2251
break;
2252
case 78:
2253
#line 519 "parse.y"
2254
{ yyval.v.number = NPPPD_TUNNEL_L2TP; }
2255
break;
2256
case 79:
2257
#line 520 "parse.y"
2258
{ yyval.v.number = NPPPD_TUNNEL_PPTP; }
2259
break;
2260
case 80:
2261
#line 521 "parse.y"
2262
{ yyval.v.number = NPPPD_TUNNEL_PPPOE; }
2263
break;
2264
case 81:
2265
#line 524 "parse.y"
2266
{ yyval.v.number = NPPPD_MPPE_ENABLED; }
2267
break;
2268
case 82:
2269
#line 525 "parse.y"
2270
{ yyval.v.number = NPPPD_MPPE_DISABLED; }
2271
break;
2272
case 83:
2273
#line 526 "parse.y"
2274
{ yyval.v.number = NPPPD_MPPE_REQUIRED; }
2275
break;
2276
case 84:
2277
#line 529 "parse.y"
2278
{
2279
			int              retval;
2280
			struct addrinfo  hint, *res;
2281
2282
			memset(&hint, 0, sizeof(hint));
2283
			hint.ai_family = PF_UNSPEC;
2284
			hint.ai_socktype = SOCK_DGRAM;	/* dummy */
2285
			hint.ai_flags = AI_NUMERICHOST;
2286
2287
			if ((retval = getaddrinfo(yyvsp[0].v.string, NULL, &hint, &res))
2288
			    != 0) {
2289
				yyerror("could not parse the address %s: %s",
2290
				    yyvsp[0].v.string, gai_strerror(retval));
2291
				free(yyvsp[0].v.string);
2292
				YYERROR;
2293
			}
2294
			free(yyvsp[0].v.string);
2295
2296
			if (res->ai_family != AF_INET &&
2297
			    res->ai_family != AF_INET6) {
2298
				yyerror("address family(%d) is not supported",
2299
				    res->ai_family);
2300
				freeaddrinfo(res);
2301
				YYERROR;
2302
			}
2303
			memcpy(&(yyval.v.address), res->ai_addr, res->ai_addrlen);
2304
2305
			freeaddrinfo(res);
2306
		}
2307
break;
2308
case 85:
2309
#line 560 "parse.y"
2310
{
2311
			yyval.v.address = yyvsp[-1].v.address;
2312
			((struct sockaddr_in *)&(yyval.v.address))->sin_port = htons(yyvsp[0].v.number);
2313
		}
2314
break;
2315
case 86:
2316
#line 566 "parse.y"
2317
{
2318
			if (inet_aton(yyvsp[0].v.string, &(yyval.v.in4_addr)) != 1) {
2319
				yyerror("could not parse the address %s", yyvsp[0].v.string);
2320
				free(yyvsp[0].v.string);
2321
				YYERROR;
2322
			}
2323
		}
2324
break;
2325
case 87:
2326
#line 575 "parse.y"
2327
{ yyval.v.number = yyvsp[0].v.number; }
2328
break;
2329
case 88:
2330
#line 576 "parse.y"
2331
{ yyval.v.number |= yyvsp[0].v.number; }
2332
break;
2333
case 89:
2334
#line 579 "parse.y"
2335
{ yyval.v.number = NPPPD_AUTH_METHODS_PAP; }
2336
break;
2337
case 90:
2338
#line 580 "parse.y"
2339
{ yyval.v.number = NPPPD_AUTH_METHODS_CHAP; }
2340
break;
2341
case 91:
2342
#line 581 "parse.y"
2343
{
2344
		    yyval.v.number = NPPPD_AUTH_METHODS_MSCHAPV2;
2345
		}
2346
break;
2347
case 92:
2348
#line 586 "parse.y"
2349
{ yyval.v.number = yyvsp[0].v.number; }
2350
break;
2351
case 93:
2352
#line 587 "parse.y"
2353
{ yyval.v.number |= yyvsp[0].v.number; }
2354
break;
2355
case 94:
2356
#line 590 "parse.y"
2357
{
2358
			if (yyvsp[0].v.number == 40)       yyval.v.number = NPPPD_MPPE_40BIT;
2359
			else if (yyvsp[0].v.number == 56)  yyval.v.number = NPPPD_MPPE_56BIT;
2360
			else if (yyvsp[0].v.number == 128) yyval.v.number = NPPPD_MPPE_128BIT;
2361
			else {
2362
				yyerror("%"PRId64": unknown mppe key length",
2363
				    yyval.v.number);
2364
				YYERROR;
2365
			}
2366
		}
2367
break;
2368
case 95:
2369
#line 602 "parse.y"
2370
{ yyval.v.number = yyvsp[0].v.number; }
2371
break;
2372
case 96:
2373
#line 603 "parse.y"
2374
{ yyval.v.number |= yyvsp[0].v.number; }
2375
break;
2376
case 97:
2377
#line 606 "parse.y"
2378
{ yyval.v.number = NPPPD_MPPE_STATEFUL; }
2379
break;
2380
case 98:
2381
#line 607 "parse.y"
2382
{ yyval.v.number = NPPPD_MPPE_STATELESS; }
2383
break;
2384
case 99:
2385
#line 610 "parse.y"
2386
{ yyval.v.number = yyvsp[0].v.number; }
2387
break;
2388
case 100:
2389
#line 611 "parse.y"
2390
{ yyval.v.number |= yyvsp[0].v.number; }
2391
break;
2392
case 101:
2393
#line 614 "parse.y"
2394
{ yyval.v.number = NPPPD_PROTO_BIT_IP; }
2395
break;
2396
case 102:
2397
#line 615 "parse.y"
2398
{ yyval.v.number = NPPPD_PROTO_BIT_LCP; }
2399
break;
2400
case 103:
2401
#line 616 "parse.y"
2402
{ yyval.v.number = NPPPD_PROTO_BIT_PAP; }
2403
break;
2404
case 104:
2405
#line 617 "parse.y"
2406
{ yyval.v.number = NPPPD_PROTO_BIT_CHAP; }
2407
break;
2408
case 105:
2409
#line 618 "parse.y"
2410
{ yyval.v.number = NPPPD_PROTO_BIT_EAP; }
2411
break;
2412
case 106:
2413
#line 619 "parse.y"
2414
{ yyval.v.number = NPPPD_PROTO_BIT_MPPE; }
2415
break;
2416
case 107:
2417
#line 620 "parse.y"
2418
{ yyval.v.number = NPPPD_PROTO_BIT_CCP; }
2419
break;
2420
case 108:
2421
#line 621 "parse.y"
2422
{ yyval.v.number = NPPPD_PROTO_BIT_IPCP; }
2423
break;
2424
case 109:
2425
#line 627 "parse.y"
2426
{
2427
			struct authconf *n;
2428
2429
			if (authconf_find(yyvsp[-2].v.string) != NULL) {
2430
				yyerror("authentication name %s is already in "
2431
				    "use.", yyvsp[-2].v.string);
2432
				free(yyvsp[-2].v.string);
2433
				YYERROR;
2434
			}
2435
			if ((n = malloc(sizeof(struct authconf))) == NULL) {
2436
				yyerror("out of memory");
2437
				free(yyvsp[-2].v.string);
2438
				YYERROR;
2439
			}
2440
			authconf_init(n);
2441
			strlcpy(n->name, yyvsp[-2].v.string, sizeof(n->name));
2442
			free(yyvsp[-2].v.string);
2443
			n->auth_type = yyvsp[0].v.number;
2444
			if (yyvsp[0].v.number == NPPPD_AUTH_TYPE_RADIUS) {
2445
				TAILQ_INIT(&n->data.radius.auth.servers);
2446
				TAILQ_INIT(&n->data.radius.acct.servers);
2447
			}
2448
			curr_authconf = n;
2449
		}
2450
break;
2451
case 110:
2452
#line 650 "parse.y"
2453
{
2454
			TAILQ_INSERT_TAIL(&conf->authconfs, curr_authconf,
2455
			    entry);
2456
			curr_authconf = NULL;
2457
		}
2458
break;
2459
case 114:
2460
#line 662 "parse.y"
2461
{
2462
			curr_authconf->username_suffix = yyvsp[0].v.string;
2463
		}
2464
break;
2465
case 115:
2466
#line 665 "parse.y"
2467
{
2468
			curr_authconf->eap_capable = yyvsp[0].v.yesno;
2469
		}
2470
break;
2471
case 116:
2472
#line 668 "parse.y"
2473
{
2474
			curr_authconf->strip_nt_domain = yyvsp[0].v.yesno;
2475
		}
2476
break;
2477
case 117:
2478
#line 671 "parse.y"
2479
{
2480
			curr_authconf->strip_atmark_realm = yyvsp[0].v.yesno;
2481
		}
2482
break;
2483
case 118:
2484
#line 674 "parse.y"
2485
{
2486
			strlcpy(curr_authconf->users_file_path, yyvsp[0].v.string,
2487
			    sizeof(curr_authconf->users_file_path));
2488
			free(yyvsp[0].v.string);
2489
		}
2490
break;
2491
case 119:
2492
#line 679 "parse.y"
2493
{
2494
			curr_authconf->user_max_session = yyvsp[0].v.number;
2495
		}
2496
break;
2497
case 120:
2498
#line 682 "parse.y"
2499
{
2500
			if (curr_authconf->auth_type != NPPPD_AUTH_TYPE_RADIUS){
2501
				yyerror("`authentication-server' can not be "
2502
				    "used for this type.");
2503
				YYERROR;
2504
			}
2505
			curr_radconf = &curr_authconf->data.radius.auth;
2506
		}
2507
break;
2508
case 122:
2509
#line 690 "parse.y"
2510
{
2511
			if (curr_authconf->auth_type != NPPPD_AUTH_TYPE_RADIUS){
2512
				yyerror("`accounting-server' can not be used "
2513
				    "for this type.");
2514
				YYERROR;
2515
			}
2516
			curr_radconf = &curr_authconf->data.radius.acct;
2517
		}
2518
break;
2519
case 124:
2520
#line 700 "parse.y"
2521
{ yyval.v.number = 0; }
2522
break;
2523
case 125:
2524
#line 701 "parse.y"
2525
{ yyval.v.number = yyvsp[0].v.number; }
2526
break;
2527
case 126:
2528
#line 704 "parse.y"
2529
{ yyval.v.number = NPPPD_AUTH_TYPE_LOCAL; }
2530
break;
2531
case 127:
2532
#line 705 "parse.y"
2533
{ yyval.v.number = NPPPD_AUTH_TYPE_RADIUS; }
2534
break;
2535
case 131:
2536
#line 713 "parse.y"
2537
{
2538
			int               cnt;
2539
			struct radserver *n;
2540
2541
			if (strlen(yyvsp[0].v.string) > MAX_RADIUS_SECRET - 1) {
2542
				yyerror("`secret' is too long.  "
2543
				    "use less than %d chars.",
2544
				    MAX_RADIUS_SECRET - 1);
2545
				YYERROR;
2546
			}
2547
			cnt = 0;
2548
			TAILQ_FOREACH(n, &curr_radconf->servers, entry) {
2549
				cnt++;
2550
			}
2551
			if (cnt >= MAX_RADIUS_SERVERS) {
2552
				yyerror("too many radius servers.  use less "
2553
				    "than or equal to %d servers.",
2554
				    MAX_RADIUS_SERVERS);
2555
				YYERROR;
2556
			}
2557
			if ((n = malloc(sizeof(struct radserver))) == NULL) {
2558
				yyerror("out of memory");
2559
				YYERROR;
2560
			}
2561
			n->address = yyvsp[-3].v.address;
2562
			((struct sockaddr_in *)&n->address)->sin_port =
2563
			    htons(yyvsp[-2].v.number);
2564
			n->secret = yyvsp[0].v.string;
2565
			TAILQ_INSERT_TAIL(&curr_radconf->servers, n, entry);
2566
		}
2567
break;
2568
case 132:
2569
#line 743 "parse.y"
2570
{
2571
			curr_radconf->timeout = yyvsp[0].v.number;
2572
		}
2573
break;
2574
case 133:
2575
#line 746 "parse.y"
2576
{
2577
			curr_radconf->max_tries = yyvsp[0].v.number;
2578
		}
2579
break;
2580
case 134:
2581
#line 749 "parse.y"
2582
{
2583
			curr_radconf->max_failovers = yyvsp[0].v.number;
2584
		}
2585
break;
2586
case 135:
2587
#line 756 "parse.y"
2588
{
2589
			int              cnt;
2590
			struct ipcpconf *n;
2591
2592
			cnt = 0;
2593
			/*
2594
			TAILQ_FOREACH(n, &conf->ipcpconfs, entry) {
2595
				cnt++;
2596
			}
2597
			if (cnt >= NPPPD_MAX_POOL) {
2598
				yyerror("too many `ipcp' settings.  it must be "
2599
				    "less than or euals to %d.",
2600
				    NPPPD_MAX_POOL);
2601
				YYERROR;
2602
			}
2603
			*/
2604
2605
			if (ipcpconf_find(yyvsp[0].v.string) != NULL) {
2606
				yyerror("ipcp name %s is already in use.", yyvsp[0].v.string);
2607
				free(yyvsp[0].v.string);
2608
				YYERROR;
2609
			}
2610
			if ((n = malloc(sizeof(struct ipcpconf))) == NULL) {
2611
				yyerror("out of memory");
2612
				free(yyvsp[0].v.string);
2613
				YYERROR;
2614
			}
2615
			ipcpconf_init(n);
2616
			strlcpy(n->name, yyvsp[0].v.string, sizeof(n->name));
2617
			free(yyvsp[0].v.string);
2618
			curr_ipcpconf = n;
2619
		}
2620
break;
2621
case 136:
2622
#line 787 "parse.y"
2623
{
2624
			TAILQ_INSERT_TAIL(&conf->ipcpconfs, curr_ipcpconf,
2625
			    entry);
2626
			curr_ipcpconf = NULL;
2627
		}
2628
break;
2629
case 140:
2630
#line 799 "parse.y"
2631
{
2632
			if (yyvsp[0].v.number != 1) {
2633
				if (in_addr_range_list_add(
2634
				    &curr_ipcpconf->dynamic_pool, yyvsp[-1].v.string) != 0) {
2635
					yyerror("out of memory");
2636
					free(yyvsp[-1].v.string);
2637
					YYERROR;
2638
				}
2639
			}
2640
			if (in_addr_range_list_add(
2641
			    &curr_ipcpconf->static_pool, yyvsp[-1].v.string) != 0) {
2642
				yyerror("out of memory");
2643
				free(yyvsp[-1].v.string);
2644
				YYERROR;
2645
			}
2646
			free(yyvsp[-1].v.string);
2647
		}
2648
break;
2649
case 141:
2650
#line 816 "parse.y"
2651
{
2652
			curr_ipcpconf->dns_use_resolver = true;
2653
			curr_ipcpconf->dns_servers[0].s_addr = 0;
2654
			curr_ipcpconf->dns_servers[1].s_addr = 0;
2655
		}
2656
break;
2657
case 142:
2658
#line 821 "parse.y"
2659
{
2660
			curr_ipcpconf->dns_use_resolver  = false;
2661
			curr_ipcpconf->dns_servers[0] = yyvsp[-1].v.in4_addr;
2662
			curr_ipcpconf->dns_servers[1] = yyvsp[0].v.in4_addr;
2663
		}
2664
break;
2665
case 143:
2666
#line 826 "parse.y"
2667
{
2668
			curr_ipcpconf->dns_use_resolver  = false;
2669
			curr_ipcpconf->dns_servers[0] = yyvsp[0].v.in4_addr;
2670
			curr_ipcpconf->dns_servers[1].s_addr = 0;
2671
		}
2672
break;
2673
case 144:
2674
#line 831 "parse.y"
2675
{
2676
			curr_ipcpconf->nbns_servers[0] = yyvsp[-1].v.in4_addr;
2677
			curr_ipcpconf->nbns_servers[1] = yyvsp[0].v.in4_addr;
2678
		}
2679
break;
2680
case 145:
2681
#line 835 "parse.y"
2682
{
2683
			curr_ipcpconf->nbns_servers[0] = yyvsp[0].v.in4_addr;
2684
			curr_ipcpconf->nbns_servers[1].s_addr = 0;
2685
		}
2686
break;
2687
case 146:
2688
#line 839 "parse.y"
2689
{
2690
			curr_ipcpconf->allow_user_select = yyvsp[0].v.yesno;
2691
		}
2692
break;
2693
case 147:
2694
#line 842 "parse.y"
2695
{
2696
			curr_ipcpconf->max_session = yyvsp[0].v.number;
2697
		}
2698
break;
2699
case 148:
2700
#line 847 "parse.y"
2701
{ yyval.v.number = 0; }
2702
break;
2703
case 149:
2704
#line 848 "parse.y"
2705
{ yyval.v.number = 0; }
2706
break;
2707
case 150:
2708
#line 849 "parse.y"
2709
{ yyval.v.number = 1; }
2710
break;
2711
case 151:
2712
#line 856 "parse.y"
2713
{
2714
			int              cnt;
2715
			struct iface    *n;
2716
			struct ipcpconf *ipcp;
2717
2718
			cnt = 0;
2719
			TAILQ_FOREACH(n, &conf->ifaces, entry) {
2720
				cnt++;
2721
			}
2722
			if (cnt >= NPPPD_MAX_IFACE) {
2723
				yyerror("too many interfaces.  use less than "
2724
				    "or equal to %d", NPPPD_MAX_IFACE);
2725
				YYERROR;
2726
			}
2727
2728
			if ((ipcp = ipcpconf_find(yyvsp[0].v.string)) == NULL) {
2729
				yyerror("ipcp %s is not found", yyvsp[0].v.string);
2730
				free(yyvsp[-4].v.string);
2731
				YYERROR;
2732
			}
2733
			if (iface_find(yyvsp[-4].v.string) != NULL) {
2734
				yyerror("interface %s is already in used.", yyvsp[-4].v.string);
2735
				free(yyvsp[-4].v.string);
2736
				YYERROR;
2737
			}
2738
2739
			if ((n = calloc(1, sizeof(struct iface))) == NULL) {
2740
				yyerror("out of memory");
2741
				free(yyvsp[-4].v.string);
2742
				YYERROR;
2743
			}
2744
			strlcpy(n->name, yyvsp[-4].v.string, sizeof(n->name));
2745
			free(yyvsp[-4].v.string);
2746
			n->ip4addr = yyvsp[-2].v.in4_addr;
2747
			if (strncmp(n->name, "pppx", 4) == 0)
2748
				n->is_pppx = true;
2749
2750
			n->ipcpconf = ipcp;
2751
			TAILQ_INSERT_TAIL(&conf->ifaces, n, entry);
2752
		}
2753
break;
2754
case 152:
2755
#line 901 "parse.y"
2756
{
2757
			struct authconf  *auth;
2758
			struct tunnconf  *tunn;
2759
			struct iface     *iface;
2760
			struct confbind  *n;
2761
2762
			if ((tunn = tunnconf_find(yyvsp[-5].v.string)) == NULL) {
2763
				yyerror("tunnel %s is not found", yyvsp[-5].v.string);
2764
				free(yyvsp[-5].v.string);
2765
				free(yyvsp[-2].v.string);
2766
				free(yyvsp[0].v.string);
2767
				YYERROR;
2768
			}
2769
			if ((auth = authconf_find(yyvsp[-2].v.string)) == NULL) {
2770
				yyerror("authentication %s is not found", yyvsp[-2].v.string);
2771
				free(yyvsp[-5].v.string);
2772
				free(yyvsp[-2].v.string);
2773
				free(yyvsp[0].v.string);
2774
				YYERROR;
2775
			}
2776
			if ((iface = iface_find(yyvsp[0].v.string)) == NULL) {
2777
				yyerror("interface %s is not found", yyvsp[0].v.string);
2778
				free(yyvsp[-5].v.string);
2779
				free(yyvsp[-2].v.string);
2780
				free(yyvsp[0].v.string);
2781
				YYERROR;
2782
			}
2783
			if ((n = malloc(sizeof(struct confbind))) == NULL) {
2784
				yyerror("out of memory");
2785
				free(yyvsp[-5].v.string);
2786
				free(yyvsp[-2].v.string);
2787
				free(yyvsp[0].v.string);
2788
				YYERROR;
2789
			}
2790
			n->tunnconf = tunn;
2791
			n->authconf = auth;
2792
			n->iface = iface;
2793
			TAILQ_INSERT_TAIL(&conf->confbinds, n, entry);
2794
		}
2795
break;
2796
case 153:
2797
#line 942 "parse.y"
2798
{ yyval.v.yesno = true; }
2799
break;
2800
case 154:
2801
#line 943 "parse.y"
2802
{ yyval.v.yesno = false; }
2803
break;
2804
#line 2797 "parse.c"
2805
    }
2806
    yyssp -= yym;
2807
    yystate = *yyssp;
2808
    yyvsp -= yym;
2809
    yym = yylhs[yyn];
2810
    if (yystate == 0 && yym == 0)
2811
    {
2812
#if YYDEBUG
2813
        if (yydebug)
2814
            printf("%sdebug: after reduction, shifting from state 0 to\
2815
 state %d\n", YYPREFIX, YYFINAL);
2816
#endif
2817
        yystate = YYFINAL;
2818
        *++yyssp = YYFINAL;
2819
        *++yyvsp = yyval;
2820
        if (yychar < 0)
2821
        {
2822
            if ((yychar = yylex()) < 0) yychar = 0;
2823
#if YYDEBUG
2824
            if (yydebug)
2825
            {
2826
                yys = 0;
2827
                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
2828
                if (!yys) yys = "illegal-symbol";
2829
                printf("%sdebug: state %d, reading %d (%s)\n",
2830
                        YYPREFIX, YYFINAL, yychar, yys);
2831
            }
2832
#endif
2833
        }
2834
        if (yychar == 0) goto yyaccept;
2835
        goto yyloop;
2836
    }
2837
    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
2838
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
2839
        yystate = yytable[yyn];
2840
    else
2841
        yystate = yydgoto[yym];
2842
#if YYDEBUG
2843
    if (yydebug)
2844
        printf("%sdebug: after reduction, shifting from state %d \
2845
to state %d\n", YYPREFIX, *yyssp, yystate);
2846
#endif
2847
    if (yyssp >= yysslim && yygrowstack())
2848
    {
2849
        goto yyoverflow;
2850
    }
2851
    *++yyssp = yystate;
2852
    *++yyvsp = yyval;
2853
    goto yyloop;
2854
yyoverflow:
2855
    yyerror("yacc stack overflow");
2856
yyabort:
2857
    if (yyss)
2858
            free(yyss);
2859
    if (yyvs)
2860
            free(yyvs);
2861
    yyss = yyssp = NULL;
2862
    yyvs = yyvsp = NULL;
2863
    yystacksize = 0;
2864
    return (1);
2865
yyaccept:
2866
    if (yyss)
2867
            free(yyss);
2868
    if (yyvs)
2869
            free(yyvs);
2870
    yyss = yyssp = NULL;
2871
    yyvs = yyvsp = NULL;
2872
    yystacksize = 0;
2873
    return (0);
2874
}