Bug Summary

File:src/usr.sbin/hostapd/obj/parse.c
Warning:line 1437, column 13
Attempt to free released memory

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name parse.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/usr.sbin/hostapd/obj -resource-dir /usr/local/lib/clang/13.0.0 -I /usr/src/usr.sbin/hostapd -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/usr.sbin/hostapd/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c parse.c
1#include <stdlib.h>
2#include <string.h>
3#define YYBYACC1 1
4#define YYMAJOR1 1
5#define YYMINOR9 9
6#define YYLEXyylex() yylex()
7#define YYEMPTY-1 -1
8#define yyclearin(yychar=(-1)) (yychar=(YYEMPTY-1))
9#define yyerrok(yyerrflag=0) (yyerrflag=0)
10#define YYRECOVERING()(yyerrflag!=0) (yyerrflag!=0)
11#define YYPREFIX"yy" "yy"
12#line 24 "/usr/src/usr.sbin/hostapd/parse.y"
13#include <sys/ioctl.h>
14#include <sys/types.h>
15#include <sys/socket.h>
16#include <sys/time.h>
17#include <sys/queue.h>
18#include <sys/stat.h>
19
20#include <net/if.h>
21#include <net/if_media.h>
22#include <net/if_arp.h>
23#include <net/if_llc.h>
24#include <net/bpf.h>
25
26#include <netinet/in.h>
27#include <netinet/if_ether.h>
28#include <arpa/inet.h>
29
30#include <net80211/ieee80211.h>
31#include <net80211/ieee80211_radiotap.h>
32
33#include <ctype.h>
34#include <errno(*__errno()).h>
35#include <event.h>
36#include <fcntl.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <stdarg.h>
40#include <string.h>
41#include <unistd.h>
42#include <limits.h>
43#include <stdint.h>
44#include <err.h>
45
46#include "hostapd.h"
47
48TAILQ_HEAD(files, file)struct files { struct file *tqh_first; struct file **tqh_last
; }
files = TAILQ_HEAD_INITIALIZER(files){ ((void *)0), &(files).tqh_first };
49static struct file {
50 TAILQ_ENTRY(file)struct { struct file *tqe_next; struct file **tqe_prev; } entry;
51 FILE *stream;
52 char *name;
53 size_t ungetpos;
54 size_t ungetsize;
55 u_char *ungetbuf;
56 int eof_reached;
57 int lineno;
58 int errors;
59} *file, *topfile;
60struct file *pushfile(const char *, int);
61int popfile(void);
62int check_file_secrecy(int, const char *);
63int yyparse(void);
64int yylex(void);
65int yyerror(const char *, ...)
66 __attribute__((__format__ (printf, 1, 2)))
67 __attribute__((__nonnull__ (1)));
68int kw_cmp(const void *, const void *);
69int lookup(char *);
70int igetc(void);
71int lgetc(int);
72void lungetc(int);
73int findeol(void);
74
75TAILQ_HEAD(symhead, sym)struct symhead { struct sym *tqh_first; struct sym **tqh_last
; }
symhead = TAILQ_HEAD_INITIALIZER(symhead){ ((void *)0), &(symhead).tqh_first };
76struct sym {
77 TAILQ_ENTRY(sym)struct { struct sym *tqe_next; struct sym **tqe_prev; } entry;
78 int used;
79 int persist;
80 char *nam;
81 char *val;
82};
83int symset(const char *, const char *, int);
84char *symget(const char *);
85
86extern struct hostapd_config hostapd_cfg;
87
88typedef struct {
89 union {
90 struct {
91 u_int8_t lladdr[IEEE80211_ADDR_LEN6];
92 struct hostapd_table *table;
93 u_int32_t flags;
94 } reflladdr;
95 struct {
96 u_int16_t alg;
97 u_int16_t transaction;
98 } authalg;
99 struct in_addr in;
100 char *string;
101 int64_t number;
102 u_int16_t reason;
103 enum hostapd_op op;
104 struct timeval timeout;
105 } v;
106 int lineno;
107} YYSTYPE;
108
109struct hostapd_apme *apme;
110struct hostapd_table *table;
111struct hostapd_entry *entry;
112struct hostapd_frame frame, *frame_ptr;
113struct hostapd_ieee80211_frame *frame_ieee80211;
114
115#define HOSTAPD_MATCH(_m, _not){ frame.f_flags |= (_not) ? HOSTAPD_FRAME_F__m_N : HOSTAPD_FRAME_F__m
; }
{ \
116 frame.f_flags |= (_not) ? \
117 HOSTAPD_FRAME_F_##_m##_N0x04 : HOSTAPD_FRAME_F_##_m; \
118}
119#define HOSTAPD_MATCH_TABLE(_m, _not){ frame.f_flags |= HOSTAPD_FRAME_F__m_TABLE | ((_not) ? HOSTAPD_FRAME_F__m_N
: HOSTAPD_FRAME_F__m); }
{ \
120 frame.f_flags |= HOSTAPD_FRAME_F_##_m##_TABLE | ((_not) ? \
121 HOSTAPD_FRAME_F_##_m##_N0x04 : HOSTAPD_FRAME_F_##_m); \
122}
123#define HOSTAPD_MATCH_RADIOTAP(_x){ if (hostapd_cfg.c_apme_dlt == 105 || (hostapd_cfg.c_apme_dlt
== 0 && 105 == 105)) { yyerror("option %s requires radiotap headers"
, "_x"); goto yyerrlab; } frame.f_radiotap |= (1 << IEEE80211_RADIOTAP_RSSI
); frame.f_flags |= HOSTAPD_FRAME_F__x; }
{ \
124 if (hostapd_cfg.c_apme_dlt == DLT_IEEE802_11105 || \
125 (hostapd_cfg.c_apme_dlt == 0 && \
126 HOSTAPD_DLT105 == DLT_IEEE802_11105)) { \
127 yyerror("option %s requires radiotap headers", #_x); \
128 YYERRORgoto yyerrlab; \
129 } \
130 frame.f_radiotap |= HOSTAPD_RADIOTAP_F(RSSI)(1 << IEEE80211_RADIOTAP_RSSI); \
131 frame.f_flags |= HOSTAPD_FRAME_F_##_x; \
132}
133#define HOSTAPD_IAPP_FLAG(_f, _not){ if (_not) hostapd_cfg.c_iapp.i_flags &= ~(HOSTAPD_IAPP_F__f
); else hostapd_cfg.c_iapp.i_flags |= (HOSTAPD_IAPP_F__f); }
{ \
134 if (_not) \
135 hostapd_cfg.c_iapp.i_flags &= ~(HOSTAPD_IAPP_F_##_f); \
136 else \
137 hostapd_cfg.c_iapp.i_flags |= (HOSTAPD_IAPP_F_##_f); \
138}
139
140#line 141 "parse.c"
141#define MODE257 257
142#define INTERFACE258 258
143#define IAPP259 259
144#define HOSTAP260 260
145#define MULTICAST261 261
146#define BROADCAST262 262
147#define SET263 263
148#define SEC264 264
149#define USEC265 265
150#define HANDLE266 266
151#define TYPE267 267
152#define SUBTYPE268 268
153#define FROM269 269
154#define TO270 270
155#define BSSID271 271
156#define WITH272 272
157#define FRAME273 273
158#define RADIOTAP274 274
159#define NWID275 275
160#define PASSIVE276 276
161#define MANAGEMENT277 277
162#define DATA278 278
163#define PROBE279 279
164#define BEACON280 280
165#define ATIM281 281
166#define ANY282 282
167#define DS283 283
168#define NO284 284
169#define DIR285 285
170#define RESEND286 286
171#define RANDOM287 287
172#define AUTH288 288
173#define DEAUTH289 289
174#define ASSOC290 290
175#define DISASSOC291 291
176#define REASSOC292 292
177#define REQUEST293 293
178#define RESPONSE294 294
179#define PCAP295 295
180#define RATE296 296
181#define ERROR297 297
182#define CONST298 298
183#define TABLE299 299
184#define NODE300 300
185#define DELETE301 301
186#define ADD302 302
187#define LOG303 303
188#define VERBOSE304 304
189#define LIMIT305 305
190#define QUICK306 306
191#define SKIP307 307
192#define REASON308 308
193#define UNSPECIFIED309 309
194#define EXPIRE310 310
195#define LEAVE311 311
196#define TOOMANY312 312
197#define NOT313 313
198#define AUTHED314 314
199#define ASSOCED315 315
200#define RESERVED316 316
201#define RSN317 317
202#define REQUIRED318 318
203#define INCONSISTENT319 319
204#define IE320 320
205#define INVALID321 321
206#define MIC322 322
207#define FAILURE323 323
208#define OPEN324 324
209#define ADDRESS325 325
210#define PORT326 326
211#define ON327 327
212#define NOTIFY328 328
213#define TTL329 329
214#define INCLUDE330 330
215#define ROUTE331 331
216#define ROAMING332 332
217#define RSSI333 333
218#define TXRATE334 334
219#define FREQ335 335
220#define HOPPER336 336
221#define DELAY337 337
222#define NE338 338
223#define LE339 339
224#define GE340 340
225#define ARROW341 341
226#define STRING342 342
227#define NUMBER343 343
228#define YYERRCODE256 256
229const short yylhs[] =
230 { -1,
231 0, 0, 0, 0, 0, 0, 0, 0, 17, 19,
232 19, 19, 19, 19, 19, 19, 19, 19, 26, 26,
233 28, 28, 29, 29, 30, 30, 24, 24, 22, 22,
234 32, 32, 33, 23, 23, 35, 35, 36, 37, 37,
235 39, 42, 20, 27, 27, 45, 45, 46, 46, 46,
236 46, 38, 38, 38, 41, 41, 41, 41, 41, 41,
237 47, 47, 49, 50, 50, 40, 40, 51, 51, 48,
238 43, 43, 43, 44, 44, 52, 52, 52, 52, 63,
239 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
240 64, 64, 64, 65, 65, 68, 68, 69, 66, 66,
241 10, 10, 67, 7, 7, 7, 7, 7, 7, 7,
242 7, 7, 7, 7, 7, 7, 7, 7, 53, 53,
243 53, 70, 70, 70, 70, 54, 54, 54, 55, 55,
244 55, 56, 56, 56, 57, 57, 71, 71, 72, 72,
245 72, 6, 6, 58, 58, 73, 59, 59, 60, 61,
246 62, 5, 5, 5, 8, 75, 18, 74, 74, 76,
247 76, 77, 77, 77, 9, 9, 21, 2, 2, 2,
248 78, 78, 81, 79, 80, 80, 80, 1, 83, 83,
249 3, 4, 25, 25, 82, 84, 34, 34, 31, 31,
250 15, 15, 15, 11, 11, 11, 11, 11, 11, 11,
251 11, 11, 12, 13, 14, 16,
252};
253const short yylen[] =
254 { 2,
255 0, 2, 3, 3, 3, 3, 3, 3, 2, 4,
256 5, 5, 4, 5, 4, 6, 6, 5, 4, 2,
257 0, 2, 0, 2, 0, 2, 1, 1, 5, 1,
258 1, 3, 1, 5, 1, 1, 3, 1, 0, 3,
259 0, 0, 10, 5, 1, 1, 3, 3, 2, 3,
260 3, 0, 1, 1, 0, 3, 3, 3, 4, 2,
261 0, 1, 3, 1, 1, 1, 7, 0, 1, 5,
262 0, 3, 3, 0, 5, 0, 2, 3, 4, 0,
263 2, 3, 3, 3, 2, 1, 2, 2, 2, 2,
264 2, 2, 2, 0, 1, 2, 1, 3, 0, 1,
265 2, 2, 1, 0, 2, 3, 3, 3, 3, 3,
266 3, 3, 4, 2, 3, 3, 3, 3, 0, 2,
267 3, 2, 2, 2, 3, 0, 2, 3, 0, 2,
268 3, 0, 2, 3, 0, 1, 2, 1, 3, 3,
269 3, 1, 1, 2, 3, 2, 0, 2, 2, 2,
270 2, 1, 1, 1, 3, 0, 4, 0, 1, 2,
271 1, 1, 3, 5, 2, 1, 3, 2, 2, 2,
272 1, 3, 0, 3, 0, 3, 2, 1, 0, 2,
273 1, 1, 0, 1, 1, 1, 0, 2, 0, 1,
274 0, 1, 1, 0, 1, 1, 1, 1, 1, 1,
275 1, 1, 1, 1, 1, 1,
276};
277const short yydefred[] =
278 { 1,
279 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
280 0, 0, 0, 8, 41, 0, 0, 0, 156, 9,
281 0, 3, 4, 5, 6, 7, 0, 0, 0, 0,
282 0, 0, 0, 0, 0, 0, 0, 166, 0, 53,
283 54, 0, 0, 0, 15, 0, 0, 0, 0, 27,
284 28, 13, 33, 0, 10, 30, 0, 0, 155, 162,
285 0, 157, 0, 161, 165, 0, 0, 0, 0, 0,
286 20, 184, 14, 193, 0, 192, 0, 18, 45, 0,
287 0, 190, 0, 38, 0, 11, 35, 206, 12, 0,
288 160, 0, 69, 66, 42, 0, 178, 22, 0, 24,
289 0, 49, 0, 0, 0, 16, 17, 0, 31, 0,
290 181, 163, 173, 0, 171, 40, 0, 0, 0, 0,
291 19, 0, 46, 48, 51, 50, 0, 0, 0, 0,
292 36, 0, 0, 0, 0, 0, 77, 0, 0, 0,
293 26, 0, 0, 188, 29, 32, 0, 0, 185, 186,
294 174, 0, 0, 164, 172, 0, 0, 60, 0, 0,
295 0, 0, 0, 78, 120, 0, 0, 0, 44, 47,
296 34, 37, 0, 177, 0, 58, 0, 57, 0, 64,
297 65, 0, 62, 56, 0, 0, 43, 0, 79, 0,
298 0, 0, 0, 121, 127, 0, 0, 0, 0, 176,
299 0, 0, 144, 0, 0, 182, 0, 154, 152, 153,
300 59, 72, 73, 0, 81, 0, 124, 123, 0, 122,
301 143, 128, 142, 130, 0, 0, 0, 180, 63, 0,
302 145, 148, 0, 0, 168, 169, 170, 0, 0, 0,
303 86, 0, 0, 0, 0, 0, 82, 125, 131, 133,
304 0, 0, 0, 0, 67, 0, 138, 146, 149, 0,
305 0, 0, 0, 0, 0, 85, 0, 97, 0, 100,
306 87, 0, 103, 88, 89, 91, 90, 92, 93, 134,
307 198, 199, 201, 200, 202, 195, 197, 196, 0, 0,
308 0, 137, 150, 0, 70, 75, 83, 84, 0, 96,
309 101, 102, 0, 0, 105, 0, 114, 0, 0, 0,
310 203, 139, 204, 140, 205, 141, 151, 98, 106, 107,
311 108, 112, 109, 0, 110, 111, 115, 116, 117, 118,
312 113,
313};
314const short yydgoto[] =
315 { 1,
316 98, 208, 209, 210, 211, 222, 273, 223, 39, 270,
317 289, 312, 314, 316, 77, 89, 9, 10, 11, 12,
318 13, 55, 86, 52, 73, 45, 78, 69, 71, 121,
319 83, 108, 56, 129, 130, 87, 67, 42, 27, 95,
320 136, 117, 162, 187, 122, 79, 184, 178, 176, 182,
321 96, 119, 140, 168, 198, 227, 255, 179, 205, 234,
322 261, 295, 189, 247, 266, 271, 274, 267, 268, 194,
323 256, 257, 231, 62, 37, 63, 64, 114, 115, 151,
324 132, 152, 200, 153,
325};
326const short yysindex[] =
327 { 0,
328 -10, 37, -217, -208, 5, -288, 1, 0, 60, 88,
329 95, 100, 108, 0, 0, -229, -236, -241, 0, 0,
330 -214, 0, 0, 0, 0, 0, -218, -141, -207, -131,
331 -185, -170, -226, -115, -231, 109, -103, 0, -169, 0,
332 0, -140, -136, -122, 0, -57, -19, -97, -78, 0,
333 0, 0, 0, 210, 0, 0, -112, -121, 0, 0,
334 210, 0, -103, 0, 0, -18, -188, -116, -122, -114,
335 0, 0, 0, 0, 210, 0, -249, 0, 0, 5,
336 5, 0, -111, 0, 210, 0, 0, 0, 0, -108,
337 0, -110, 0, 0, 0, -44, 0, 0, -101, 0,
338 -18, 0, -104, -99, -95, 0, 0, 30, 0, -102,
339 0, 0, 0, 30, 0, 0, -34, -20, -46, -100,
340 0, 30, 0, 0, 0, 0, 210, 116, -111, 30,
341 0, 3, 117, -94, -213, -61, 0, -146, 78, -24,
342 0, 122, -18, 0, 0, 0, 126, -102, 0, 0,
343 0, -116, -94, 0, 0, -15, -13, 0, -160, -55,
344 -88, -39, -12, 0, 0, -144, 89, -11, 0, 0,
345 0, 0, 213, 0, -4, 0, -133, 0, -17, 0,
346 0, -29, 0, 0, -105, -66, 0, 90, 0, -2,
347 -1, 10, 13, 0, 0, -54, 91, 12, -58, 0,
348 -55, 18, 0, -144, 43, 0, -178, 0, 0, 0,
349 0, 0, 0, 250, 0, -98, 0, 0, 63, 0,
350 0, 0, 0, 0, -54, 132, -221, 0, 0, -98,
351 0, 0, -29, 77, 0, 0, 0, 9, -126, 73,
352 0, 29, 47, -124, 47, -119, 0, 0, 0, 0,
353 -54, -30, -30, -30, 0, -221, 0, 0, 0, -29,
354 85, 97, 73, 73, -18, 0, 73, 0, -117, 0,
355 0, -245, 0, 0, 0, 0, 0, 0, 0, 0,
356 0, 0, 0, 0, 0, 0, 0, 0, 15, 24,
357 40, 0, 0, -29, 0, 0, 0, 0, 42, 0,
358 0, 0, -132, -158, 0, -118, 0, -109, 64, 74,
359 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
360 0, 0, 0, 56, 0, 0, 0, 0, 0, 0,
361 0,};
362const short yyrindex[] =
363 { 0,
364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
366 0, 0, 0, 0, 0, 0, -6, 0, 0, 0,
367 0, 0, 0, 0, 0, 0, 409, 0, 412, 0,
368 0, 2, 14, 88, 0, 415, -195, 0, 0, 0,
369 0, 0, 0, 92, 0, 0, 0, 0, 0, 0,
370 -107, 0, 420, 0, 0, 94, 34, 0, -3, 0,
371 0, 0, 0, 0, 180, 0, 0, 0, 0, 0,
372 0, 0, 0, 0, 92, 0, 0, 0, 0, 0,
373 0, 0, 0, 0, 0, 46, 0, 0, 100, 0,
374 -195, 0, 0, 0, 0, 0, 0, -106, 0, 0,
375 0, 0, 0, -106, 0, 0, 45, -79, 146, 0,
376 0, 175, 0, 0, 0, 0, 170, 0, 0, -106,
377 0, -9, 0, 0, 0, -5, 0, 0, -120, 141,
378 0, 0, -195, 0, 0, 0, 0, 0, 0, 0,
379 0, 0, 0, 0, 0, 0, 0, 0, 0, 49,
380 0, 421, 53, 0, 0, 0, -50, 128, 0, 0,
381 0, 0, -8, 0, 0, 0, 0, 0, 166, 0,
382 0, 0, 0, 0, 0, 0, 0, -74, 0, 0,
383 0, 0, 0, 0, 0, 0, -50, 151, 0, 0,
384 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,
385 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
386 0, 0, 0, 0, 0, -50, 6, 0, 0, 0,
387 0, 0, 0, 0, 0, 0, 0, 0, 0, 93,
388 0, 105, 124, 0, 124, 0, 0, 0, 0, 0,
389 0, 101, 101, 101, 0, 87, 0, 0, 0, 0,
390 0, 0, 93, 93, 94, 0, 136, 0, 0, 0,
391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
393 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
397 0,};
398const short yygindex[] =
399 { 0,
400 296, 0, -67, 0, -199, -168, 0, 28, 0, 0,
401 -53, 0, 0, 0, -40, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 0, 0, 0, 0, 381, 0,
403 58, 0, -45, -64, 0, -68, 0, 0, 0, 0,
404 0, 0, 0, 0, 0, -62, 251, 0, 0, 0,
405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
406 0, 0, 0, 223, -52, 0, 215, 0, 188, 260,
407 0, 209, 0, 0, 0, 0, 403, 0, 333, 0,
408 0, 0, 0, 0,
409};
410#define YYTABLESIZE512 512
411const short yytable[] =
412 { 8,
413 175, 179, 287, 52, 71, 18, 23, 54, 207, 191,
414 85, 39, 76, 76, 76, 135, 112, 189, 189, 61,
415 33, 34, 113, 21, 102, 92, 57, 28, 29, 284,
416 286, 285, 19, 259, 175, 179, 30, 109, 123, 82,
417 150, 131, 303, 68, 304, 156, 14, 50, 15, 134,
418 16, 17, 103, 20, 55, 76, 249, 143, 61, 157,
419 293, 21, 80, 305, 18, 148, 113, 306, 51, 22,
420 307, 308, 158, 127, 309, 104, 310, 138, 191, 172,
421 170, 105, 280, 146, 93, 174, 159, 40, 41, 160,
422 235, 236, 237, 94, 317, 31, 136, 23, 166, 35,
423 36, 32, 94, 75, 24, 58, 191, 106, 107, 25,
424 76, 252, 253, 254, 99, 175, 179, 26, 90, 43,
425 44, 76, 76, 76, 190, 191, 196, 38, 221, 191,
426 163, 164, 101, 104, 46, 191, 47, 129, 192, 193,
427 180, 181, 110, 202, 203, 95, 48, 216, 191, 191,
428 126, 321, 322, 323, 324, 119, 225, 221, 212, 213,
429 132, 49, 191, 191, 76, 128, 263, 264, 275, 276,
430 59, 133, 65, 278, 279, 301, 302, 319, 320, 142,
431 239, 240, 241, 221, 144, 251, 66, 147, 68, 242,
432 243, 244, 245, 246, 60, 325, 326, 191, 191, 290,
433 291, 80, 189, 70, 191, 191, 191, 187, 327, 328,
434 297, 298, 189, 191, 191, 191, 191, 191, 72, 82,
435 81, 88, 118, 124, 299, 97, 53, 120, 100, 84,
436 53, 116, 125, 111, 189, 187, 126, 135, 139, 84,
437 145, 154, 141, 161, 167, 2, 169, 111, 183, 3,
438 171, 175, 4, 177, 185, 188, 186, 206, 197, 199,
439 52, 137, 52, 52, 52, 52, 52, 204, 39, 201,
440 39, 39, 39, 39, 39, 52, 214, 135, 52, 219,
441 217, 218, 226, 39, 228, 230, 39, 111, 5, 52,
442 71, 191, 74, 74, 74, 220, 238, 39, 52, 189,
443 68, 135, 68, 68, 68, 68, 39, 281, 282, 283,
444 135, 233, 111, 288, 76, 76, 76, 76, 68, 6,
445 52, 80, 80, 80, 80, 23, 52, 52, 52, 68,
446 76, 7, 175, 179, 39, 39, 39, 80, 68, 21,
447 55, 76, 21, 149, 61, 248, 260, 265, 80, 55,
448 76, 262, 269, 61, 272, 294, 311, 80, 136, 165,
449 296, 94, 94, 94, 94, 313, 68, 68, 68, 331,
450 195, 215, 224, 99, 99, 99, 99, 94, 76, 76,
451 76, 315, 136, 318, 329, 80, 80, 80, 94, 99,
452 74, 136, 104, 104, 104, 104, 330, 94, 129, 129,
453 99, 74, 74, 74, 95, 95, 95, 95, 104, 99,
454 126, 126, 126, 250, 119, 119, 119, 119, 158, 104,
455 95, 167, 132, 129, 183, 94, 94, 94, 104, 159,
456 74, 95, 129, 189, 147, 191, 126, 99, 99, 99,
457 95, 119, 194, 189, 74, 126, 132, 173, 187, 99,
458 119, 229, 258, 189, 300, 132, 104, 104, 104, 277,
459 129, 129, 129, 232, 292, 91, 155, 0, 95, 95,
460 95, 189, 0, 126, 126, 126, 187, 0, 119, 119,
461 119, 189, 189, 132, 132, 132, 0, 187, 0, 0,
462 0, 0, 189, 0, 189, 0, 0, 0, 0, 187,
463 189, 0, 0, 0, 189, 187, 0, 0, 0, 0,
464 189, 189,
465};
466const short yycheck[] =
467 { 10,
468 10, 10, 33, 10, 10, 60, 10, 123, 38, 60,
469 123, 10, 33, 33, 33, 10, 125, 125, 125, 123,
470 257, 258, 90, 10, 274, 66, 258, 257, 258, 60,
471 61, 62, 5, 233, 44, 44, 266, 83, 101, 10,
472 38, 110, 288, 10, 290, 259, 10, 274, 266, 114,
473 259, 260, 302, 342, 10, 10, 225, 122, 10, 273,
474 260, 61, 10, 309, 60, 130, 134, 313, 295, 10,
475 316, 317, 286, 44, 320, 325, 322, 118, 274, 148,
476 143, 331, 251, 129, 273, 153, 300, 306, 307, 303,
477 269, 270, 271, 282, 294, 325, 10, 10, 139, 336,
478 342, 331, 10, 123, 10, 337, 302, 80, 81, 10,
479 33, 333, 334, 335, 10, 125, 125, 10, 61, 261,
480 262, 33, 33, 33, 269, 270, 167, 342, 196, 325,
481 277, 278, 75, 10, 342, 331, 268, 10, 283, 284,
482 301, 302, 85, 277, 278, 10, 332, 188, 269, 270,
483 10, 310, 311, 312, 313, 10, 197, 225, 264, 265,
484 10, 332, 283, 284, 33, 108, 293, 294, 293, 294,
485 62, 114, 342, 293, 294, 293, 294, 310, 311, 122,
486 279, 280, 281, 251, 127, 226, 327, 130, 325, 288,
487 289, 290, 291, 292, 298, 314, 315, 277, 278, 253,
488 254, 299, 33, 326, 279, 280, 281, 33, 318, 319,
489 263, 264, 33, 288, 289, 290, 291, 292, 276, 10,
490 299, 343, 267, 328, 265, 342, 342, 329, 343, 342,
491 342, 342, 332, 342, 342, 342, 332, 272, 285, 342,
492 125, 125, 343, 305, 269, 256, 125, 342, 304, 260,
493 125, 267, 263, 267, 343, 268, 296, 287, 270, 47,
494 267, 282, 269, 270, 271, 272, 273, 285, 267, 274,
495 269, 270, 271, 272, 273, 282, 343, 272, 285, 270,
496 283, 283, 271, 282, 343, 268, 285, 342, 299, 296,
497 296, 342, 313, 313, 313, 283, 47, 296, 305, 125,
498 267, 296, 269, 270, 271, 272, 305, 338, 339, 340,
499 305, 269, 342, 344, 269, 270, 271, 272, 285, 330,
500 327, 269, 270, 271, 272, 329, 333, 334, 335, 296,
501 285, 342, 342, 342, 333, 334, 335, 285, 305, 326,
502 296, 296, 329, 341, 296, 283, 270, 275, 296, 305,
503 305, 343, 324, 305, 308, 271, 342, 305, 272, 282,
504 264, 269, 270, 271, 272, 342, 333, 334, 335, 314,
505 282, 282, 282, 269, 270, 271, 272, 285, 333, 334,
506 335, 342, 296, 342, 321, 333, 334, 335, 296, 285,
507 313, 305, 269, 270, 271, 272, 323, 305, 271, 272,
508 296, 313, 313, 313, 269, 270, 271, 272, 285, 305,
509 270, 271, 272, 282, 269, 270, 271, 272, 10, 296,
510 285, 10, 272, 296, 10, 333, 334, 335, 305, 10,
511 10, 296, 305, 342, 269, 342, 296, 333, 334, 335,
512 305, 296, 342, 274, 313, 305, 296, 152, 274, 69,
513 305, 201, 230, 274, 267, 305, 333, 334, 335, 245,
514 333, 334, 335, 204, 256, 63, 134, -1, 333, 334,
515 335, 302, -1, 333, 334, 335, 302, -1, 333, 334,
516 335, 302, 313, 333, 334, 335, -1, 313, -1, -1,
517 -1, -1, 313, -1, 325, -1, -1, -1, -1, 325,
518 331, -1, -1, -1, 325, 331, -1, -1, -1, -1,
519 331, 342,
520};
521#define YYFINAL1 1
522#ifndef YYDEBUG0
523#define YYDEBUG0 0
524#endif
525#define YYMAXTOKEN344 344
526#if YYDEBUG0
527const char * const yyname[] =
528 {
529"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,
5300,0,"'!'",0,0,0,0,"'&'",0,0,0,0,0,"','",0,0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,"'<'",
531"'='","'>'",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,
5320,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,
5330,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,
5340,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,
5350,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,
5360,0,0,0,"MODE","INTERFACE","IAPP","HOSTAP","MULTICAST","BROADCAST","SET","SEC",
537"USEC","HANDLE","TYPE","SUBTYPE","FROM","TO","BSSID","WITH","FRAME","RADIOTAP",
538"NWID","PASSIVE","MANAGEMENT","DATA","PROBE","BEACON","ATIM","ANY","DS","NO",
539"DIR","RESEND","RANDOM","AUTH","DEAUTH","ASSOC","DISASSOC","REASSOC","REQUEST",
540"RESPONSE","PCAP","RATE","ERROR","CONST","TABLE","NODE","DELETE","ADD","LOG",
541"VERBOSE","LIMIT","QUICK","SKIP","REASON","UNSPECIFIED","EXPIRE","LEAVE",
542"TOOMANY","NOT","AUTHED","ASSOCED","RESERVED","RSN","REQUIRED","INCONSISTENT",
543"IE","INVALID","MIC","FAILURE","OPEN","ADDRESS","PORT","ON","NOTIFY","TTL",
544"INCLUDE","ROUTE","ROAMING","RSSI","TXRATE","FREQ","HOPPER","DELAY","NE","LE",
545"GE","ARROW","STRING","NUMBER","\"==\"",
546};
547const char * const yyrule[] =
548 {"$accept : grammar",
549"grammar :",
550"grammar : grammar '\\n'",
551"grammar : grammar include '\\n'",
552"grammar : grammar tabledef '\\n'",
553"grammar : grammar option '\\n'",
554"grammar : grammar event '\\n'",
555"grammar : grammar varset '\\n'",
556"grammar : grammar error '\\n'",
557"include : INCLUDE STRING",
558"option : SET HOSTAP INTERFACE hostapifaces",
559"option : SET HOSTAP HOPPER INTERFACE hopperifaces",
560"option : SET HOSTAP HOPPER DELAY timeout",
561"option : SET HOSTAP MODE hostapmode",
562"option : SET IAPP INTERFACE STRING passive",
563"option : SET IAPP MODE iappmode",
564"option : SET IAPP ADDRESS ROAMING TABLE table",
565"option : SET IAPP ROUTE ROAMING TABLE table",
566"option : SET IAPP HANDLE SUBTYPE iappsubtypes",
567"iappmode : MULTICAST iappmodeaddr iappmodeport iappmodettl",
568"iappmode : BROADCAST iappmodeport",
569"iappmodeaddr :",
570"iappmodeaddr : ADDRESS ipv4addr",
571"iappmodeport :",
572"iappmodeport : PORT NUMBER",
573"iappmodettl :",
574"iappmodettl : TTL NUMBER",
575"hostapmode : RADIOTAP",
576"hostapmode : PCAP",
577"hostapifaces : '{' optnl hostapifacelist optnl '}'",
578"hostapifaces : hostapiface",
579"hostapifacelist : hostapiface",
580"hostapifacelist : hostapifacelist comma hostapiface",
581"hostapiface : STRING",
582"hopperifaces : '{' optnl hopperifacelist optnl '}'",
583"hopperifaces : hopperiface",
584"hopperifacelist : hopperiface",
585"hopperifacelist : hopperifacelist comma hopperiface",
586"hopperiface : STRING",
587"hostapmatch :",
588"hostapmatch : ON not STRING",
589"$$1 :",
590"$$2 :",
591"event : HOSTAP HANDLE $$1 eventopt hostapmatch frmmatch $$2 action limit rate",
592"iappsubtypes : '{' optnl iappsubtypelist optnl '}'",
593"iappsubtypes : iappsubtype",
594"iappsubtypelist : iappsubtype",
595"iappsubtypelist : iappsubtypelist comma iappsubtype",
596"iappsubtype : not ADD NOTIFY",
597"iappsubtype : not RADIOTAP",
598"iappsubtype : not ROUTE ROAMING",
599"iappsubtype : not ADDRESS ROAMING",
600"eventopt :",
601"eventopt : QUICK",
602"eventopt : SKIP",
603"action :",
604"action : WITH LOG verbose",
605"action : WITH FRAME frmaction",
606"action : WITH IAPP iapp",
607"action : WITH NODE nodeopt frmactionaddr",
608"action : WITH RESEND",
609"verbose :",
610"verbose : VERBOSE",
611"iapp : TYPE RADIOTAP verbose",
612"nodeopt : DELETE",
613"nodeopt : ADD",
614"frmmatch : ANY",
615"frmmatch : frm frmmatchtype frmmatchdir frmmatchfrom frmmatchto frmmatchbssid frmmatchrtap",
616"frm :",
617"frm : FRAME",
618"frmaction : frmactiontype frmactiondir frmactionfrom frmactionto frmactionbssid",
619"limit :",
620"limit : LIMIT NUMBER SEC",
621"limit : LIMIT NUMBER USEC",
622"rate :",
623"rate : RATE NUMBER '/' NUMBER SEC",
624"frmmatchtype :",
625"frmmatchtype : TYPE ANY",
626"frmmatchtype : TYPE not DATA",
627"frmmatchtype : TYPE not MANAGEMENT frmmatchmgmt",
628"frmmatchmgmt :",
629"frmmatchmgmt : SUBTYPE ANY",
630"frmmatchmgmt : SUBTYPE not frmsubtype",
631"frmsubtype : PROBE REQUEST frmelems",
632"frmsubtype : PROBE RESPONSE frmelems",
633"frmsubtype : BEACON frmelems",
634"frmsubtype : ATIM",
635"frmsubtype : AUTH frmauth",
636"frmsubtype : DEAUTH frmreason",
637"frmsubtype : ASSOC REQUEST",
638"frmsubtype : DISASSOC frmreason",
639"frmsubtype : ASSOC RESPONSE",
640"frmsubtype : REASSOC REQUEST",
641"frmsubtype : REASSOC RESPONSE",
642"frmelems :",
643"frmelems : frmelems_l",
644"frmelems_l : frmelems_l frmelem",
645"frmelems_l : frmelem",
646"frmelem : NWID not STRING",
647"frmauth :",
648"frmauth : authalg",
649"authalg : OPEN REQUEST",
650"authalg : OPEN RESPONSE",
651"frmreason : frmreason_l",
652"frmreason_l :",
653"frmreason_l : REASON UNSPECIFIED",
654"frmreason_l : REASON AUTH EXPIRE",
655"frmreason_l : REASON AUTH LEAVE",
656"frmreason_l : REASON ASSOC EXPIRE",
657"frmreason_l : REASON ASSOC TOOMANY",
658"frmreason_l : REASON NOT AUTHED",
659"frmreason_l : REASON NOT ASSOCED",
660"frmreason_l : REASON ASSOC LEAVE",
661"frmreason_l : REASON ASSOC NOT AUTHED",
662"frmreason_l : REASON RESERVED",
663"frmreason_l : REASON RSN REQUIRED",
664"frmreason_l : REASON RSN INCONSISTENT",
665"frmreason_l : REASON IE INVALID",
666"frmreason_l : REASON MIC FAILURE",
667"frmmatchdir :",
668"frmmatchdir : DIR ANY",
669"frmmatchdir : DIR not frmdir",
670"frmdir : NO DS",
671"frmdir : TO DS",
672"frmdir : FROM DS",
673"frmdir : DS TO DS",
674"frmmatchfrom :",
675"frmmatchfrom : FROM ANY",
676"frmmatchfrom : FROM not frmmatchaddr",
677"frmmatchto :",
678"frmmatchto : TO ANY",
679"frmmatchto : TO not frmmatchaddr",
680"frmmatchbssid :",
681"frmmatchbssid : BSSID ANY",
682"frmmatchbssid : BSSID not frmmatchaddr",
683"frmmatchrtap :",
684"frmmatchrtap : frmmatchrtap_l",
685"frmmatchrtap_l : frmmatchrtap_l frmmatchrtapopt",
686"frmmatchrtap_l : frmmatchrtapopt",
687"frmmatchrtapopt : RSSI unaryop percent",
688"frmmatchrtapopt : TXRATE unaryop txrate",
689"frmmatchrtapopt : FREQ unaryop freq",
690"frmmatchaddr : table",
691"frmmatchaddr : lladdr",
692"frmactiontype : TYPE DATA",
693"frmactiontype : TYPE MANAGEMENT frmactionmgmt",
694"frmactionmgmt : SUBTYPE frmsubtype",
695"frmactiondir :",
696"frmactiondir : DIR frmdir",
697"frmactionfrom : FROM frmactionaddr",
698"frmactionto : TO frmactionaddr",
699"frmactionbssid : BSSID frmactionaddr",
700"frmactionaddr : lladdr",
701"frmactionaddr : randaddr",
702"frmactionaddr : refaddr",
703"table : '<' STRING '>'",
704"$$3 :",
705"tabledef : TABLE table $$3 tableopts",
706"tableopts :",
707"tableopts : tableopts_l",
708"tableopts_l : tableopts_l tableopt",
709"tableopts_l : tableopt",
710"tableopt : CONST",
711"tableopt : '{' optnl '}'",
712"tableopt : '{' optnl tableaddrlist optnl '}'",
713"string : string STRING",
714"string : STRING",
715"varset : STRING '=' string",
716"refaddr : '&' FROM",
717"refaddr : '&' TO",
718"refaddr : '&' BSSID",
719"tableaddrlist : tableaddrentry",
720"tableaddrlist : tableaddrlist comma tableaddrentry",
721"$$4 :",
722"tableaddrentry : lladdr $$4 tableaddropt",
723"tableaddropt :",
724"tableaddropt : assign ipv4addr ipv4netmask",
725"tableaddropt : mask lladdr",
726"ipv4addr : STRING",
727"ipv4netmask :",
728"ipv4netmask : '/' NUMBER",
729"lladdr : STRING",
730"randaddr : RANDOM",
731"passive :",
732"passive : PASSIVE",
733"assign : ARROW",
734"mask : '&'",
735"comma :",
736"comma : ',' optnl",
737"optnl :",
738"optnl : '\\n'",
739"not :",
740"not : '!'",
741"not : NOT",
742"unaryop :",
743"unaryop : '='",
744"unaryop : \"==\"",
745"unaryop : '!'",
746"unaryop : NE",
747"unaryop : LE",
748"unaryop : '<'",
749"unaryop : GE",
750"unaryop : '>'",
751"percent : STRING",
752"txrate : STRING",
753"freq : STRING",
754"timeout : NUMBER",
755};
756#endif
757#ifdef YYSTACKSIZE10000
758#undef YYMAXDEPTH10000
759#define YYMAXDEPTH10000 YYSTACKSIZE10000
760#else
761#ifdef YYMAXDEPTH10000
762#define YYSTACKSIZE10000 YYMAXDEPTH10000
763#else
764#define YYSTACKSIZE10000 10000
765#define YYMAXDEPTH10000 10000
766#endif
767#endif
768#define YYINITSTACKSIZE200 200
769/* LINTUSED */
770int yydebug;
771int yynerrs;
772int yyerrflag;
773int yychar;
774short *yyssp;
775YYSTYPE *yyvsp;
776YYSTYPE yyval;
777YYSTYPE yylval;
778short *yyss;
779short *yysslim;
780YYSTYPE *yyvs;
781unsigned int yystacksize;
782int yyparse(void);
783#line 1232 "/usr/src/usr.sbin/hostapd/parse.y"
784
785/*
786 * Parser and lexer
787 */
788
789struct keywords {
790 char *k_name;
791 int k_val;
792};
793
794int
795kw_cmp(const void *a, const void *b)
796{
797 return strcmp(a, ((const struct keywords *)b)->k_name);
798}
799
800int
801lookup(char *token)
802{
803 /* Keep this list sorted */
804 static const struct keywords keywords[] = {
805 { "add", ADD302 },
806 { "address", ADDRESS325 },
807 { "any", ANY282 },
808 { "assoc", ASSOC290 },
809 { "assoced", ASSOCED315 },
810 { "atim", ATIM281 },
811 { "auth", AUTH288 },
812 { "authed", AUTHED314 },
813 { "beacon", BEACON280 },
814 { "broadcast", BROADCAST262 },
815 { "bssid", BSSID271 },
816 { "const", CONST298 },
817 { "data", DATA278 },
818 { "deauth", DEAUTH289 },
819 { "delay", DELAY337 },
820 { "delete", DELETE301 },
821 { "dir", DIR285 },
822 { "disassoc", DISASSOC291 },
823 { "ds", DS283 },
824 { "expire", EXPIRE310 },
825 { "failure", FAILURE323 },
826 { "frame", FRAME273 },
827 { "freq", FREQ335 },
828 { "from", FROM269 },
829 { "handle", HANDLE266 },
830 { "hopper", HOPPER336 },
831 { "hostap", HOSTAP260 },
832 { "iapp", IAPP259 },
833 { "ie", IE320 },
834 { "include", INCLUDE330 },
835 { "inconsistent", INCONSISTENT319 },
836 { "interface", INTERFACE258 },
837 { "invalid", INVALID321 },
838 { "leave", LEAVE311 },
839 { "limit", LIMIT305 },
840 { "log", LOG303 },
841 { "management", MANAGEMENT277 },
842 { "mic", MIC322 },
843 { "mode", MODE257 },
844 { "multicast", MULTICAST261 },
845 { "no", NO284 },
846 { "node", NODE300 },
847 { "not", NOT313 },
848 { "notify", NOTIFY328 },
849 { "nwid", NWID275 },
850 { "on", ON327 },
851 { "open", OPEN324 },
852 { "passive", PASSIVE276 },
853 { "pcap", PCAP295 },
854 { "port", PORT326 },
855 { "probe", PROBE279 },
856 { "quick", QUICK306 },
857 { "radiotap", RADIOTAP274 },
858 { "random", RANDOM287 },
859 { "rate", RATE296 },
860 { "reason", REASON308 },
861 { "reassoc", REASSOC292 },
862 { "request", REQUEST293 },
863 { "required", REQUIRED318 },
864 { "resend", RESEND286 },
865 { "reserved", RESERVED316 },
866 { "response", RESPONSE294 },
867 { "roaming", ROAMING332 },
868 { "route", ROUTE331 },
869 { "rsn", RSN317 },
870 { "sec", SEC264 },
871 { "set", SET263 },
872 { "signal", RSSI333 },
873 { "skip", SKIP307 },
874 { "subtype", SUBTYPE268 },
875 { "table", TABLE299 },
876 { "to", TO270 },
877 { "toomany", TOOMANY312 },
878 { "ttl", TTL329 },
879 { "txrate", TXRATE334 },
880 { "type", TYPE267 },
881 { "unspecified", UNSPECIFIED309 },
882 { "usec", USEC265 },
883 { "verbose", VERBOSE304 },
884 { "with", WITH272 }
885 };
886 const struct keywords *p;
887
888 p = bsearch(token, keywords, sizeof(keywords) / sizeof(keywords[0]),
889 sizeof(keywords[0]), kw_cmp);
890
891 return (p == NULL((void *)0) ? STRING342 : p->k_val);
892}
893
894#define START_EXPAND1 1
895#define DONE_EXPAND2 2
896
897static int expanding;
898
899int
900igetc(void)
901{
902 int c;
903
904 while (1) {
905 if (file->ungetpos > 0)
906 c = file->ungetbuf[--file->ungetpos];
907 else
908 c = getc(file->stream)(!__isthreaded ? (--(file->stream)->_r < 0 ? __srget
(file->stream) : (int)(*(file->stream)->_p++)) : (getc
)(file->stream))
;
909
910 if (c == START_EXPAND1)
911 expanding = 1;
912 else if (c == DONE_EXPAND2)
913 expanding = 0;
914 else
915 break;
916 }
917 return (c);
918}
919
920int
921lgetc(int quotec)
922{
923 int c, next;
924
925 if (quotec) {
926 if ((c = igetc()) == EOF(-1)) {
927 yyerror("reached end of file while parsing "
928 "quoted string");
929 if (file == topfile || popfile() == EOF(-1))
930 return (EOF(-1));
931 return (quotec);
932 }
933 return (c);
934 }
935
936 while ((c = igetc()) == '\\') {
937 next = igetc();
938 if (next != '\n') {
939 c = next;
940 break;
941 }
942 yylval.lineno = file->lineno;
943 file->lineno++;
944 }
945
946 if (c == EOF(-1)) {
947 /*
948 * Fake EOL when hit EOF for the first time. This gets line
949 * count right if last line in included file is syntactically
950 * invalid and has no newline.
951 */
952 if (file->eof_reached == 0) {
953 file->eof_reached = 1;
954 return ('\n');
955 }
956 while (c == EOF(-1)) {
957 if (file == topfile || popfile() == EOF(-1))
958 return (EOF(-1));
959 c = igetc();
960 }
961 }
962 return (c);
963}
964
965void
966lungetc(int c)
967{
968 if (c == EOF(-1))
969 return;
970
971 if (file->ungetpos >= file->ungetsize) {
972 void *p = reallocarray(file->ungetbuf, file->ungetsize, 2);
973 if (p == NULL((void *)0))
974 err(1, "%s", __func__);
975 file->ungetbuf = p;
976 file->ungetsize *= 2;
977 }
978 file->ungetbuf[file->ungetpos++] = c;
979}
980
981int
982findeol(void)
983{
984 int c;
985
986 /* skip to either EOF or the first real EOL */
987 while (1) {
988 c = lgetc(0);
989 if (c == '\n') {
990 file->lineno++;
991 break;
992 }
993 if (c == EOF(-1))
994 break;
995 }
996 return (ERROR297);
997}
998
999int
1000yylex(void)
1001{
1002 char buf[8096];
1003 char *p, *val;
1004 int quotec, next, c;
1005 int token;
1006
1007top:
1008 p = buf;
1009 while ((c = lgetc(0)) == ' ' || c == '\t')
1010 ; /* nothing */
1011
1012 yylval.lineno = file->lineno;
1013 if (c == '#')
1014 while ((c = lgetc(0)) != '\n' && c != EOF(-1))
1015 ; /* nothing */
1016 if (c == '$' && !expanding) {
1017 while (1) {
1018 if ((c = lgetc(0)) == EOF(-1))
1019 return (0);
1020
1021 if (p + 1 >= buf + sizeof(buf) - 1) {
1022 yyerror("string too long");
1023 return (findeol());
1024 }
1025 if (isalnum(c) || c == '_') {
1026 *p++ = c;
1027 continue;
1028 }
1029 *p = '\0';
1030 lungetc(c);
1031 break;
1032 }
1033 val = symget(buf);
1034 if (val == NULL((void *)0)) {
1035 yyerror("macro \"%s\" not defined", buf);
1036 return (findeol());
1037 }
1038 p = val + strlen(val) - 1;
1039 lungetc(DONE_EXPAND2);
1040 while (p >= val) {
1041 lungetc((unsigned char)*p);
1042 p--;
1043 }
1044 lungetc(START_EXPAND1);
1045 goto top;
1046 }
1047
1048 switch (c) {
1049 case '\'':
1050 case '"':
1051 quotec = c;
1052 while (1) {
1053 if ((c = lgetc(quotec)) == EOF(-1))
1054 return (0);
1055 if (c == '\n') {
1056 file->lineno++;
1057 continue;
1058 } else if (c == '\\') {
1059 if ((next = lgetc(quotec)) == EOF(-1))
1060 return (0);
1061 if (next == quotec || next == ' ' ||
1062 next == '\t')
1063 c = next;
1064 else if (next == '\n') {
1065 file->lineno++;
1066 continue;
1067 } else
1068 lungetc(next);
1069 } else if (c == quotec) {
1070 *p = '\0';
1071 break;
1072 } else if (c == '\0') {
1073 yyerror("syntax error");
1074 return (findeol());
1075 }
1076 if (p + 1 >= buf + sizeof(buf) - 1) {
1077 yyerror("string too long");
1078 return (findeol());
1079 }
1080 *p++ = c;
1081 }
1082 yylval.v.string = strdup(buf);
1083 if (yylval.v.string == NULL((void *)0))
1084 hostapd_fatal("yylex: strdup");
1085 return (STRING342);
1086 case '-':
1087 next = lgetc(0);
1088 if (next == '>')
1089 return (ARROW341);
1090 lungetc(next);
1091 break;
1092 case '!':
1093 next = lgetc(0);
1094 if (next == '=')
1095 return (NE338);
1096 lungetc(next);
1097 break;
1098 case '<':
1099 next = lgetc(0);
1100 if (next == '=')
1101 return (LE339);
1102 lungetc(next);
1103 break;
1104 case '>':
1105 next = lgetc(0);
1106 if (next == '=')
1107 return (GE340);
1108 lungetc(next);
1109 break;
1110 }
1111
1112#define allowed_to_end_number(x)(isspace(x) || x == ')' || x ==',' || x == '/' || x == '}' ||
x == '=')
\
1113 (isspace(x) || x == ')' || x ==',' || x == '/' || x == '}' || x == '=')
1114
1115 if (c == '-' || isdigit(c)) {
1116 do {
1117 *p++ = c;
1118 if ((size_t)(p-buf) >= sizeof(buf)) {
1119 yyerror("string too long");
1120 return (findeol());
1121 }
1122 } while ((c = lgetc(0)) != EOF(-1) && isdigit(c));
1123 lungetc(c);
1124 if (p == buf + 1 && buf[0] == '-')
1125 goto nodigits;
1126 if (c == EOF(-1) || allowed_to_end_number(c)(isspace(c) || c == ')' || c ==',' || c == '/' || c == '}' ||
c == '=')
) {
1127 const char *errstr = NULL((void *)0);
1128
1129 *p = '\0';
1130 yylval.v.number = strtonum(buf, LLONG_MIN(-9223372036854775807LL -1LL),
1131 LLONG_MAX9223372036854775807LL, &errstr);
1132 if (errstr) {
1133 yyerror("\"%s\" invalid number: %s",
1134 buf, errstr);
1135 return (findeol());
1136 }
1137 return (NUMBER343);
1138 } else {
1139nodigits:
1140 while (p > buf + 1)
1141 lungetc((unsigned char)*--p);
1142 c = (unsigned char)*--p;
1143 if (c == '-')
1144 return (c);
1145 }
1146 }
1147
1148#define allowed_in_string(x)(isalnum(x) || (ispunct(x) && x != '(' && x !=
')' && x != '{' && x != '}' && x != '<'
&& x != '>' && x != '!' && x != '='
&& x != '/' && x != '#' && x != ',')
)
\
1149 (isalnum(x) || (ispunct(x) && x != '(' && x != ')' && \
1150 x != '{' && x != '}' && x != '<' && x != '>' && \
1151 x != '!' && x != '=' && x != '/' && x != '#' && \
1152 x != ','))
1153
1154 if (isalnum(c) || c == ':' || c == '_' || c == '*') {
1155 do {
1156 *p++ = c;
1157 if ((size_t)(p-buf) >= sizeof(buf)) {
1158 yyerror("string too long");
1159 return (findeol());
1160 }
1161 } while ((c = lgetc(0)) != EOF(-1) && (allowed_in_string(c)(isalnum(c) || (ispunct(c) && c != '(' && c !=
')' && c != '{' && c != '}' && c != '<'
&& c != '>' && c != '!' && c != '='
&& c != '/' && c != '#' && c != ',')
)
));
1162 lungetc(c);
1163 *p = '\0';
1164 if ((token = lookup(buf)) == STRING342)
1165 if ((yylval.v.string = strdup(buf)) == NULL((void *)0))
1166 hostapd_fatal("yylex: strdup");
1167 return (token);
1168 }
1169 if (c == '\n') {
1170 yylval.lineno = file->lineno;
1171 file->lineno++;
1172 }
1173 if (c == EOF(-1))
1174 return (0);
1175 return (c);
1176}
1177
1178int
1179symset(const char *nam, const char *val, int persist)
1180{
1181 struct sym *sym;
1182
1183 TAILQ_FOREACH(sym, &symhead, entry)for((sym) = ((&symhead)->tqh_first); (sym) != ((void *
)0); (sym) = ((sym)->entry.tqe_next))
{
1184 if (strcmp(nam, sym->nam) == 0)
1185 break;
1186 }
1187
1188 if (sym != NULL((void *)0)) {
1189 if (sym->persist == 1)
1190 return (0);
1191 else {
1192 free(sym->nam);
1193 free(sym->val);
1194 TAILQ_REMOVE(&symhead, sym, entry)do { if (((sym)->entry.tqe_next) != ((void *)0)) (sym)->
entry.tqe_next->entry.tqe_prev = (sym)->entry.tqe_prev;
else (&symhead)->tqh_last = (sym)->entry.tqe_prev;
*(sym)->entry.tqe_prev = (sym)->entry.tqe_next; ; ; } while
(0)
;
1195 free(sym);
1196 }
1197 }
1198 if ((sym = calloc(1, sizeof(*sym))) == NULL((void *)0))
1199 return (-1);
1200
1201 sym->nam = strdup(nam);
1202 if (sym->nam == NULL((void *)0)) {
1203 free(sym);
1204 return (-1);
1205 }
1206 sym->val = strdup(val);
1207 if (sym->val == NULL((void *)0)) {
1208 free(sym->nam);
1209 free(sym);
1210 return (-1);
1211 }
1212 sym->used = 0;
1213 sym->persist = persist;
1214 TAILQ_INSERT_TAIL(&symhead, sym, entry)do { (sym)->entry.tqe_next = ((void *)0); (sym)->entry.
tqe_prev = (&symhead)->tqh_last; *(&symhead)->tqh_last
= (sym); (&symhead)->tqh_last = &(sym)->entry.
tqe_next; } while (0)
;
1215
1216 hostapd_log(HOSTAPD_LOG_DEBUG2, "%s = \"%s\"", sym->nam, sym->val);
1217
1218 return (0);
1219}
1220
1221int
1222hostapd_parse_symset(char *s)
1223{
1224 char *sym, *val;
1225 int ret;
1226 size_t len;
1227
1228 if ((val = strrchr(s, '=')) == NULL((void *)0))
1229 return (-1);
1230
1231 len = strlen(s) - strlen(val) + 1;
1232 if ((sym = malloc(len)) == NULL((void *)0))
1233 hostapd_fatal("cmdline_symset: malloc");
1234
1235 (void)strlcpy(sym, s, len);
1236
1237 ret = symset(sym, val + 1, 1);
1238
1239 free(sym);
1240
1241 return (ret);
1242}
1243
1244char *
1245symget(const char *nam)
1246{
1247 struct sym *sym;
1248
1249 TAILQ_FOREACH(sym, &symhead, entry)for((sym) = ((&symhead)->tqh_first); (sym) != ((void *
)0); (sym) = ((sym)->entry.tqe_next))
{
1250 if (strcmp(nam, sym->nam) == 0) {
1251 sym->used = 1;
1252 return (sym->val);
1253 }
1254 }
1255 return (NULL((void *)0));
1256}
1257
1258int
1259check_file_secrecy(int fd, const char *fname)
1260{
1261 struct stat st;
1262
1263 if (fstat(fd, &st)) {
1264 warn("cannot stat %s", fname);
1265 return (-1);
1266 }
1267 if (st.st_uid != 0 && st.st_uid != getuid()) {
1268 warnx("%s: owner not root or current user", fname);
1269 return (-1);
1270 }
1271 if (st.st_mode & (S_IWGRP0000020 | S_IXGRP0000010 | S_IRWXO0000007)) {
1272 warnx("%s: group writable or world read/writable", fname);
1273 return (-1);
1274 }
1275 return (0);
1276}
1277
1278struct file *
1279pushfile(const char *name, int secret)
1280{
1281 struct file *nfile;
1282
1283 if ((nfile = calloc(1, sizeof(struct file))) == NULL((void *)0)) {
1284 warn("%s", __func__);
1285 return (NULL((void *)0));
1286 }
1287 if ((nfile->name = strdup(name)) == NULL((void *)0)) {
1288 warn("%s", __func__);
1289 free(nfile);
1290 return (NULL((void *)0));
1291 }
1292 if ((nfile->stream = fopen(nfile->name, "r")) == NULL((void *)0)) {
1293 warn("%s: %s", __func__, nfile->name);
1294 free(nfile->name);
1295 free(nfile);
1296 return (NULL((void *)0));
1297 } else if (secret &&
1298 check_file_secrecy(fileno(nfile->stream)(!__isthreaded ? ((nfile->stream)->_file) : (fileno)(nfile
->stream))
, nfile->name)) {
1299 fclose(nfile->stream);
1300 free(nfile->name);
1301 free(nfile);
1302 return (NULL((void *)0));
1303 }
1304 nfile->lineno = TAILQ_EMPTY(&files)(((&files)->tqh_first) == ((void *)0)) ? 1 : 0;
1305 nfile->ungetsize = 16;
1306 nfile->ungetbuf = malloc(nfile->ungetsize);
1307 if (nfile->ungetbuf == NULL((void *)0)) {
1308 warn("%s", __func__);
1309 fclose(nfile->stream);
1310 free(nfile->name);
1311 free(nfile);
1312 return (NULL((void *)0));
1313 }
1314 TAILQ_INSERT_TAIL(&files, nfile, entry)do { (nfile)->entry.tqe_next = ((void *)0); (nfile)->entry
.tqe_prev = (&files)->tqh_last; *(&files)->tqh_last
= (nfile); (&files)->tqh_last = &(nfile)->entry
.tqe_next; } while (0)
;
1315 return (nfile);
1316}
1317
1318int
1319popfile(void)
1320{
1321 struct file *prev;
1322
1323 if ((prev = TAILQ_PREV(file, files, entry)(*(((struct files *)((file)->entry.tqe_prev))->tqh_last
))
) != NULL((void *)0))
1324 prev->errors += file->errors;
1325
1326 TAILQ_REMOVE(&files, file, entry)do { if (((file)->entry.tqe_next) != ((void *)0)) (file)->
entry.tqe_next->entry.tqe_prev = (file)->entry.tqe_prev
; else (&files)->tqh_last = (file)->entry.tqe_prev;
*(file)->entry.tqe_prev = (file)->entry.tqe_next; ; ; }
while (0)
;
1327 fclose(file->stream);
1328 free(file->name);
1329 free(file->ungetbuf);
1330 free(file);
1331 file = prev;
1332 return (file ? 0 : EOF(-1));
1333}
1334
1335int
1336hostapd_parse_file(struct hostapd_config *cfg)
1337{
1338 struct sym *sym, *next;
1339 int errors = 0;
1340 int ret;
1341
1342 if ((file = pushfile(cfg->c_config, 1)) == NULL((void *)0))
1343 hostapd_fatal("failed to open the main config file: %s\n",
1344 cfg->c_config);
1345 topfile = file;
1346
1347 /* Init tables and data structures */
1348 TAILQ_INIT(&cfg->c_apmes)do { (&cfg->c_apmes)->tqh_first = ((void *)0); (&
cfg->c_apmes)->tqh_last = &(&cfg->c_apmes)->
tqh_first; } while (0)
;
1349 TAILQ_INIT(&cfg->c_tables)do { (&cfg->c_tables)->tqh_first = ((void *)0); (&
cfg->c_tables)->tqh_last = &(&cfg->c_tables)
->tqh_first; } while (0)
;
1350 TAILQ_INIT(&cfg->c_frames)do { (&cfg->c_frames)->tqh_first = ((void *)0); (&
cfg->c_frames)->tqh_last = &(&cfg->c_frames)
->tqh_first; } while (0)
;
1351 cfg->c_iapp.i_multicast.sin_addr.s_addr = INADDR_ANY((u_int32_t)(0x00000000));
1352 cfg->c_iapp.i_flags = HOSTAPD_IAPP_F_DEFAULT(0x01 | 0x02);
1353 cfg->c_iapp.i_ttl = IP_DEFAULT_MULTICAST_TTL1;
1354 cfg->c_apme_hopdelay.tv_sec = HOSTAPD_HOPPER_MDELAY800 / 1000;
1355 cfg->c_apme_hopdelay.tv_usec = (HOSTAPD_HOPPER_MDELAY800 % 1000) * 1000;
1356
1357 ret = yyparse();
1358 errors = file->errors;
1359 popfile();
1360
1361 /* Free macros and check which have not been used. */
1362 TAILQ_FOREACH_SAFE(sym, &symhead, entry, next)for ((sym) = ((&symhead)->tqh_first); (sym) != ((void *
)0) && ((next) = ((sym)->entry.tqe_next), 1); (sym
) = (next))
{
1363 if (!sym->used)
1364 hostapd_log(HOSTAPD_LOG_VERBOSE1,
1365 "warning: macro '%s' not used", sym->nam);
1366 if (!sym->persist) {
1367 free(sym->nam);
1368 free(sym->val);
1369 TAILQ_REMOVE(&symhead, sym, entry)do { if (((sym)->entry.tqe_next) != ((void *)0)) (sym)->
entry.tqe_next->entry.tqe_prev = (sym)->entry.tqe_prev;
else (&symhead)->tqh_last = (sym)->entry.tqe_prev;
*(sym)->entry.tqe_prev = (sym)->entry.tqe_next; ; ; } while
(0)
;
1370 free(sym);
1371 }
1372 }
1373
1374 return (errors ? EINVAL22 : ret);
1375}
1376
1377int
1378yyerror(const char *fmt, ...)
1379{
1380 va_list ap;
1381 char *msg;
1382
1383 file->errors++;
1384
1385 va_start(ap, fmt)__builtin_va_start(ap, fmt);
1386 if (vasprintf(&msg, fmt, ap) == -1)
1387 hostapd_fatal("yyerror vasprintf");
1388 va_end(ap)__builtin_va_end(ap);
1389 fprintf(stderr(&__sF[2]), "%s:%d: %s\n", file->name, yylval.lineno, msg);
1390 fflush(stderr(&__sF[2]));
1391 free(msg);
1392
1393 return (0);
1394}
1395#line 1388 "parse.c"
1396/* allocate initial stack or double stack size, up to YYMAXDEPTH */
1397static int yygrowstack(void)
1398{
1399 unsigned int newsize;
1400 long sslen;
1401 short *newss;
1402 YYSTYPE *newvs;
1403
1404 if ((newsize = yystacksize) == 0)
3
Assuming the condition is false
4
Taking false branch
1405 newsize = YYINITSTACKSIZE200;
1406 else if (newsize >= YYMAXDEPTH10000)
5
Assuming 'newsize' is < YYMAXDEPTH
6
Taking false branch
1407 return -1;
1408 else if ((newsize *= 2) > YYMAXDEPTH10000)
7
Assuming the condition is false
8
Taking false branch
1409 newsize = YYMAXDEPTH10000;
1410 sslen = yyssp - yyss;
1411#ifdef SIZE_MAX0xffffffffffffffffUL
1412#define YY_SIZE_MAX0xffffffffffffffffUL SIZE_MAX0xffffffffffffffffUL
1413#else
1414#define YY_SIZE_MAX0xffffffffffffffffUL 0xffffffffU
1415#endif
1416 if (newsize && YY_SIZE_MAX0xffffffffffffffffUL / newsize < sizeof *newss)
9
Assuming 'newsize' is 0
1417 goto bail;
1418 newss = (short *)realloc(yyss, newsize * sizeof *newss);
1419 if (newss == NULL((void *)0))
10
Assuming 'newss' is not equal to NULL
11
Taking false branch
1420 goto bail;
1421 yyss = newss;
1422 yyssp = newss + sslen;
1423 if (newsize
11.1
'newsize' is 0
&& YY_SIZE_MAX0xffffffffffffffffUL / newsize < sizeof *newvs)
1424 goto bail;
1425 newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs);
12
Memory is released
1426 if (newvs == NULL((void *)0))
13
Assuming 'newvs' is equal to NULL
14
Taking true branch
1427 goto bail;
15
Control jumps to line 1434
1428 yyvs = newvs;
1429 yyvsp = newvs + sslen;
1430 yystacksize = newsize;
1431 yysslim = yyss + newsize - 1;
1432 return 0;
1433bail:
1434 if (yyss
15.1
'yyss' is non-null
)
16
Taking true branch
1435 free(yyss);
1436 if (yyvs)
17
Assuming 'yyvs' is non-null
18
Taking true branch
1437 free(yyvs);
19
Attempt to free released memory
1438 yyss = yyssp = NULL((void *)0);
1439 yyvs = yyvsp = NULL((void *)0);
1440 yystacksize = 0;
1441 return -1;
1442}
1443
1444#define YYABORTgoto yyabort goto yyabort
1445#define YYREJECTgoto yyabort goto yyabort
1446#define YYACCEPTgoto yyaccept goto yyaccept
1447#define YYERRORgoto yyerrlab goto yyerrlab
1448int
1449yyparse(void)
1450{
1451 int yym, yyn, yystate;
1452#if YYDEBUG0
1453 const char *yys;
1454
1455 if ((yys = getenv("YYDEBUG")))
1456 {
1457 yyn = *yys;
1458 if (yyn >= '0' && yyn <= '9')
1459 yydebug = yyn - '0';
1460 }
1461#endif /* YYDEBUG */
1462
1463 yynerrs = 0;
1464 yyerrflag = 0;
1465 yychar = (-1);
1466
1467 if (yyss == NULL((void *)0) && yygrowstack()) goto yyoverflow;
1
Assuming 'yyss' is equal to NULL
2
Calling 'yygrowstack'
1468 yyssp = yyss;
1469 yyvsp = yyvs;
1470 *yyssp = yystate = 0;
1471
1472yyloop:
1473 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1474 if (yychar < 0)
1475 {
1476 if ((yychar = yylex()) < 0) yychar = 0;
1477#if YYDEBUG0
1478 if (yydebug)
1479 {
1480 yys = 0;
1481 if (yychar <= YYMAXTOKEN344) yys = yyname[yychar];
1482 if (!yys) yys = "illegal-symbol";
1483 printf("%sdebug: state %d, reading %d (%s)\n",
1484 YYPREFIX"yy", yystate, yychar, yys);
1485 }
1486#endif
1487 }
1488 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
1489 yyn <= YYTABLESIZE512 && yycheck[yyn] == yychar)
1490 {
1491#if YYDEBUG0
1492 if (yydebug)
1493 printf("%sdebug: state %d, shifting to state %d\n",
1494 YYPREFIX"yy", yystate, yytable[yyn]);
1495#endif
1496 if (yyssp >= yysslim && yygrowstack())
1497 {
1498 goto yyoverflow;
1499 }
1500 *++yyssp = yystate = yytable[yyn];
1501 *++yyvsp = yylval;
1502 yychar = (-1);
1503 if (yyerrflag > 0) --yyerrflag;
1504 goto yyloop;
1505 }
1506 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
1507 yyn <= YYTABLESIZE512 && yycheck[yyn] == yychar)
1508 {
1509 yyn = yytable[yyn];
1510 goto yyreduce;
1511 }
1512 if (yyerrflag) goto yyinrecovery;
1513#if defined(__GNUC__4)
1514 goto yynewerror;
1515#endif
1516yynewerror:
1517 yyerror("syntax error");
1518#if defined(__GNUC__4)
1519 goto yyerrlab;
1520#endif
1521yyerrlab:
1522 ++yynerrs;
1523yyinrecovery:
1524 if (yyerrflag < 3)
1525 {
1526 yyerrflag = 3;
1527 for (;;)
1528 {
1529 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE256) >= 0 &&
1530 yyn <= YYTABLESIZE512 && yycheck[yyn] == YYERRCODE256)
1531 {
1532#if YYDEBUG0
1533 if (yydebug)
1534 printf("%sdebug: state %d, error recovery shifting\
1535 to state %d\n", YYPREFIX"yy", *yyssp, yytable[yyn]);
1536#endif
1537 if (yyssp >= yysslim && yygrowstack())
1538 {
1539 goto yyoverflow;
1540 }
1541 *++yyssp = yystate = yytable[yyn];
1542 *++yyvsp = yylval;
1543 goto yyloop;
1544 }
1545 else
1546 {
1547#if YYDEBUG0
1548 if (yydebug)
1549 printf("%sdebug: error recovery discarding state %d\n",
1550 YYPREFIX"yy", *yyssp);
1551#endif
1552 if (yyssp <= yyss) goto yyabort;
1553 --yyssp;
1554 --yyvsp;
1555 }
1556 }
1557 }
1558 else
1559 {
1560 if (yychar == 0) goto yyabort;
1561#if YYDEBUG0
1562 if (yydebug)
1563 {
1564 yys = 0;
1565 if (yychar <= YYMAXTOKEN344) yys = yyname[yychar];
1566 if (!yys) yys = "illegal-symbol";
1567 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1568 YYPREFIX"yy", yystate, yychar, yys);
1569 }
1570#endif
1571 yychar = (-1);
1572 goto yyloop;
1573 }
1574yyreduce:
1575#if YYDEBUG0
1576 if (yydebug)
1577 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1578 YYPREFIX"yy", yystate, yyn, yyrule[yyn]);
1579#endif
1580 yym = yylen[yyn];
1581 if (yym)
1582 yyval = yyvsp[1-yym];
1583 else
1584 memset(&yyval, 0, sizeof yyval);
1585 switch (yyn)
1586 {
1587case 8:
1588#line 190 "/usr/src/usr.sbin/hostapd/parse.y"
1589{ file->errors++; }
1590break;
1591case 9:
1592#line 194 "/usr/src/usr.sbin/hostapd/parse.y"
1593{
1594 struct file *nfile;
1595
1596 if ((nfile = pushfile(yyvsp[0].v.string, 1)) == NULL((void *)0)) {
1597 yyerror("failed to include file %s", yyvsp[0].v.string);
1598 free(yyvsp[0].v.string);
1599 YYERRORgoto yyerrlab;
1600 }
1601 free(yyvsp[0].v.string);
1602
1603 file = nfile;
1604 lungetc('\n');
1605 }
1606break;
1607case 10:
1608#line 209 "/usr/src/usr.sbin/hostapd/parse.y"
1609{
1610 if (!TAILQ_EMPTY(&hostapd_cfg.c_apmes)(((&hostapd_cfg.c_apmes)->tqh_first) == ((void *)0)))
1611 hostapd_cfg.c_flags |= HOSTAPD_CFG_F_APME0x01;
1612 }
1613break;
1614case 12:
1615#line 215 "/usr/src/usr.sbin/hostapd/parse.y"
1616{
1617 bcopy(&yyvsp[0].v.timeout, &hostapd_cfg.c_apme_hopdelay,
1618 sizeof(struct timeval));
1619 }
1620break;
1621case 14:
1622#line 221 "/usr/src/usr.sbin/hostapd/parse.y"
1623{
1624 if (strlcpy(hostapd_cfg.c_iapp.i_iface, yyvsp[-1].v.string,
1625 sizeof(hostapd_cfg.c_iapp.i_iface)) >=
1626 sizeof(hostapd_cfg.c_iapp.i_iface)) {
1627 yyerror("invalid interface %s", yyvsp[-1].v.string);
1628 free(yyvsp[-1].v.string);
1629 YYERRORgoto yyerrlab;
1630 }
1631
1632 hostapd_cfg.c_flags |= HOSTAPD_CFG_F_IAPP0x02;
1633
1634 hostapd_log(HOSTAPD_LOG_DEBUG2,
1635 "%s: IAPP interface added", yyvsp[-1].v.string);
1636
1637 free(yyvsp[-1].v.string);
1638 }
1639break;
1640case 16:
1641#line 239 "/usr/src/usr.sbin/hostapd/parse.y"
1642{
1643 if ((hostapd_cfg.c_iapp.i_addr_tbl =
1644 hostapd_table_lookup(&hostapd_cfg, yyvsp[0].v.string)) == NULL((void *)0)) {
1645 yyerror("undefined table <%s>", yyvsp[0].v.string);
1646 free(yyvsp[0].v.string);
1647 YYERRORgoto yyerrlab;
1648 }
1649 free(yyvsp[0].v.string);
1650 }
1651break;
1652case 17:
1653#line 249 "/usr/src/usr.sbin/hostapd/parse.y"
1654{
1655 if ((hostapd_cfg.c_iapp.i_route_tbl =
1656 hostapd_table_lookup(&hostapd_cfg, yyvsp[0].v.string)) == NULL((void *)0)) {
1657 yyerror("undefined table <%s>", yyvsp[0].v.string);
1658 free(yyvsp[0].v.string);
1659 YYERRORgoto yyerrlab;
1660 }
1661 free(yyvsp[0].v.string);
1662 }
1663break;
1664case 19:
1665#line 262 "/usr/src/usr.sbin/hostapd/parse.y"
1666{
1667 hostapd_cfg.c_flags &= ~HOSTAPD_CFG_F_BRDCAST0x20;
1668 }
1669break;
1670case 20:
1671#line 266 "/usr/src/usr.sbin/hostapd/parse.y"
1672{
1673 hostapd_cfg.c_flags |= HOSTAPD_CFG_F_BRDCAST0x20;
1674 }
1675break;
1676case 22:
1677#line 273 "/usr/src/usr.sbin/hostapd/parse.y"
1678{
1679 bcopy(&yyvsp[0].v.in, &hostapd_cfg.c_iapp.i_multicast.sin_addr,
1680 sizeof(struct in_addr));
1681 }
1682break;
1683case 24:
1684#line 281 "/usr/src/usr.sbin/hostapd/parse.y"
1685{
1686 if (yyvsp[0].v.number < 0 || yyvsp[0].v.number > UINT16_MAX0xffff) {
1687 yyerror("port out of range: %lld", yyvsp[0].v.number);
1688 YYERRORgoto yyerrlab;
1689 }
1690 hostapd_cfg.c_iapp.i_addr.sin_port = htons(yyvsp[0].v.number)(__uint16_t)(__builtin_constant_p(yyvsp[0].v.number) ? (__uint16_t
)(((__uint16_t)(yyvsp[0].v.number) & 0xffU) << 8 | (
(__uint16_t)(yyvsp[0].v.number) & 0xff00U) >> 8) : __swap16md
(yyvsp[0].v.number))
;
1691 }
1692break;
1693case 26:
1694#line 292 "/usr/src/usr.sbin/hostapd/parse.y"
1695{
1696 if (yyvsp[0].v.number < 1 || yyvsp[0].v.number > UINT8_MAX0xff) {
1697 yyerror("ttl out of range: %lld", yyvsp[0].v.number);
1698 YYERRORgoto yyerrlab;
1699 }
1700 hostapd_cfg.c_iapp.i_ttl = yyvsp[0].v.number;
1701 }
1702break;
1703case 27:
1704#line 302 "/usr/src/usr.sbin/hostapd/parse.y"
1705{
1706 hostapd_cfg.c_apme_dlt = DLT_IEEE802_11_RADIO127;
1707 }
1708break;
1709case 28:
1710#line 306 "/usr/src/usr.sbin/hostapd/parse.y"
1711{
1712 hostapd_cfg.c_apme_dlt = DLT_IEEE802_11105;
1713 }
1714break;
1715case 33:
1716#line 320 "/usr/src/usr.sbin/hostapd/parse.y"
1717{
1718 if (hostapd_apme_add(&hostapd_cfg, yyvsp[0].v.string) != 0) {
1719 yyerror("failed to add hostap interface");
1720 YYERRORgoto yyerrlab;
1721 }
1722 free(yyvsp[0].v.string);
1723 }
1724break;
1725case 38:
1726#line 338 "/usr/src/usr.sbin/hostapd/parse.y"
1727{
1728 if ((apme = hostapd_apme_addhopper(&hostapd_cfg,
1729 yyvsp[0].v.string)) == NULL((void *)0)) {
1730 yyerror("failed to add hopper %s", yyvsp[0].v.string);
1731 free(yyvsp[0].v.string);
1732 YYERRORgoto yyerrlab;
1733 }
1734 free(yyvsp[0].v.string);
1735 }
1736break;
1737case 40:
1738#line 351 "/usr/src/usr.sbin/hostapd/parse.y"
1739{
1740 if ((frame.f_apme =
1741 hostapd_apme_lookup(&hostapd_cfg, yyvsp[0].v.string)) == NULL((void *)0)) {
1742 yyerror("undefined hostap interface");
1743 free(yyvsp[0].v.string);
1744 YYERRORgoto yyerrlab;
1745 }
1746 free(yyvsp[0].v.string);
1747
1748 HOSTAPD_MATCH(APME, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00010000 : 0x00008000
; }
;
1749 }
1750break;
1751case 41:
1752#line 365 "/usr/src/usr.sbin/hostapd/parse.y"
1753{
1754 bzero(&frame, sizeof(struct hostapd_frame));
1755 /* IEEE 802.11 frame to match */
1756 frame_ieee80211 = &frame.f_frame;
1757 }
1758break;
1759case 42:
1760#line 369 "/usr/src/usr.sbin/hostapd/parse.y"
1761{
1762 /* IEEE 802.11 raw frame to send as an action */
1763 frame_ieee80211 = &frame.f_action_data.a_framea_data.u_frame;
1764 }
1765break;
1766case 43:
1767#line 372 "/usr/src/usr.sbin/hostapd/parse.y"
1768{
1769 if ((frame_ptr = calloc(1, sizeof(struct hostapd_frame)))
1770 == NULL((void *)0)) {
1771 yyerror("calloc");
1772 YYERRORgoto yyerrlab;
1773 }
1774
1775 if (gettimeofday(&frame.f_last, NULL((void *)0)) == -1)
1776 hostapd_fatal("gettimeofday");
1777 timeradd(&frame.f_last, &frame.f_limit, &frame.f_then)do { (&frame.f_then)->tv_sec = (&frame.f_last)->
tv_sec + (&frame.f_limit)->tv_sec; (&frame.f_then)
->tv_usec = (&frame.f_last)->tv_usec + (&frame.
f_limit)->tv_usec; if ((&frame.f_then)->tv_usec >=
1000000) { (&frame.f_then)->tv_sec++; (&frame.f_then
)->tv_usec -= 1000000; } } while (0)
;
1778
1779 bcopy(&frame, frame_ptr, sizeof(struct hostapd_frame));
1780 TAILQ_INSERT_TAIL(&hostapd_cfg.c_frames,do { (frame_ptr)->f_entries.tqe_next = ((void *)0); (frame_ptr
)->f_entries.tqe_prev = (&hostapd_cfg.c_frames)->tqh_last
; *(&hostapd_cfg.c_frames)->tqh_last = (frame_ptr); (&
hostapd_cfg.c_frames)->tqh_last = &(frame_ptr)->f_entries
.tqe_next; } while (0)
1781 frame_ptr, f_entries)do { (frame_ptr)->f_entries.tqe_next = ((void *)0); (frame_ptr
)->f_entries.tqe_prev = (&hostapd_cfg.c_frames)->tqh_last
; *(&hostapd_cfg.c_frames)->tqh_last = (frame_ptr); (&
hostapd_cfg.c_frames)->tqh_last = &(frame_ptr)->f_entries
.tqe_next; } while (0)
;
1782 }
1783break;
1784case 48:
1785#line 398 "/usr/src/usr.sbin/hostapd/parse.y"
1786{
1787 HOSTAPD_IAPP_FLAG(ADD_NOTIFY, yyvsp[-2].v.number){ if (yyvsp[-2].v.number) hostapd_cfg.c_iapp.i_flags &= ~
(0x01); else hostapd_cfg.c_iapp.i_flags |= (0x01); }
;
1788 }
1789break;
1790case 49:
1791#line 402 "/usr/src/usr.sbin/hostapd/parse.y"
1792{
1793 HOSTAPD_IAPP_FLAG(RADIOTAP, yyvsp[-1].v.number){ if (yyvsp[-1].v.number) hostapd_cfg.c_iapp.i_flags &= ~
(0x02); else hostapd_cfg.c_iapp.i_flags |= (0x02); }
;
1794 }
1795break;
1796case 50:
1797#line 406 "/usr/src/usr.sbin/hostapd/parse.y"
1798{
1799 HOSTAPD_IAPP_FLAG(ROAMING_ROUTE, yyvsp[-2].v.number){ if (yyvsp[-2].v.number) hostapd_cfg.c_iapp.i_flags &= ~
(0x08); else hostapd_cfg.c_iapp.i_flags |= (0x08); }
;
1800 }
1801break;
1802case 51:
1803#line 410 "/usr/src/usr.sbin/hostapd/parse.y"
1804{
1805 HOSTAPD_IAPP_FLAG(ROAMING_ADDRESS, yyvsp[-2].v.number){ if (yyvsp[-2].v.number) hostapd_cfg.c_iapp.i_flags &= ~
(0x04); else hostapd_cfg.c_iapp.i_flags |= (0x04); }
;
1806 }
1807break;
1808case 52:
1809#line 416 "/usr/src/usr.sbin/hostapd/parse.y"
1810{
1811 frame.f_flags |= HOSTAPD_FRAME_F_RET_OK0x00000000;
1812 }
1813break;
1814case 53:
1815#line 420 "/usr/src/usr.sbin/hostapd/parse.y"
1816{
1817 frame.f_flags |= HOSTAPD_FRAME_F_RET_QUICK0x10000000;
1818 }
1819break;
1820case 54:
1821#line 424 "/usr/src/usr.sbin/hostapd/parse.y"
1822{
1823 frame.f_flags |= HOSTAPD_FRAME_F_RET_SKIP0x20000000;
1824 }
1825break;
1826case 55:
1827#line 430 "/usr/src/usr.sbin/hostapd/parse.y"
1828{
1829 frame.f_action = HOSTAPD_ACTION_NONE;
1830 }
1831break;
1832case 56:
1833#line 434 "/usr/src/usr.sbin/hostapd/parse.y"
1834{
1835 frame.f_action = HOSTAPD_ACTION_LOG;
1836 }
1837break;
1838case 57:
1839#line 438 "/usr/src/usr.sbin/hostapd/parse.y"
1840{
1841 frame.f_action = HOSTAPD_ACTION_FRAME;
1842 }
1843break;
1844case 59:
1845#line 443 "/usr/src/usr.sbin/hostapd/parse.y"
1846{
1847 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_REF_M0x0fff) == 0) {
1848 bcopy(yyvsp[0].v.reflladdr.lladdr, frame.f_action_data.a_lladdra_data.u_lladdr,
1849 IEEE80211_ADDR_LEN6);
1850 } else
1851 frame.f_action_data.a_flags |= yyvsp[0].v.reflladdr.flags;
1852 }
1853break;
1854case 60:
1855#line 451 "/usr/src/usr.sbin/hostapd/parse.y"
1856{
1857 frame.f_action = HOSTAPD_ACTION_RESEND;
1858 }
1859break;
1860case 62:
1861#line 458 "/usr/src/usr.sbin/hostapd/parse.y"
1862{
1863 frame.f_action_flags |= HOSTAPD_ACTION_VERBOSE0x00000001;
1864 }
1865break;
1866case 63:
1867#line 464 "/usr/src/usr.sbin/hostapd/parse.y"
1868{
1869 frame.f_action = HOSTAPD_ACTION_RADIOTAP;
1870 }
1871break;
1872case 64:
1873#line 470 "/usr/src/usr.sbin/hostapd/parse.y"
1874{
1875 frame.f_action = HOSTAPD_ACTION_DELNODE;
1876 }
1877break;
1878case 65:
1879#line 474 "/usr/src/usr.sbin/hostapd/parse.y"
1880{
1881 frame.f_action = HOSTAPD_ACTION_ADDNODE;
1882 }
1883break;
1884case 72:
1885#line 493 "/usr/src/usr.sbin/hostapd/parse.y"
1886{
1887 if (yyvsp[-1].v.number < 0 || yyvsp[-1].v.number > LONG_MAX9223372036854775807L) {
1888 yyerror("limit out of range: %lld sec", yyvsp[-1].v.number);
1889 YYERRORgoto yyerrlab;
1890 }
1891 frame.f_limit.tv_sec = yyvsp[-1].v.number;
1892 }
1893break;
1894case 73:
1895#line 501 "/usr/src/usr.sbin/hostapd/parse.y"
1896{
1897 if (yyvsp[-1].v.number < 0 || yyvsp[-1].v.number > LONG_MAX9223372036854775807L) {
1898 yyerror("limit out of range: %lld usec", yyvsp[-1].v.number);
1899 YYERRORgoto yyerrlab;
1900 }
1901 frame.f_limit.tv_sec = yyvsp[-1].v.number / 1000000;
1902 frame.f_limit.tv_usec = yyvsp[-1].v.number % 1000000;
1903 }
1904break;
1905case 75:
1906#line 513 "/usr/src/usr.sbin/hostapd/parse.y"
1907{
1908 if ((yyvsp[-3].v.number < 1 || yyvsp[-3].v.number > LONG_MAX9223372036854775807L) ||
1909 (yyvsp[-1].v.number < 1 || yyvsp[-1].v.number > LONG_MAX9223372036854775807L)) {
1910 yyerror("rate out of range: %lld/%lld sec",
1911 yyvsp[-3].v.number, yyvsp[-1].v.number);
1912 YYERRORgoto yyerrlab;
1913 }
1914
1915 if (!(yyvsp[-3].v.number && yyvsp[-1].v.number)) {
1916 yyerror("invalid rate");
1917 YYERRORgoto yyerrlab;
1918 }
1919
1920 frame.f_rate = yyvsp[-3].v.number;
1921 frame.f_rate_intval = yyvsp[-1].v.number;
1922 }
1923break;
1924case 78:
1925#line 534 "/usr/src/usr.sbin/hostapd/parse.y"
1926{
1927 frame_ieee80211->i_fc[0] |=
1928 IEEE80211_FC0_TYPE_DATA0x08;
1929 HOSTAPD_MATCH(TYPE, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00000002 : 0x00000001
; }
;
1930 }
1931break;
1932case 79:
1933#line 540 "/usr/src/usr.sbin/hostapd/parse.y"
1934{
1935 frame_ieee80211->i_fc[0] |=
1936 IEEE80211_FC0_TYPE_MGT0x00;
1937 HOSTAPD_MATCH(TYPE, yyvsp[-2].v.number){ frame.f_flags |= (yyvsp[-2].v.number) ? 0x00000002 : 0x00000001
; }
;
1938 }
1939break;
1940case 82:
1941#line 550 "/usr/src/usr.sbin/hostapd/parse.y"
1942{
1943 HOSTAPD_MATCH(SUBTYPE, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00000008 : 0x00000004
; }
;
1944 }
1945break;
1946case 83:
1947#line 556 "/usr/src/usr.sbin/hostapd/parse.y"
1948{
1949 frame_ieee80211->i_fc[0] |=
1950 IEEE80211_FC0_SUBTYPE_PROBE_REQ0x40;
1951 }
1952break;
1953case 84:
1954#line 561 "/usr/src/usr.sbin/hostapd/parse.y"
1955{
1956 frame_ieee80211->i_fc[0] |=
1957 IEEE80211_FC0_SUBTYPE_PROBE_RESP0x50;
1958 }
1959break;
1960case 85:
1961#line 566 "/usr/src/usr.sbin/hostapd/parse.y"
1962{
1963 frame_ieee80211->i_fc[0] |=
1964 IEEE80211_FC0_SUBTYPE_BEACON0x80;
1965 }
1966break;
1967case 86:
1968#line 571 "/usr/src/usr.sbin/hostapd/parse.y"
1969{
1970 frame_ieee80211->i_fc[0] |=
1971 IEEE80211_FC0_SUBTYPE_ATIM0x90;
1972 }
1973break;
1974case 87:
1975#line 576 "/usr/src/usr.sbin/hostapd/parse.y"
1976{
1977 frame_ieee80211->i_fc[0] |=
1978 IEEE80211_FC0_SUBTYPE_AUTH0xb0;
1979 }
1980break;
1981case 88:
1982#line 581 "/usr/src/usr.sbin/hostapd/parse.y"
1983{
1984 frame_ieee80211->i_fc[0] |=
1985 IEEE80211_FC0_SUBTYPE_DEAUTH0xc0;
1986 }
1987break;
1988case 89:
1989#line 586 "/usr/src/usr.sbin/hostapd/parse.y"
1990{
1991 frame_ieee80211->i_fc[0] |=
1992 IEEE80211_FC0_SUBTYPE_ASSOC_REQ0x00;
1993 }
1994break;
1995case 90:
1996#line 591 "/usr/src/usr.sbin/hostapd/parse.y"
1997{
1998 frame_ieee80211->i_fc[0] |=
1999 IEEE80211_FC0_SUBTYPE_DISASSOC0xa0;
2000 }
2001break;
2002case 91:
2003#line 596 "/usr/src/usr.sbin/hostapd/parse.y"
2004{
2005 frame_ieee80211->i_fc[0] |=
2006 IEEE80211_FC0_SUBTYPE_ASSOC_RESP0x10;
2007 }
2008break;
2009case 92:
2010#line 601 "/usr/src/usr.sbin/hostapd/parse.y"
2011{
2012 frame_ieee80211->i_fc[0] |=
2013 IEEE80211_FC0_SUBTYPE_REASSOC_REQ0x20;
2014 }
2015break;
2016case 93:
2017#line 606 "/usr/src/usr.sbin/hostapd/parse.y"
2018{
2019 frame_ieee80211->i_fc[0] |=
2020 IEEE80211_FC0_SUBTYPE_REASSOC_RESP0x30;
2021 }
2022break;
2023case 100:
2024#line 625 "/usr/src/usr.sbin/hostapd/parse.y"
2025{
2026 if ((frame_ieee80211->i_data = malloc(6)) == NULL((void *)0)) {
2027 yyerror("failed to allocate auth");
2028 YYERRORgoto yyerrlab;
2029 }
2030 ((u_int16_t *)frame_ieee80211->i_data)[0] =
2031 yyvsp[0].v.authalg.alg;
2032 ((u_int16_t *)frame_ieee80211->i_data)[1] =
2033 yyvsp[0].v.authalg.transaction;
2034 ((u_int16_t *)frame_ieee80211->i_data)[0] = 0;
2035 frame_ieee80211->i_data_len = 6;
2036 }
2037break;
2038case 101:
2039#line 640 "/usr/src/usr.sbin/hostapd/parse.y"
2040{
2041 yyval.v.authalg.alg = htole16(IEEE80211_AUTH_ALG_OPEN)((__uint16_t)(0x0000));
2042 yyval.v.authalg.transaction = htole16(IEEE80211_AUTH_OPEN_REQUEST)((__uint16_t)(IEEE80211_AUTH_OPEN_REQUEST));
2043 }
2044break;
2045case 102:
2046#line 645 "/usr/src/usr.sbin/hostapd/parse.y"
2047{
2048 yyval.v.authalg.alg = htole16(IEEE80211_AUTH_ALG_OPEN)((__uint16_t)(0x0000));
2049 yyval.v.authalg.transaction = htole16(IEEE80211_AUTH_OPEN_RESPONSE)((__uint16_t)(IEEE80211_AUTH_OPEN_RESPONSE));
2050 }
2051break;
2052case 103:
2053#line 652 "/usr/src/usr.sbin/hostapd/parse.y"
2054{
2055 if (yyvsp[0].v.reason != 0) {
2056 if ((frame_ieee80211->i_data =
2057 malloc(sizeof(u_int16_t))) == NULL((void *)0)) {
2058 yyerror("failed to allocate "
2059 "reason code %u", yyvsp[0].v.reason);
2060 YYERRORgoto yyerrlab;
2061 }
2062 *(u_int16_t *)frame_ieee80211->i_data =
2063 htole16(yyvsp[0].v.reason)((__uint16_t)(yyvsp[0].v.reason));
2064 frame_ieee80211->i_data_len = sizeof(u_int16_t);
2065 }
2066 }
2067break;
2068case 104:
2069#line 668 "/usr/src/usr.sbin/hostapd/parse.y"
2070{
2071 yyval.v.reason = 0;
2072 }
2073break;
2074case 105:
2075#line 672 "/usr/src/usr.sbin/hostapd/parse.y"
2076{
2077 yyval.v.reason = IEEE80211_REASON_UNSPECIFIED;
2078 }
2079break;
2080case 106:
2081#line 676 "/usr/src/usr.sbin/hostapd/parse.y"
2082{
2083 yyval.v.reason = IEEE80211_REASON_AUTH_EXPIRE;
2084 }
2085break;
2086case 107:
2087#line 680 "/usr/src/usr.sbin/hostapd/parse.y"
2088{
2089 yyval.v.reason = IEEE80211_REASON_AUTH_LEAVE;
2090 }
2091break;
2092case 108:
2093#line 684 "/usr/src/usr.sbin/hostapd/parse.y"
2094{
2095 yyval.v.reason = IEEE80211_REASON_ASSOC_EXPIRE;
2096 }
2097break;
2098case 109:
2099#line 688 "/usr/src/usr.sbin/hostapd/parse.y"
2100{
2101 yyval.v.reason = IEEE80211_REASON_ASSOC_TOOMANY;
2102 }
2103break;
2104case 110:
2105#line 692 "/usr/src/usr.sbin/hostapd/parse.y"
2106{
2107 yyval.v.reason = IEEE80211_REASON_NOT_AUTHED;
2108 }
2109break;
2110case 111:
2111#line 696 "/usr/src/usr.sbin/hostapd/parse.y"
2112{
2113 yyval.v.reason = IEEE80211_REASON_NOT_ASSOCED;
2114 }
2115break;
2116case 112:
2117#line 700 "/usr/src/usr.sbin/hostapd/parse.y"
2118{
2119 yyval.v.reason = IEEE80211_REASON_ASSOC_LEAVE;
2120 }
2121break;
2122case 113:
2123#line 704 "/usr/src/usr.sbin/hostapd/parse.y"
2124{
2125 yyval.v.reason = IEEE80211_REASON_NOT_AUTHED;
2126 }
2127break;
2128case 114:
2129#line 708 "/usr/src/usr.sbin/hostapd/parse.y"
2130{
2131 yyval.v.reason = 10; /* XXX unknown */
2132 }
2133break;
2134case 115:
2135#line 712 "/usr/src/usr.sbin/hostapd/parse.y"
2136{
2137 yyval.v.reason = IEEE80211_REASON_RSN_REQUIRED;
2138 }
2139break;
2140case 116:
2141#line 716 "/usr/src/usr.sbin/hostapd/parse.y"
2142{
2143 yyval.v.reason = IEEE80211_REASON_RSN_INCONSISTENT;
2144 }
2145break;
2146case 117:
2147#line 720 "/usr/src/usr.sbin/hostapd/parse.y"
2148{
2149 yyval.v.reason = IEEE80211_REASON_IE_INVALID;
2150 }
2151break;
2152case 118:
2153#line 724 "/usr/src/usr.sbin/hostapd/parse.y"
2154{
2155 yyval.v.reason = IEEE80211_REASON_MIC_FAILURE;
2156 }
2157break;
2158case 121:
2159#line 732 "/usr/src/usr.sbin/hostapd/parse.y"
2160{
2161 HOSTAPD_MATCH(DIR, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00000020 : 0x00000010
; }
;
2162 }
2163break;
2164case 122:
2165#line 738 "/usr/src/usr.sbin/hostapd/parse.y"
2166{
2167 frame_ieee80211->i_fc[1] |= IEEE80211_FC1_DIR_NODS0x00;
2168 }
2169break;
2170case 123:
2171#line 742 "/usr/src/usr.sbin/hostapd/parse.y"
2172{
2173 frame_ieee80211->i_fc[1] |= IEEE80211_FC1_DIR_TODS0x01;
2174 }
2175break;
2176case 124:
2177#line 746 "/usr/src/usr.sbin/hostapd/parse.y"
2178{
2179 frame_ieee80211->i_fc[1] |= IEEE80211_FC1_DIR_FROMDS0x02;
2180 }
2181break;
2182case 125:
2183#line 750 "/usr/src/usr.sbin/hostapd/parse.y"
2184{
2185 frame_ieee80211->i_fc[1] |= IEEE80211_FC1_DIR_DSTODS0x03;
2186 }
2187break;
2188case 128:
2189#line 758 "/usr/src/usr.sbin/hostapd/parse.y"
2190{
2191 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_OPT_TABLE0x4000) == 0) {
2192 bcopy(yyvsp[0].v.reflladdr.lladdr, &frame_ieee80211->i_from,
2193 IEEE80211_ADDR_LEN6);
2194 HOSTAPD_MATCH(FROM, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00000080 : 0x00000040
; }
;
2195 } else {
2196 frame.f_from = yyvsp[0].v.reflladdr.table;
2197 HOSTAPD_MATCH_TABLE(FROM, yyvsp[-1].v.number){ frame.f_flags |= 0x00000100 | ((yyvsp[-1].v.number) ? 0x00000080
: 0x00000040); }
;
2198 }
2199 }
2200break;
2201case 131:
2202#line 773 "/usr/src/usr.sbin/hostapd/parse.y"
2203{
2204 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_OPT_TABLE0x4000) == 0) {
2205 bcopy(yyvsp[0].v.reflladdr.lladdr, &frame_ieee80211->i_to,
2206 IEEE80211_ADDR_LEN6);
2207 HOSTAPD_MATCH(TO, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00000400 : 0x00000200
; }
;
2208 } else {
2209 frame.f_to = yyvsp[0].v.reflladdr.table;
2210 HOSTAPD_MATCH_TABLE(TO, yyvsp[-1].v.number){ frame.f_flags |= 0x00000800 | ((yyvsp[-1].v.number) ? 0x00000400
: 0x00000200); }
;
2211 }
2212 }
2213break;
2214case 134:
2215#line 788 "/usr/src/usr.sbin/hostapd/parse.y"
2216{
2217 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_OPT_TABLE0x4000) == 0) {
2218 bcopy(yyvsp[0].v.reflladdr.lladdr, &frame_ieee80211->i_bssid,
2219 IEEE80211_ADDR_LEN6);
2220 HOSTAPD_MATCH(BSSID, yyvsp[-1].v.number){ frame.f_flags |= (yyvsp[-1].v.number) ? 0x00002000 : 0x00001000
; }
;
2221 } else {
2222 frame.f_bssid = yyvsp[0].v.reflladdr.table;
2223 HOSTAPD_MATCH_TABLE(BSSID, yyvsp[-1].v.number){ frame.f_flags |= 0x00004000 | ((yyvsp[-1].v.number) ? 0x00002000
: 0x00001000); }
;
2224 }
2225 }
2226break;
2227case 139:
2228#line 809 "/usr/src/usr.sbin/hostapd/parse.y"
2229{
2230 if ((yyvsp[-1].v.op == HOSTAPD_OP_GT && yyvsp[0].v.number == 100) ||
2231 (yyvsp[-1].v.op == HOSTAPD_OP_LE && yyvsp[0].v.number == 100) ||
2232 (yyvsp[-1].v.op == HOSTAPD_OP_LT && yyvsp[0].v.number == 0) ||
2233 (yyvsp[-1].v.op == HOSTAPD_OP_GE && yyvsp[0].v.number == 0)) {
2234 yyerror("absurd unary comparison");
2235 YYERRORgoto yyerrlab;
2236 }
2237
2238 frame.f_rssi_op = yyvsp[-1].v.op;
2239 frame.f_rssi = yyvsp[0].v.number;
2240 HOSTAPD_MATCH_RADIOTAP(RSSI){ if (hostapd_cfg.c_apme_dlt == 105 || (hostapd_cfg.c_apme_dlt
== 0 && 105 == 105)) { yyerror("option %s requires radiotap headers"
, "RSSI"); goto yyerrlab; } frame.f_radiotap |= (1 << IEEE80211_RADIOTAP_RSSI
); frame.f_flags |= 0x00020000; }
;
2241 }
2242break;
2243case 140:
2244#line 823 "/usr/src/usr.sbin/hostapd/parse.y"
2245{
2246 frame.f_txrate_op = yyvsp[-1].v.op;
2247 frame.f_txrate = yyvsp[0].v.number;
2248 HOSTAPD_MATCH_RADIOTAP(RATE){ if (hostapd_cfg.c_apme_dlt == 105 || (hostapd_cfg.c_apme_dlt
== 0 && 105 == 105)) { yyerror("option %s requires radiotap headers"
, "RATE"); goto yyerrlab; } frame.f_radiotap |= (1 << IEEE80211_RADIOTAP_RSSI
); frame.f_flags |= 0x00040000; }
;
2249 }
2250break;
2251case 141:
2252#line 829 "/usr/src/usr.sbin/hostapd/parse.y"
2253{
2254 frame.f_chan_op = yyvsp[-1].v.op;
2255 frame.f_chan = yyvsp[0].v.number;
2256 HOSTAPD_MATCH_RADIOTAP(CHANNEL){ if (hostapd_cfg.c_apme_dlt == 105 || (hostapd_cfg.c_apme_dlt
== 0 && 105 == 105)) { yyerror("option %s requires radiotap headers"
, "CHANNEL"); goto yyerrlab; } frame.f_radiotap |= (1 <<
IEEE80211_RADIOTAP_RSSI); frame.f_flags |= 0x00080000; }
;
2257 }
2258break;
2259case 142:
2260#line 837 "/usr/src/usr.sbin/hostapd/parse.y"
2261{
2262 if ((yyval.v.reflladdr.table =
2263 hostapd_table_lookup(&hostapd_cfg, yyvsp[0].v.string)) == NULL((void *)0)) {
2264 yyerror("undefined table <%s>", yyvsp[0].v.string);
2265 free(yyvsp[0].v.string);
2266 YYERRORgoto yyerrlab;
2267 }
2268 yyval.v.reflladdr.flags = HOSTAPD_ACTION_F_OPT_TABLE0x4000;
2269 free(yyvsp[0].v.string);
2270 }
2271break;
2272case 143:
2273#line 848 "/usr/src/usr.sbin/hostapd/parse.y"
2274{
2275 bcopy(yyvsp[0].v.reflladdr.lladdr, yyval.v.reflladdr.lladdr, IEEE80211_ADDR_LEN6);
2276 yyval.v.reflladdr.flags = HOSTAPD_ACTION_F_OPT_LLADDR0x2000;
2277 }
2278break;
2279case 144:
2280#line 855 "/usr/src/usr.sbin/hostapd/parse.y"
2281{
2282 frame_ieee80211->i_fc[0] |= IEEE80211_FC0_TYPE_DATA0x08;
2283 }
2284break;
2285case 145:
2286#line 859 "/usr/src/usr.sbin/hostapd/parse.y"
2287{
2288 frame_ieee80211->i_fc[0] |= IEEE80211_FC0_TYPE_MGT0x00;
2289 }
2290break;
2291case 147:
2292#line 868 "/usr/src/usr.sbin/hostapd/parse.y"
2293{
2294 frame.f_action_data.a_flags |=
2295 HOSTAPD_ACTION_F_OPT_DIR_AUTO0x1000;
2296 }
2297break;
2298case 149:
2299#line 876 "/usr/src/usr.sbin/hostapd/parse.y"
2300{
2301 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_REF_M0x0fff) == 0) {
2302 bcopy(yyvsp[0].v.reflladdr.lladdr, frame_ieee80211->i_from,
2303 IEEE80211_ADDR_LEN6);
2304 } else
2305 frame.f_action_data.a_flags |=
2306 (yyvsp[0].v.reflladdr.flags << HOSTAPD_ACTION_F_REF_FROM_S0);
2307 }
2308break;
2309case 150:
2310#line 887 "/usr/src/usr.sbin/hostapd/parse.y"
2311{
2312 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_REF_M0x0fff) == 0) {
2313 bcopy(yyvsp[0].v.reflladdr.lladdr, frame_ieee80211->i_to,
2314 IEEE80211_ADDR_LEN6);
2315 } else
2316 frame.f_action_data.a_flags |=
2317 (yyvsp[0].v.reflladdr.flags << HOSTAPD_ACTION_F_REF_TO_S4);
2318 }
2319break;
2320case 151:
2321#line 898 "/usr/src/usr.sbin/hostapd/parse.y"
2322{
2323 if ((yyvsp[0].v.reflladdr.flags & HOSTAPD_ACTION_F_REF_M0x0fff) == 0) {
2324 bcopy(yyvsp[0].v.reflladdr.lladdr, frame_ieee80211->i_bssid,
2325 IEEE80211_ADDR_LEN6);
2326 } else
2327 frame.f_action_data.a_flags |=
2328 (yyvsp[0].v.reflladdr.flags << HOSTAPD_ACTION_F_REF_BSSID_S8);
2329 }
2330break;
2331case 152:
2332#line 909 "/usr/src/usr.sbin/hostapd/parse.y"
2333{
2334 bcopy(yyvsp[0].v.reflladdr.lladdr, yyval.v.reflladdr.lladdr, IEEE80211_ADDR_LEN6);
2335 yyval.v.reflladdr.flags = yyvsp[0].v.reflladdr.flags;
2336 }
2337break;
2338case 153:
2339#line 914 "/usr/src/usr.sbin/hostapd/parse.y"
2340{
2341 yyval.v.reflladdr.flags = yyvsp[0].v.reflladdr.flags;
2342 }
2343break;
2344case 154:
2345#line 918 "/usr/src/usr.sbin/hostapd/parse.y"
2346{
2347 yyval.v.reflladdr.flags = yyvsp[0].v.reflladdr.flags;
2348 }
2349break;
2350case 155:
2351#line 923 "/usr/src/usr.sbin/hostapd/parse.y"
2352{
2353 if (strlen(yyvsp[-1].v.string) >= HOSTAPD_TABLE_NAMELEN32) {
2354 yyerror("table name %s too long, max %u",
2355 yyvsp[-1].v.string, HOSTAPD_TABLE_NAMELEN32 - 1);
2356 free(yyvsp[-1].v.string);
2357 YYERRORgoto yyerrlab;
2358 }
2359 yyval.v.string = yyvsp[-1].v.string;
2360 }
2361break;
2362case 156:
2363#line 934 "/usr/src/usr.sbin/hostapd/parse.y"
2364{
2365 if ((table =
2366 hostapd_table_add(&hostapd_cfg, yyvsp[0].v.string)) == NULL((void *)0)) {
2367 yyerror("failed to add table: %s", yyvsp[0].v.string);
2368 free(yyvsp[0].v.string);
2369 YYERRORgoto yyerrlab;
2370 }
2371 free(yyvsp[0].v.string);
2372 }
2373break;
2374case 157:
2375#line 942 "/usr/src/usr.sbin/hostapd/parse.y"
2376{
2377 table = NULL((void *)0);
2378 }
2379break;
2380case 162:
2381#line 955 "/usr/src/usr.sbin/hostapd/parse.y"
2382{
2383 if (table->t_flags & HOSTAPD_TABLE_F_CONST0x01) {
2384 yyerror("option already specified");
2385 YYERRORgoto yyerrlab;
2386 }
2387 table->t_flags |= HOSTAPD_TABLE_F_CONST0x01;
2388 }
2389break;
2390case 165:
2391#line 967 "/usr/src/usr.sbin/hostapd/parse.y"
2392{
2393 if (asprintf(&yyval.v.string, "%s %s", yyvsp[-1].v.string, yyvsp[0].v.string) == -1)
2394 hostapd_fatal("string: asprintf");
2395 free(yyvsp[-1].v.string);
2396 free(yyvsp[0].v.string);
2397 }
2398break;
2399case 167:
2400#line 977 "/usr/src/usr.sbin/hostapd/parse.y"
2401{
2402 char *s = yyvsp[-2].v.string;
2403 while (*s++) {
2404 if (isspace((unsigned char)*s)) {
2405 yyerror("macro name cannot contain "
2406 "whitespace");
2407 free(yyvsp[-2].v.string);
2408 free(yyvsp[0].v.string);
2409 YYERRORgoto yyerrlab;
2410 }
2411 }
2412 if (symset(yyvsp[-2].v.string, yyvsp[0].v.string, 0) == -1)
2413 hostapd_fatal("cannot store variable");
2414 free(yyvsp[-2].v.string);
2415 free(yyvsp[0].v.string);
2416 }
2417break;
2418case 168:
2419#line 996 "/usr/src/usr.sbin/hostapd/parse.y"
2420{
2421 yyval.v.reflladdr.flags |= HOSTAPD_ACTION_F_REF_FROM0x0001;
2422 }
2423break;
2424case 169:
2425#line 1000 "/usr/src/usr.sbin/hostapd/parse.y"
2426{
2427 yyval.v.reflladdr.flags |= HOSTAPD_ACTION_F_REF_TO0x0002;
2428 }
2429break;
2430case 170:
2431#line 1004 "/usr/src/usr.sbin/hostapd/parse.y"
2432{
2433 yyval.v.reflladdr.flags |= HOSTAPD_ACTION_F_REF_BSSID0x0004;
2434 }
2435break;
2436case 173:
2437#line 1014 "/usr/src/usr.sbin/hostapd/parse.y"
2438{
2439 if ((entry = hostapd_entry_add(table,
2440 yyvsp[0].v.reflladdr.lladdr)) == NULL((void *)0)) {
2441 yyerror("failed to add entry: %s",
2442 etheraddr_string(yyvsp[0].v.reflladdr.lladdr)ether_ntoa((struct ether_addr*)yyvsp[0].v.reflladdr.lladdr));
2443 YYERRORgoto yyerrlab;
2444 }
2445 }
2446break;
2447case 174:
2448#line 1021 "/usr/src/usr.sbin/hostapd/parse.y"
2449{
2450 entry = NULL((void *)0);
2451 }
2452break;
2453case 176:
2454#line 1028 "/usr/src/usr.sbin/hostapd/parse.y"
2455{
2456 entry->e_flags |= HOSTAPD_ENTRY_F_INADDR0x02;
2457 entry->e_inaddre_addr.a_inaddr.in_af = AF_INET2;
2458 bcopy(&yyvsp[-1].v.in, &entry->e_inaddre_addr.a_inaddr.in_v4in_v.v4,
2459 sizeof(struct in_addr));
2460 }
2461break;
2462case 177:
2463#line 1035 "/usr/src/usr.sbin/hostapd/parse.y"
2464{
2465 entry->e_flags |= HOSTAPD_ENTRY_F_MASK0x01;
2466 bcopy(yyvsp[0].v.reflladdr.lladdr, entry->e_maske_addr.a_mask, IEEE80211_ADDR_LEN6);
2467
2468 /* Update entry position in the table */
2469 hostapd_entry_update(table, entry);
2470 }
2471break;
2472case 178:
2473#line 1045 "/usr/src/usr.sbin/hostapd/parse.y"
2474{
2475 if (inet_net_pton(AF_INET2, yyvsp[0].v.string, &yyval.v.in, sizeof(yyval.v.in)) == -1) {
2476 yyerror("invalid address: %s\n", yyvsp[0].v.string);
2477 free(yyvsp[0].v.string);
2478 YYERRORgoto yyerrlab;
2479 }
2480 free(yyvsp[0].v.string);
2481 }
2482break;
2483case 179:
2484#line 1056 "/usr/src/usr.sbin/hostapd/parse.y"
2485{
2486 entry->e_inaddre_addr.a_inaddr.in_netmask = -1;
2487 }
2488break;
2489case 180:
2490#line 1060 "/usr/src/usr.sbin/hostapd/parse.y"
2491{
2492 if (yyvsp[0].v.number < 0 || yyvsp[0].v.number > 32) {
2493 yyerror("netmask out of range: %lld", yyvsp[0].v.number);
2494 YYERRORgoto yyerrlab;
2495 }
2496 entry->e_inaddre_addr.a_inaddr.in_netmask = yyvsp[0].v.number;
2497 }
2498break;
2499case 181:
2500#line 1070 "/usr/src/usr.sbin/hostapd/parse.y"
2501{
2502 struct ether_addr *ea;
2503
2504 if ((ea = ether_aton(yyvsp[0].v.string)) == NULL((void *)0)) {
2505 yyerror("invalid address: %s\n", yyvsp[0].v.string);
2506 free(yyvsp[0].v.string);
2507 YYERRORgoto yyerrlab;
2508 }
2509 free(yyvsp[0].v.string);
2510
2511 bcopy(ea, yyval.v.reflladdr.lladdr, IEEE80211_ADDR_LEN6);
2512 yyval.v.reflladdr.flags = HOSTAPD_ACTION_F_OPT_LLADDR0x2000;
2513 }
2514break;
2515case 182:
2516#line 1086 "/usr/src/usr.sbin/hostapd/parse.y"
2517{
2518 yyval.v.reflladdr.flags |= HOSTAPD_ACTION_F_REF_RANDOM0x0008;
2519 }
2520break;
2521case 184:
2522#line 1093 "/usr/src/usr.sbin/hostapd/parse.y"
2523{
2524 hostapd_cfg.c_flags |= HOSTAPD_CFG_F_IAPP_PASSIVE0x04;
2525 }
2526break;
2527case 191:
2528#line 1113 "/usr/src/usr.sbin/hostapd/parse.y"
2529{
2530 yyval.v.number = 0;
2531 }
2532break;
2533case 192:
2534#line 1117 "/usr/src/usr.sbin/hostapd/parse.y"
2535{
2536 yyval.v.number = 1;
2537 }
2538break;
2539case 193:
2540#line 1121 "/usr/src/usr.sbin/hostapd/parse.y"
2541{
2542 yyval.v.number = 1;
2543 }
2544break;
2545case 194:
2546#line 1127 "/usr/src/usr.sbin/hostapd/parse.y"
2547{
2548 yyval.v.op = HOSTAPD_OP_EQ;
2549 }
2550break;
2551case 195:
2552#line 1131 "/usr/src/usr.sbin/hostapd/parse.y"
2553{
2554 yyval.v.op = HOSTAPD_OP_EQ;
2555 }
2556break;
2557case 196:
2558#line 1135 "/usr/src/usr.sbin/hostapd/parse.y"
2559{
2560 yyval.v.op = HOSTAPD_OP_EQ;
2561 }
2562break;
2563case 197:
2564#line 1139 "/usr/src/usr.sbin/hostapd/parse.y"
2565{
2566 yyval.v.op = HOSTAPD_OP_NE;
2567 }
2568break;
2569case 198:
2570#line 1143 "/usr/src/usr.sbin/hostapd/parse.y"
2571{
2572 yyval.v.op = HOSTAPD_OP_NE;
2573 }
2574break;
2575case 199:
2576#line 1147 "/usr/src/usr.sbin/hostapd/parse.y"
2577{
2578 yyval.v.op = HOSTAPD_OP_LE;
2579 }
2580break;
2581case 200:
2582#line 1151 "/usr/src/usr.sbin/hostapd/parse.y"
2583{
2584 yyval.v.op = HOSTAPD_OP_LT;
2585 }
2586break;
2587case 201:
2588#line 1155 "/usr/src/usr.sbin/hostapd/parse.y"
2589{
2590 yyval.v.op = HOSTAPD_OP_GE;
2591 }
2592break;
2593case 202:
2594#line 1159 "/usr/src/usr.sbin/hostapd/parse.y"
2595{
2596 yyval.v.op = HOSTAPD_OP_GT;
2597 }
2598break;
2599case 203:
2600#line 1165 "/usr/src/usr.sbin/hostapd/parse.y"
2601{
2602 double val;
2603 char *cp;
2604
2605 val = strtod(yyvsp[0].v.string, &cp);
2606 if (cp == NULL((void *)0) || strcmp(cp, "%") != 0 ||
2607 val < 0 || val > 100) {
2608 yyerror("invalid percentage: %s", yyvsp[0].v.string);
2609 free(yyvsp[0].v.string);
2610 YYERRORgoto yyerrlab;
2611 }
2612 free(yyvsp[0].v.string);
2613 yyval.v.number = val;
2614 }
2615break;
2616case 204:
2617#line 1182 "/usr/src/usr.sbin/hostapd/parse.y"
2618{
2619 double val;
2620 char *cp;
2621
2622 val = strtod(yyvsp[0].v.string, &cp) * 2;
2623 if (cp == NULL((void *)0) || strcasecmp(cp, "mb") != 0 ||
2624 val != (int)val) {
2625 yyerror("invalid rate: %s", yyvsp[0].v.string);
2626 free(yyvsp[0].v.string);
2627 YYERRORgoto yyerrlab;
2628 }
2629 free(yyvsp[0].v.string);
2630 yyval.v.number = val;
2631 }
2632break;
2633case 205:
2634#line 1199 "/usr/src/usr.sbin/hostapd/parse.y"
2635{
2636 double val;
2637 char *cp;
2638
2639 val = strtod(yyvsp[0].v.string, &cp);
2640 if (cp != NULL((void *)0)) {
2641 if (strcasecmp(cp, "ghz") == 0) {
2642 yyval.v.number = val * 1000;
2643 } else if (strcasecmp(cp, "mhz") == 0) {
2644 yyval.v.number = val;
2645 } else
2646 cp = NULL((void *)0);
2647 }
2648 if (cp == NULL((void *)0)) {
2649 yyerror("invalid frequency: %s", yyvsp[0].v.string);
2650 free(yyvsp[0].v.string);
2651 YYERRORgoto yyerrlab;
2652 }
2653 free(yyvsp[0].v.string);
2654 }
2655break;
2656case 206:
2657#line 1222 "/usr/src/usr.sbin/hostapd/parse.y"
2658{
2659 if (yyvsp[0].v.number < 1 || yyvsp[0].v.number > LONG_MAX9223372036854775807L) {
2660 yyerror("timeout out of range: %lld", yyvsp[0].v.number);
2661 YYERRORgoto yyerrlab;
2662 }
2663 yyval.v.timeout.tv_sec = yyvsp[0].v.number / 1000;
2664 yyval.v.timeout.tv_usec = (yyvsp[0].v.number % 1000) * 1000;
2665 }
2666break;
2667#line 2660 "parse.c"
2668 }
2669 yyssp -= yym;
2670 yystate = *yyssp;
2671 yyvsp -= yym;
2672 yym = yylhs[yyn];
2673 if (yystate == 0 && yym == 0)
2674 {
2675#if YYDEBUG0
2676 if (yydebug)
2677 printf("%sdebug: after reduction, shifting from state 0 to\
2678 state %d\n", YYPREFIX"yy", YYFINAL1);
2679#endif
2680 yystate = YYFINAL1;
2681 *++yyssp = YYFINAL1;
2682 *++yyvsp = yyval;
2683 if (yychar < 0)
2684 {
2685 if ((yychar = yylex()) < 0) yychar = 0;
2686#if YYDEBUG0
2687 if (yydebug)
2688 {
2689 yys = 0;
2690 if (yychar <= YYMAXTOKEN344) yys = yyname[yychar];
2691 if (!yys) yys = "illegal-symbol";
2692 printf("%sdebug: state %d, reading %d (%s)\n",
2693 YYPREFIX"yy", YYFINAL1, yychar, yys);
2694 }
2695#endif
2696 }
2697 if (yychar == 0) goto yyaccept;
2698 goto yyloop;
2699 }
2700 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
2701 yyn <= YYTABLESIZE512 && yycheck[yyn] == yystate)
2702 yystate = yytable[yyn];
2703 else
2704 yystate = yydgoto[yym];
2705#if YYDEBUG0
2706 if (yydebug)
2707 printf("%sdebug: after reduction, shifting from state %d \
2708to state %d\n", YYPREFIX"yy", *yyssp, yystate);
2709#endif
2710 if (yyssp >= yysslim && yygrowstack())
2711 {
2712 goto yyoverflow;
2713 }
2714 *++yyssp = yystate;
2715 *++yyvsp = yyval;
2716 goto yyloop;
2717yyoverflow:
2718 yyerror("yacc stack overflow");
2719yyabort:
2720 if (yyss)
2721 free(yyss);
2722 if (yyvs)
2723 free(yyvs);
2724 yyss = yyssp = NULL((void *)0);
2725 yyvs = yyvsp = NULL((void *)0);
2726 yystacksize = 0;
2727 return (1);
2728yyaccept:
2729 if (yyss)
2730 free(yyss);
2731 if (yyvs)
2732 free(yyvs);
2733 yyss = yyssp = NULL((void *)0);
2734 yyvs = yyvsp = NULL((void *)0);
2735 yystacksize = 0;
2736 return (0);
2737}