ndhc/cfg.c
Nicholas J. Kain 3ff8685fc6
cfg.rl: Build with compact table-driven Ragel mode.
This reduces binary size by over 10% and the small hit to
config file parsing performance is insignificant and only
paid once at startup.
2023-02-13 00:27:18 -05:00

2062 lines
51 KiB
C

#line 1 "cfg.rl"
// Copyright 2018 Nicholas J. Kain <njkain at gmail dot com>
// SPDX-License-Identifier: MIT
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "ndhc-defines.h"
#include "cfg.h"
#include "sys.h"
#include "arp.h"
#include "ndhc.h"
#include "ifchd.h"
#include "sockd.h"
#include "nk/log.h"
#include "nk/privs.h"
#include "nk/io.h"
static bool xisxdigit(int c)
{
return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
}
static bool is_string_hwaddr(const char *str, size_t slen)
{
return slen == 17 && str[2] == ':' && str[5] == ':' && str[8] == ':' &&
str[11] == ':' && str[14] == ':' &&
xisxdigit(str[0]) && xisxdigit(str[1]) && xisxdigit(str[3]) &&
xisxdigit(str[4]) && xisxdigit(str[6]) && xisxdigit(str[7]) &&
xisxdigit(str[9]) && xisxdigit(str[10]) && xisxdigit(str[12]) &&
xisxdigit(str[13]) && xisxdigit(str[15]) && xisxdigit(str[16]);
}
static int get_clientid_string(const char *str, size_t slen)
{
if (!slen)
return -1;
if (!is_string_hwaddr(str, slen)) {
client_config.clientid[0] = 0;
memcpy(client_config.clientid + 1, str,
min_size_t(slen, sizeof client_config.clientid - 1));
client_config.clientid_len = slen + 1;
return 0;
}
uint8_t mac[6];
for (size_t i = 0; i < sizeof mac; ++i)
mac[i] = strtol(str+i*3, (char **)0, 16);
client_config.clientid[0] = 1; // Ethernet MAC type
memcpy(client_config.clientid + 1, mac,
min_size_t(sizeof mac, sizeof client_config.clientid - 1));
client_config.clientid_len = 7;
return 1;
}
static void copy_cmdarg(char *dest, const char *src,
size_t destlen, const char *argname)
{
if (!memccpy(dest, src, 0, destlen))
suicide("snprintf failed on %s", argname);
}
struct cfgparse {
char buf[MAX_BUF];
size_t buflen;
int ternary; // = 0 nothing, -1 = false, +1 = true
int cs;
};
#line 211 "cfg.rl"
#line 260 "cfg.rl"
#line 83 "cfg.c"
static const signed char _file_cfg_actions[] = {
0, 1, 1, 2, 0, 1, 2, 2,
5, 2, 2, 6, 2, 2, 7, 2,
2, 9, 2, 2, 10, 2, 2, 11,
2, 2, 12, 2, 2, 13, 2, 2,
14, 2, 2, 15, 2, 2, 16, 2,
2, 19, 2, 2, 20, 2, 2, 21,
2, 2, 22, 2, 2, 23, 2, 2,
24, 2, 2, 26, 2, 2, 27, 2,
3, 8, 2, 3, 17, 2, 3, 18,
2, 3, 25, 2, 4, 8, 2, 4,
17, 2, 4, 18, 2, 4, 25, 0
};
static const short _file_cfg_key_offsets[] = {
0, 0, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 24, 26, 27, 30,
33, 34, 37, 38, 41, 44, 45, 48,
49, 50, 53, 56, 57, 60, 61, 62,
63, 66, 69, 70, 73, 75, 76, 77,
78, 79, 82, 85, 86, 89, 90, 91,
92, 93, 94, 95, 98, 101, 102, 105,
106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121,
124, 130, 131, 132, 133, 134, 135, 136,
137, 138, 139, 140, 141, 142, 143, 144,
145, 146, 147, 150, 153, 154, 157, 158,
159, 160, 161, 162, 163, 164, 167, 170,
171, 174, 176, 177, 178, 179, 180, 181,
182, 183, 186, 189, 190, 193, 194, 195,
196, 197, 198, 199, 200, 203, 206, 207,
210, 211, 212, 215, 221, 222, 223, 224,
225, 226, 227, 228, 229, 230, 232, 235,
236, 237, 238, 239, 240, 241, 242, 243,
244, 245, 246, 247, 248, 249, 250, 253,
259, 260, 261, 262, 263, 264, 265, 266,
267, 268, 269, 270, 271, 272, 275, 278,
279, 282, 283, 284, 285, 286, 287, 288,
289, 290, 293, 296, 297, 300, 301, 302,
303, 304, 305, 306, 307, 308, 311, 314,
315, 318, 323, 324, 325, 326, 327, 328,
329, 330, 333, 336, 337, 340, 341, 342,
343, 344, 345, 346, 347, 348, 349, 352,
355, 356, 359, 360, 361, 362, 363, 364,
365, 366, 367, 368, 369, 370, 371, 372,
375, 381, 382, 383, 384, 385, 386, 387,
388, 389, 390, 391, 392, 393, 394, 395,
396, 397, 398, 401, 404, 405, 408, 409,
410, 411, 412, 413, 414, 415, 418, 421,
422, 425, 426, 427, 428, 431, 434, 435,
438, 439, 440, 441, 442, 443, 444, 445,
448, 451, 452, 455, 0
};
static const char _file_cfg_trans_keys[] = {
10, 97, 99, 100, 103, 104, 105, 110,
114, 115, 117, 118, 114, 112, 45, 112,
114, 111, 98, 101, 45, 109, 110, 119,
97, 105, 120, 9, 32, 61, 9, 10,
32, 10, 9, 10, 32, 110, 9, 32,
61, 9, 10, 32, 10, 9, 10, 32,
117, 109, 9, 32, 61, 9, 10, 32,
10, 9, 10, 32, 97, 105, 116, 9,
32, 61, 9, 10, 32, 10, 9, 10,
32, 104, 108, 114, 111, 111, 116, 9,
32, 61, 9, 10, 32, 10, 9, 10,
32, 105, 101, 110, 116, 105, 100, 9,
32, 61, 9, 10, 32, 10, 9, 10,
32, 104, 99, 112, 45, 115, 101, 116,
45, 104, 111, 115, 116, 110, 97, 109,
101, 9, 32, 61, 9, 32, 48, 49,
102, 116, 10, 10, 97, 108, 115, 101,
114, 117, 101, 119, 45, 109, 101, 116,
114, 105, 99, 9, 32, 61, 9, 10,
32, 10, 9, 10, 32, 111, 115, 116,
110, 97, 109, 101, 9, 32, 61, 9,
10, 32, 10, 9, 10, 32, 102, 110,
99, 104, 45, 117, 115, 101, 114, 9,
32, 61, 9, 10, 32, 10, 9, 10,
32, 116, 101, 114, 102, 97, 99, 101,
9, 32, 61, 9, 10, 32, 10, 9,
10, 32, 111, 119, 9, 32, 61, 9,
32, 48, 49, 102, 116, 10, 10, 97,
108, 115, 101, 114, 117, 101, 101, 102,
108, 113, 115, 101, 110, 116, 108, 101,
115, 115, 45, 100, 101, 102, 101, 110,
115, 101, 9, 32, 61, 9, 32, 48,
49, 102, 116, 10, 10, 97, 108, 115,
101, 114, 117, 101, 117, 101, 115, 116,
9, 32, 61, 9, 10, 32, 10, 9,
10, 32, 111, 108, 118, 45, 99, 111,
110, 102, 9, 32, 61, 9, 10, 32,
10, 9, 10, 32, 107, 105, 108, 108,
45, 105, 100, 120, 9, 32, 61, 9,
10, 32, 10, 9, 10, 32, 54, 99,
101, 111, 116, 45, 110, 111, 116, 105,
102, 121, 9, 32, 61, 9, 10, 32,
10, 9, 10, 32, 114, 105, 112, 116,
45, 102, 105, 108, 101, 9, 32, 61,
9, 10, 32, 10, 9, 10, 32, 99,
99, 111, 109, 112, 45, 101, 110, 102,
111, 114, 99, 101, 9, 32, 61, 9,
32, 48, 49, 102, 116, 10, 10, 97,
108, 115, 101, 114, 117, 101, 99, 107,
100, 45, 117, 115, 101, 114, 9, 32,
61, 9, 10, 32, 10, 9, 10, 32,
97, 116, 101, 45, 100, 105, 114, 9,
32, 61, 9, 10, 32, 10, 9, 10,
32, 115, 101, 114, 9, 32, 61, 9,
10, 32, 10, 9, 10, 32, 101, 110,
100, 111, 114, 105, 100, 9, 32, 61,
9, 10, 32, 10, 9, 10, 32, 0
};
static const signed char _file_cfg_single_lengths[] = {
0, 12, 1, 1, 1, 1, 1, 1,
1, 1, 1, 3, 2, 1, 3, 3,
1, 3, 1, 3, 3, 1, 3, 1,
1, 3, 3, 1, 3, 1, 1, 1,
3, 3, 1, 3, 2, 1, 1, 1,
1, 3, 3, 1, 3, 1, 1, 1,
1, 1, 1, 3, 3, 1, 3, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 3,
6, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 3, 3, 1, 3, 1, 1,
1, 1, 1, 1, 1, 3, 3, 1,
3, 2, 1, 1, 1, 1, 1, 1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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,
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,
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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
static const short _file_cfg_index_offsets[] = {
0, 0, 13, 15, 17, 19, 21, 23,
25, 27, 29, 31, 35, 38, 40, 44,
48, 50, 54, 56, 60, 64, 66, 70,
72, 74, 78, 82, 84, 88, 90, 92,
94, 98, 102, 104, 108, 111, 113, 115,
117, 119, 123, 127, 129, 133, 135, 137,
139, 141, 143, 145, 149, 153, 155, 159,
161, 163, 165, 167, 169, 171, 173, 175,
177, 179, 181, 183, 185, 187, 189, 191,
195, 202, 204, 206, 208, 210, 212, 214,
216, 218, 220, 222, 224, 226, 228, 230,
232, 234, 236, 240, 244, 246, 250, 252,
254, 256, 258, 260, 262, 264, 268, 272,
274, 278, 281, 283, 285, 287, 289, 291,
293, 295, 299, 303, 305, 309, 311, 313,
315, 317, 319, 321, 323, 327, 331, 333,
337, 339, 341, 345, 352, 354, 356, 358,
360, 362, 364, 366, 368, 370, 373, 377,
379, 381, 383, 385, 387, 389, 391, 393,
395, 397, 399, 401, 403, 405, 407, 411,
418, 420, 422, 424, 426, 428, 430, 432,
434, 436, 438, 440, 442, 444, 448, 452,
454, 458, 460, 462, 464, 466, 468, 470,
472, 474, 478, 482, 484, 488, 490, 492,
494, 496, 498, 500, 502, 504, 508, 512,
514, 518, 524, 526, 528, 530, 532, 534,
536, 538, 542, 546, 548, 552, 554, 556,
558, 560, 562, 564, 566, 568, 570, 574,
578, 580, 584, 586, 588, 590, 592, 594,
596, 598, 600, 602, 604, 606, 608, 610,
614, 621, 623, 625, 627, 629, 631, 633,
635, 637, 639, 641, 643, 645, 647, 649,
651, 653, 655, 659, 663, 665, 669, 671,
673, 675, 677, 679, 681, 683, 687, 691,
693, 697, 699, 701, 703, 707, 711, 713,
717, 719, 721, 723, 725, 727, 729, 731,
735, 739, 741, 745, 0
};
static const short _file_cfg_cond_targs[] = {
291, 2, 36, 55, 82, 94, 105, 128,
141, 201, 273, 280, 0, 3, 0, 4,
0, 5, 0, 6, 0, 7, 0, 8,
0, 9, 0, 10, 0, 11, 0, 12,
23, 29, 0, 13, 18, 0, 14, 0,
14, 14, 15, 0, 17, 0, 17, 16,
291, 16, 17, 291, 17, 16, 19, 0,
19, 19, 20, 0, 22, 0, 22, 21,
291, 21, 22, 291, 22, 21, 24, 0,
25, 0, 25, 25, 26, 0, 28, 0,
28, 27, 291, 27, 28, 291, 28, 27,
30, 0, 31, 0, 32, 0, 32, 32,
33, 0, 35, 0, 35, 34, 291, 34,
35, 291, 35, 34, 37, 45, 0, 38,
0, 39, 0, 40, 0, 41, 0, 41,
41, 42, 0, 44, 0, 44, 43, 291,
43, 44, 291, 44, 43, 46, 0, 47,
0, 48, 0, 49, 0, 50, 0, 51,
0, 51, 51, 52, 0, 54, 0, 54,
53, 291, 53, 54, 291, 54, 53, 56,
0, 57, 0, 58, 0, 59, 0, 60,
0, 61, 0, 62, 0, 63, 0, 64,
0, 65, 0, 66, 0, 67, 0, 68,
0, 69, 0, 70, 0, 71, 0, 71,
71, 72, 0, 72, 72, 73, 74, 75,
79, 0, 291, 0, 291, 0, 76, 0,
77, 0, 78, 0, 73, 0, 80, 0,
81, 0, 74, 0, 83, 0, 84, 0,
85, 0, 86, 0, 87, 0, 88, 0,
89, 0, 90, 0, 90, 90, 91, 0,
93, 0, 93, 92, 291, 92, 93, 291,
93, 92, 95, 0, 96, 0, 97, 0,
98, 0, 99, 0, 100, 0, 101, 0,
101, 101, 102, 0, 104, 0, 104, 103,
291, 103, 104, 291, 104, 103, 106, 117,
0, 107, 0, 108, 0, 109, 0, 110,
0, 111, 0, 112, 0, 113, 0, 113,
113, 114, 0, 116, 0, 116, 115, 291,
115, 116, 291, 116, 115, 118, 0, 119,
0, 120, 0, 121, 0, 122, 0, 123,
0, 124, 0, 124, 124, 125, 0, 127,
0, 127, 126, 291, 126, 127, 291, 127,
126, 129, 0, 130, 0, 130, 130, 131,
0, 131, 131, 132, 133, 134, 138, 0,
291, 0, 291, 0, 135, 0, 136, 0,
137, 0, 132, 0, 139, 0, 140, 0,
133, 0, 142, 189, 0, 143, 169, 177,
0, 144, 0, 145, 0, 146, 0, 147,
0, 148, 0, 149, 0, 150, 0, 151,
0, 152, 0, 153, 0, 154, 0, 155,
0, 156, 0, 157, 0, 158, 0, 158,
158, 159, 0, 159, 159, 160, 161, 162,
166, 0, 291, 0, 291, 0, 163, 0,
164, 0, 165, 0, 160, 0, 167, 0,
168, 0, 161, 0, 170, 0, 171, 0,
172, 0, 173, 0, 173, 173, 174, 0,
176, 0, 176, 175, 291, 175, 176, 291,
176, 175, 178, 0, 179, 0, 180, 0,
181, 0, 182, 0, 183, 0, 184, 0,
185, 0, 185, 185, 186, 0, 188, 0,
188, 187, 291, 187, 188, 291, 188, 187,
190, 0, 191, 0, 192, 0, 193, 0,
194, 0, 195, 0, 196, 0, 197, 0,
197, 197, 198, 0, 200, 0, 200, 199,
291, 199, 200, 291, 200, 199, 202, 213,
226, 250, 262, 0, 203, 0, 204, 0,
205, 0, 206, 0, 207, 0, 208, 0,
209, 0, 209, 209, 210, 0, 212, 0,
212, 211, 291, 211, 212, 291, 212, 211,
214, 0, 215, 0, 216, 0, 217, 0,
218, 0, 219, 0, 220, 0, 221, 0,
222, 0, 222, 222, 223, 0, 225, 0,
225, 224, 291, 224, 225, 291, 225, 224,
227, 0, 228, 0, 229, 0, 230, 0,
231, 0, 232, 0, 233, 0, 234, 0,
235, 0, 236, 0, 237, 0, 238, 0,
239, 0, 239, 239, 240, 0, 240, 240,
241, 242, 243, 247, 0, 291, 0, 291,
0, 244, 0, 245, 0, 246, 0, 241,
0, 248, 0, 249, 0, 242, 0, 251,
0, 252, 0, 253, 0, 254, 0, 255,
0, 256, 0, 257, 0, 258, 0, 258,
258, 259, 0, 261, 0, 261, 260, 291,
260, 261, 291, 261, 260, 263, 0, 264,
0, 265, 0, 266, 0, 267, 0, 268,
0, 269, 0, 269, 269, 270, 0, 272,
0, 272, 271, 291, 271, 272, 291, 272,
271, 274, 0, 275, 0, 276, 0, 276,
276, 277, 0, 279, 0, 279, 278, 291,
278, 279, 291, 279, 278, 281, 0, 282,
0, 283, 0, 284, 0, 285, 0, 286,
0, 287, 0, 287, 287, 288, 0, 290,
0, 290, 289, 291, 289, 290, 291, 290,
289, 0, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85,
86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125,
126, 127, 128, 129, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139, 140, 141,
142, 143, 144, 145, 146, 147, 148, 149,
150, 151, 152, 153, 154, 155, 156, 157,
158, 159, 160, 161, 162, 163, 164, 165,
166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 178, 179, 180, 181,
182, 183, 184, 185, 186, 187, 188, 189,
190, 191, 192, 193, 194, 195, 196, 197,
198, 199, 200, 201, 202, 203, 204, 205,
206, 207, 208, 209, 210, 211, 212, 213,
214, 215, 216, 217, 218, 219, 220, 221,
222, 223, 224, 225, 226, 227, 228, 229,
230, 231, 232, 233, 234, 235, 236, 237,
238, 239, 240, 241, 242, 243, 244, 245,
246, 247, 248, 249, 250, 251, 252, 253,
254, 255, 256, 257, 258, 259, 260, 261,
262, 263, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285,
286, 287, 288, 289, 290, 291, 0
};
static const signed char _file_cfg_cond_actions[] = {
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,
0, 0, 0, 0, 3, 0, 3, 3,
48, 1, 3, 48, 3, 3, 0, 0,
0, 0, 0, 0, 3, 0, 3, 3,
45, 1, 3, 45, 3, 3, 0, 0,
0, 0, 0, 0, 0, 0, 3, 0,
3, 3, 42, 1, 3, 42, 3, 3,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 3, 3, 39, 1,
3, 39, 3, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 3, 0, 3, 3, 30,
1, 3, 30, 3, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 3,
3, 6, 1, 3, 6, 3, 3, 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, 0,
0, 0, 84, 0, 72, 0, 0, 0,
0, 0, 0, 0, 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 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, 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, 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, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
};
static const int file_cfg_start = 1;
static const int file_cfg_first_final = 291;
static const int file_cfg_error = 0;
static const int file_cfg_en_main = 1;
#line 262 "cfg.rl"
static void parse_cfgfile(const char *fname)
{
bool reached_eof = false;
struct cfgparse ccfg;
memset(&ccfg, 0, sizeof ccfg);
char l[MAX_BUF];
size_t lc = 0;
memset(l, 0, sizeof l);
int fd = open(fname, O_RDONLY|O_CLOEXEC, 0);
if (fd < 0)
suicide("Unable to open config file '%s'.", fname);
size_t linenum = 0;
for (;;) {
if (lc + 1 >= sizeof l) suicide("sizeof l - 1 - lc would underflow");
ssize_t rc = safe_read(fd, l + lc, sizeof l - 1 - lc);
if (rc < 0)
suicide("Error reading config file '%s'.", fname);
if (rc == 0) {
l[lc] = '\n'; rc = 1; reached_eof = true; // Emulate a LF to terminate the line.
}
lc += (size_t)rc;
size_t lstart = 0, lend = 0, consumed = 0;
for (; lend < lc; ++lend) {
if (l[lend] == '\n') {
++linenum; consumed = lend;
size_t llen = lend - lstart;
const char *p = l + lstart;
const char *pe = l + lstart + llen + 1;
#line 626 "cfg.c"
{
ccfg.cs = (int)file_cfg_start;
}
#line 295 "cfg.rl"
#line 634 "cfg.c"
{
int _klen;
unsigned int _trans = 0;
const char * _keys;
const signed char * _acts;
unsigned int _nacts;
_resume: {}
if ( p == pe )
goto _out;
_keys = ( _file_cfg_trans_keys + (_file_cfg_key_offsets[ccfg.cs]));
_trans = (unsigned int)_file_cfg_index_offsets[ccfg.cs];
_klen = (int)_file_cfg_single_lengths[ccfg.cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_upper = _keys + _klen - 1;
const char *_mid;
while ( 1 ) {
if ( _upper < _lower ) {
_keys += _klen;
_trans += (unsigned int)_klen;
break;
}
_mid = _lower + ((_upper-_lower) >> 1);
if ( ( (*( p))) < (*( _mid)) )
_upper = _mid - 1;
else if ( ( (*( p))) > (*( _mid)) )
_lower = _mid + 1;
else {
_trans += (unsigned int)(_mid - _keys);
goto _match;
}
}
}
_klen = (int)_file_cfg_range_lengths[ccfg.cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_upper = _keys + (_klen<<1) - 2;
const char *_mid;
while ( 1 ) {
if ( _upper < _lower ) {
_trans += (unsigned int)_klen;
break;
}
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( ( (*( p))) < (*( _mid)) )
_upper = _mid - 2;
else if ( ( (*( p))) > (*( _mid + 1)) )
_lower = _mid + 2;
else {
_trans += (unsigned int)((_mid - _keys)>>1);
break;
}
}
}
_match: {}
ccfg.cs = (int)_file_cfg_cond_targs[_trans];
if ( _file_cfg_cond_actions[_trans] != 0 ) {
_acts = ( _file_cfg_actions + (_file_cfg_cond_actions[_trans]));
_nacts = (unsigned int)(*( _acts));
_acts += 1;
while ( _nacts > 0 ) {
switch ( (*( _acts)) )
{
case 0: {
{
#line 76 "cfg.rl"
memset(&ccfg.buf, 0, sizeof ccfg.buf);
ccfg.buflen = 0;
ccfg.ternary = 0;
}
#line 714 "cfg.c"
break;
}
case 1: {
{
#line 81 "cfg.rl"
if (ccfg.buflen < sizeof ccfg.buf - 1)
ccfg.buf[ccfg.buflen++] = *p;
else
suicide("line or option is too long");
}
#line 728 "cfg.c"
break;
}
case 2: {
{
#line 87 "cfg.rl"
if (ccfg.buflen < sizeof ccfg.buf)
ccfg.buf[ccfg.buflen] = 0;
}
#line 740 "cfg.c"
break;
}
case 3: {
{
#line 91 "cfg.rl"
ccfg.ternary = 1; }
#line 749 "cfg.c"
break;
}
case 4: {
{
#line 92 "cfg.rl"
ccfg.ternary = -1; }
#line 758 "cfg.c"
break;
}
case 5: {
{
#line 94 "cfg.rl"
get_clientid_string(ccfg.buf, ccfg.buflen); }
#line 767 "cfg.c"
break;
}
case 6: {
{
#line 95 "cfg.rl"
copy_cmdarg(client_config.hostname, ccfg.buf,
sizeof client_config.hostname, "hostname");
}
#line 779 "cfg.c"
break;
}
case 7: {
{
#line 99 "cfg.rl"
copy_cmdarg(client_config.interface, ccfg.buf,
sizeof client_config.interface, "interface");
}
#line 791 "cfg.c"
break;
}
case 8: {
{
#line 103 "cfg.rl"
switch (ccfg.ternary) {
case 1: client_config.abort_if_no_lease = true; break;
case -1: client_config.abort_if_no_lease = false; default: break;
}
}
#line 805 "cfg.c"
break;
}
case 9: {
{
#line 109 "cfg.rl"
set_client_addr(ccfg.buf); }
#line 814 "cfg.c"
break;
}
case 10: {
{
#line 110 "cfg.rl"
copy_cmdarg(client_config.vendor, ccfg.buf,
sizeof client_config.vendor, "vendorid");
}
#line 826 "cfg.c"
break;
}
case 11: {
{
#line 114 "cfg.rl"
if (nk_uidgidbyname(ccfg.buf, &ndhc_uid, &ndhc_gid))
suicide("invalid ndhc user '%s' specified", ccfg.buf);
}
#line 838 "cfg.c"
break;
}
case 12: {
{
#line 118 "cfg.rl"
if (nk_uidgidbyname(ccfg.buf, &ifch_uid, &ifch_gid))
suicide("invalid ifch user '%s' specified", ccfg.buf);
}
#line 850 "cfg.c"
break;
}
case 13: {
{
#line 122 "cfg.rl"
if (nk_uidgidbyname(ccfg.buf, &sockd_uid, &sockd_gid))
suicide("invalid sockd user '%s' specified", ccfg.buf);
}
#line 862 "cfg.c"
break;
}
case 14: {
{
#line 126 "cfg.rl"
copy_cmdarg(chroot_dir, ccfg.buf, sizeof chroot_dir, "chroot");
}
#line 873 "cfg.c"
break;
}
case 15: {
{
#line 129 "cfg.rl"
copy_cmdarg(state_dir, ccfg.buf, sizeof state_dir, "state-dir");
}
#line 884 "cfg.c"
break;
}
case 16: {
{
#line 132 "cfg.rl"
copy_cmdarg(script_file, ccfg.buf, sizeof script_file, "script-file");
}
#line 895 "cfg.c"
break;
}
case 17: {
{
#line 135 "cfg.rl"
log_line("seccomp_enforce option is deprecated; please remove it");
log_line("In the meanwhile, it is ignored and seccomp is disabled.");
}
#line 907 "cfg.c"
break;
}
case 18: {
{
#line 139 "cfg.rl"
switch (ccfg.ternary) {
case 1: set_arp_relentless_def(true); break;
case -1: set_arp_relentless_def(false); default: break;
}
}
#line 921 "cfg.c"
break;
}
case 19: {
{
#line 145 "cfg.rl"
int t = atoi(ccfg.buf);
if (t >= 0)
arp_probe_wait = (unsigned)t;
}
#line 934 "cfg.c"
break;
}
case 20: {
{
#line 150 "cfg.rl"
int t = atoi(ccfg.buf);
if (t >= 0)
arp_probe_num = (unsigned)t;
}
#line 947 "cfg.c"
break;
}
case 21: {
{
#line 155 "cfg.rl"
int ti = atoi(ccfg.buf);
if (ti >= 0) {
unsigned t = (unsigned)ti;
arp_probe_min = t;
if (arp_probe_min > arp_probe_max) {
t = arp_probe_max;
arp_probe_max = arp_probe_min;
arp_probe_min = t;
}
}
}
#line 967 "cfg.c"
break;
}
case 22: {
{
#line 167 "cfg.rl"
int ti = atoi(ccfg.buf);
if (ti >= 0) {
unsigned t = (unsigned)ti;
arp_probe_max = t;
if (arp_probe_min > arp_probe_max) {
t = arp_probe_max;
arp_probe_max = arp_probe_min;
arp_probe_min = t;
}
}
}
#line 987 "cfg.c"
break;
}
case 23: {
{
#line 179 "cfg.rl"
char *q;
long mt = strtol(ccfg.buf, &q, 10);
if (q == ccfg.buf)
suicide("gw-metric arg '%s' isn't a valid number", ccfg.buf);
if (mt > INT_MAX)
suicide("gw-metric arg '%s' is too large", ccfg.buf);
if (mt < 0)
mt = 0;
client_config.metric = (int)mt;
}
#line 1006 "cfg.c"
break;
}
case 24: {
{
#line 190 "cfg.rl"
copy_cmdarg(resolv_conf_d, ccfg.buf, sizeof resolv_conf_d,
"resolv-conf");
}
#line 1018 "cfg.c"
break;
}
case 25: {
{
#line 194 "cfg.rl"
switch (ccfg.ternary) {
case 1: allow_hostname = 1; break;
case -1: allow_hostname = 0; default: break;
}
}
#line 1032 "cfg.c"
break;
}
case 26: {
{
#line 200 "cfg.rl"
uint32_t t = (uint32_t)atoi(ccfg.buf);
client_config.rfkillIdx = t;
client_config.enable_rfkill = true;
}
#line 1045 "cfg.c"
break;
}
case 27: {
{
#line 205 "cfg.rl"
client_config.s6_notify_fd = atoi(ccfg.buf);
client_config.enable_s6_notify = true;
}
#line 1057 "cfg.c"
break;
}
}
_nacts -= 1;
_acts += 1;
}
}
if ( ccfg.cs != 0 ) {
p += 1;
goto _resume;
}
_out: {}
}
#line 296 "cfg.rl"
if (ccfg.cs == file_cfg_error)
suicide("error parsing config file line %zu: malformed", linenum);
if (ccfg.cs < file_cfg_first_final)
suicide("error parsing config file line %zu: incomplete", linenum);
lstart = lend + 1;
}
}
if (reached_eof)
break;
if (!consumed && lend >= sizeof l - 1)
suicide("Line %zu in config file '%s' is too long: %zu > %zu.",
linenum, fname, lend, sizeof l - 1);
if (consumed + 1 > lc) suicide("lc[%zu] - consumed[%zu] would underflow", lc, lend);
if (consumed) {
memmove(l, l + consumed + 1, lc - consumed - 1);
lc -= consumed + 1;
}
}
close(fd);
}
#line 366 "cfg.rl"
#line 1105 "cfg.c"
static const signed char _cmd_cfg_actions[] = {
0, 1, 1, 1, 6, 1, 15, 1,
16, 1, 23, 1, 26, 1, 27, 1,
29, 2, 0, 1, 2, 2, 3, 2,
2, 4, 2, 2, 5, 2, 2, 7,
2, 2, 8, 2, 2, 9, 2, 2,
10, 2, 2, 11, 2, 2, 12, 2,
2, 13, 2, 2, 14, 2, 2, 17,
2, 2, 18, 2, 2, 19, 2, 2,
20, 2, 2, 21, 2, 2, 22, 2,
2, 24, 2, 2, 25, 2, 2, 28,
0
};
static const short _cmd_cfg_key_offsets[] = {
0, 0, 27, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 50, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69,
70, 71, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 127, 128,
129, 130, 131, 132, 133, 134, 135, 136,
137, 138, 139, 141, 142, 143, 144, 145,
146, 147, 148, 149, 150, 151, 152, 153,
154, 155, 156, 157, 158, 159, 160, 161,
162, 163, 164, 166, 169, 170, 171, 172,
173, 174, 175, 176, 177, 178, 179, 180,
181, 182, 183, 184, 185, 186, 187, 188,
189, 190, 191, 192, 193, 194, 195, 196,
197, 198, 199, 200, 201, 202, 203, 204,
205, 206, 207, 208, 209, 210, 211, 212,
213, 214, 219, 220, 221, 222, 223, 224,
225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240,
241, 242, 243, 244, 245, 246, 247, 248,
249, 250, 251, 252, 253, 254, 255, 256,
257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272,
273, 274, 275, 276, 277, 278, 279, 280,
281, 282, 283, 285, 286, 287, 288, 289,
290, 291, 292, 293, 294, 295, 296, 297,
298, 299, 0
};
static const char _cmd_cfg_trans_keys[] = {
45, 63, 67, 68, 72, 73, 75, 77,
78, 82, 83, 85, 86, 87, 88, 99,
100, 104, 105, 109, 110, 114, 115, 116,
117, 118, 119, 97, 99, 100, 103, 104,
105, 110, 114, 115, 117, 118, 114, 112,
45, 112, 114, 111, 98, 101, 45, 109,
110, 119, 97, 105, 120, 0, 0, 0,
110, 0, 0, 0, 117, 109, 0, 0,
0, 97, 105, 116, 0, 0, 0, 104,
108, 111, 114, 111, 111, 116, 0, 0,
0, 105, 101, 110, 116, 105, 100, 0,
0, 0, 110, 102, 105, 103, 0, 0,
0, 104, 99, 112, 45, 115, 101, 116,
45, 104, 111, 115, 116, 110, 97, 109,
101, 0, 119, 45, 109, 101, 116, 114,
105, 99, 0, 0, 0, 101, 111, 108,
112, 0, 115, 116, 110, 97, 109, 101,
0, 0, 0, 102, 110, 99, 104, 45,
117, 115, 101, 114, 0, 0, 0, 116,
101, 114, 102, 97, 99, 101, 0, 0,
0, 111, 119, 0, 101, 102, 108, 113,
115, 101, 110, 116, 108, 101, 115, 115,
45, 100, 101, 102, 101, 110, 115, 101,
0, 117, 101, 115, 116, 0, 0, 0,
111, 108, 118, 45, 99, 111, 110, 102,
0, 0, 0, 107, 105, 108, 108, 45,
105, 100, 120, 0, 0, 0, 54, 99,
101, 111, 116, 45, 110, 111, 116, 105,
102, 121, 0, 0, 0, 114, 105, 112,
116, 45, 102, 105, 108, 101, 0, 0,
0, 99, 99, 111, 109, 112, 45, 101,
110, 102, 111, 114, 99, 101, 0, 99,
107, 100, 45, 117, 115, 101, 114, 0,
0, 0, 97, 116, 101, 45, 100, 105,
114, 0, 0, 0, 115, 101, 114, 0,
0, 0, 101, 110, 114, 100, 111, 114,
105, 100, 0, 0, 0, 115, 105, 111,
110, 0, 45, 45, 0
};
static const signed char _cmd_cfg_single_lengths[] = {
0, 27, 11, 1, 1, 1, 1, 1,
1, 1, 1, 1, 3, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 3, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 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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,
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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0
};
static const short _cmd_cfg_index_offsets[] = {
0, 0, 28, 40, 42, 44, 46, 48,
50, 52, 54, 56, 58, 62, 65, 67,
69, 71, 73, 75, 77, 79, 81, 83,
85, 87, 89, 91, 93, 95, 97, 99,
101, 103, 107, 109, 111, 113, 115, 117,
119, 121, 123, 125, 127, 129, 131, 133,
135, 137, 139, 141, 143, 145, 147, 149,
151, 153, 155, 157, 159, 161, 163, 165,
167, 169, 171, 173, 175, 177, 179, 181,
183, 185, 187, 189, 191, 193, 195, 197,
199, 201, 203, 205, 207, 209, 212, 214,
216, 218, 220, 222, 224, 226, 228, 230,
232, 234, 236, 239, 241, 243, 245, 247,
249, 251, 253, 255, 257, 259, 261, 263,
265, 267, 269, 271, 273, 275, 277, 279,
281, 283, 285, 288, 292, 294, 296, 298,
300, 302, 304, 306, 308, 310, 312, 314,
316, 318, 320, 322, 324, 326, 328, 330,
332, 334, 336, 338, 340, 342, 344, 346,
348, 350, 352, 354, 356, 358, 360, 362,
364, 366, 368, 370, 372, 374, 376, 378,
380, 382, 388, 390, 392, 394, 396, 398,
400, 402, 404, 406, 408, 410, 412, 414,
416, 418, 420, 422, 424, 426, 428, 430,
432, 434, 436, 438, 440, 442, 444, 446,
448, 450, 452, 454, 456, 458, 460, 462,
464, 466, 468, 470, 472, 474, 476, 478,
480, 482, 484, 486, 488, 490, 492, 494,
496, 498, 500, 502, 504, 506, 508, 510,
512, 514, 516, 519, 521, 523, 525, 527,
529, 531, 533, 535, 537, 539, 541, 543,
545, 547, 0
};
static const short _cmd_cfg_cond_targs[] = {
2, 88, 38, 214, 73, 47, 166, 15,
177, 155, 205, 106, 240, 24, 189, 54,
139, 95, 116, 19, 121, 144, 224, 82,
230, 247, 30, 0, 3, 33, 57, 74,
85, 98, 119, 122, 169, 227, 233, 0,
4, 0, 5, 0, 6, 0, 7, 0,
8, 0, 9, 0, 10, 0, 11, 0,
12, 0, 13, 22, 27, 0, 14, 18,
0, 15, 0, 16, 0, 0, 17, 248,
17, 19, 0, 20, 0, 0, 21, 248,
21, 23, 0, 24, 0, 25, 0, 0,
26, 248, 26, 28, 0, 29, 0, 30,
0, 31, 0, 0, 32, 248, 32, 34,
41, 50, 0, 35, 0, 36, 0, 37,
0, 38, 0, 39, 0, 0, 40, 248,
40, 42, 0, 43, 0, 44, 0, 45,
0, 46, 0, 47, 0, 48, 0, 0,
49, 248, 49, 51, 0, 52, 0, 53,
0, 54, 0, 55, 0, 0, 56, 248,
56, 58, 0, 59, 0, 60, 0, 61,
0, 62, 0, 63, 0, 64, 0, 65,
0, 66, 0, 67, 0, 68, 0, 69,
0, 70, 0, 71, 0, 72, 0, 73,
0, 249, 0, 75, 0, 76, 0, 77,
0, 78, 0, 79, 0, 80, 0, 81,
0, 82, 0, 83, 0, 0, 84, 248,
84, 86, 89, 0, 87, 0, 88, 0,
248, 0, 90, 0, 91, 0, 92, 0,
93, 0, 94, 0, 95, 0, 96, 0,
0, 97, 248, 97, 99, 109, 0, 100,
0, 101, 0, 102, 0, 103, 0, 104,
0, 105, 0, 106, 0, 107, 0, 0,
108, 248, 108, 110, 0, 111, 0, 112,
0, 113, 0, 114, 0, 115, 0, 116,
0, 117, 0, 0, 118, 248, 118, 120,
0, 121, 0, 249, 0, 123, 158, 0,
124, 140, 147, 0, 125, 0, 126, 0,
127, 0, 128, 0, 129, 0, 130, 0,
131, 0, 132, 0, 133, 0, 134, 0,
135, 0, 136, 0, 137, 0, 138, 0,
139, 0, 249, 0, 141, 0, 142, 0,
143, 0, 144, 0, 145, 0, 0, 146,
248, 146, 148, 0, 149, 0, 150, 0,
151, 0, 152, 0, 153, 0, 154, 0,
155, 0, 156, 0, 0, 157, 248, 157,
159, 0, 160, 0, 161, 0, 162, 0,
163, 0, 164, 0, 165, 0, 166, 0,
167, 0, 0, 168, 248, 168, 170, 180,
192, 206, 217, 0, 171, 0, 172, 0,
173, 0, 174, 0, 175, 0, 176, 0,
177, 0, 178, 0, 0, 179, 248, 179,
181, 0, 182, 0, 183, 0, 184, 0,
185, 0, 186, 0, 187, 0, 188, 0,
189, 0, 190, 0, 0, 191, 248, 191,
193, 0, 194, 0, 195, 0, 196, 0,
197, 0, 198, 0, 199, 0, 200, 0,
201, 0, 202, 0, 203, 0, 204, 0,
205, 0, 249, 0, 207, 0, 208, 0,
209, 0, 210, 0, 211, 0, 212, 0,
213, 0, 214, 0, 215, 0, 0, 216,
248, 216, 218, 0, 219, 0, 220, 0,
221, 0, 222, 0, 223, 0, 224, 0,
225, 0, 0, 226, 248, 226, 228, 0,
229, 0, 230, 0, 231, 0, 0, 232,
248, 232, 234, 0, 235, 243, 0, 236,
0, 237, 0, 238, 0, 239, 0, 240,
0, 241, 0, 0, 242, 248, 242, 244,
0, 245, 0, 246, 0, 247, 0, 248,
0, 1, 0, 1, 0, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106,
107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122,
123, 124, 125, 126, 127, 128, 129, 130,
131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146,
147, 148, 149, 150, 151, 152, 153, 154,
155, 156, 157, 158, 159, 160, 161, 162,
163, 164, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 177, 178,
179, 180, 181, 182, 183, 184, 185, 186,
187, 188, 189, 190, 191, 192, 193, 194,
195, 196, 197, 198, 199, 200, 201, 202,
203, 204, 205, 206, 207, 208, 209, 210,
211, 212, 213, 214, 215, 216, 217, 218,
219, 220, 221, 222, 223, 224, 225, 226,
227, 228, 229, 230, 231, 232, 233, 234,
235, 236, 237, 238, 239, 240, 241, 242,
243, 244, 245, 246, 247, 248, 249, 0
};
static const signed char _cmd_cfg_cond_actions[] = {
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,
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, 17, 62,
1, 0, 0, 0, 0, 0, 17, 59,
1, 0, 0, 0, 0, 0, 0, 0,
17, 56, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 17, 53, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 17, 44,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
17, 20, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 17, 77,
1, 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, 9, 0, 0, 0, 0, 0, 0,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32, 1, 0,
0, 0, 0, 0, 0, 0, 0, 11,
0, 0, 0, 15, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 15, 0
};
static const short _cmd_cfg_eof_trans[] = {
550, 551, 552, 553, 554, 555, 556, 557,
558, 559, 560, 561, 562, 563, 564, 565,
566, 567, 568, 569, 570, 571, 572, 573,
574, 575, 576, 577, 578, 579, 580, 581,
582, 583, 584, 585, 586, 587, 588, 589,
590, 591, 592, 593, 594, 595, 596, 597,
598, 599, 600, 601, 602, 603, 604, 605,
606, 607, 608, 609, 610, 611, 612, 613,
614, 615, 616, 617, 618, 619, 620, 621,
622, 623, 624, 625, 626, 627, 628, 629,
630, 631, 632, 633, 634, 635, 636, 637,
638, 639, 640, 641, 642, 643, 644, 645,
646, 647, 648, 649, 650, 651, 652, 653,
654, 655, 656, 657, 658, 659, 660, 661,
662, 663, 664, 665, 666, 667, 668, 669,
670, 671, 672, 673, 674, 675, 676, 677,
678, 679, 680, 681, 682, 683, 684, 685,
686, 687, 688, 689, 690, 691, 692, 693,
694, 695, 696, 697, 698, 699, 700, 701,
702, 703, 704, 705, 706, 707, 708, 709,
710, 711, 712, 713, 714, 715, 716, 717,
718, 719, 720, 721, 722, 723, 724, 725,
726, 727, 728, 729, 730, 731, 732, 733,
734, 735, 736, 737, 738, 739, 740, 741,
742, 743, 744, 745, 746, 747, 748, 749,
750, 751, 752, 753, 754, 755, 756, 757,
758, 759, 760, 761, 762, 763, 764, 765,
766, 767, 768, 769, 770, 771, 772, 773,
774, 775, 776, 777, 778, 779, 780, 781,
782, 783, 784, 785, 786, 787, 788, 789,
790, 791, 792, 793, 794, 795, 796, 797,
798, 799, 0
};
static const int cmd_cfg_start = 248;
static const int cmd_cfg_first_final = 248;
static const int cmd_cfg_error = 0;
static const int cmd_cfg_en_main = 248;
#line 368 "cfg.rl"
void parse_cmdline(int argc, char *argv[])
{
char argb[8192];
size_t argbl = 0;
for (size_t i = 1; i < (size_t)argc; ++i) {
ssize_t snl;
if (i > 1) snl = snprintf(argb + argbl, sizeof argb - argbl, "%c%s", 0, argv[i]);
else snl = snprintf(argb + argbl, sizeof argb - argbl, "%s", argv[i]);
if (snl < 0 || (size_t)snl > sizeof argb)
suicide("error parsing command line option: option too long");
argbl += (size_t)snl;
}
if (argbl == 0)
return;
struct cfgparse ccfg;
memset(&ccfg, 0, sizeof ccfg);
const char *p = argb;
const char *pe = argb + argbl + 1;
const char *eof = pe;
#line 1573 "cfg.c"
{
ccfg.cs = (int)cmd_cfg_start;
}
#line 390 "cfg.rl"
#line 1581 "cfg.c"
{
int _klen;
unsigned int _trans = 0;
const char * _keys;
const signed char * _acts;
unsigned int _nacts;
_resume: {}
if ( p == pe && p != eof )
goto _out;
if ( p == eof ) {
if ( _cmd_cfg_eof_trans[ccfg.cs] > 0 ) {
_trans = (unsigned int)_cmd_cfg_eof_trans[ccfg.cs] - 1;
}
}
else {
_keys = ( _cmd_cfg_trans_keys + (_cmd_cfg_key_offsets[ccfg.cs]));
_trans = (unsigned int)_cmd_cfg_index_offsets[ccfg.cs];
_klen = (int)_cmd_cfg_single_lengths[ccfg.cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_upper = _keys + _klen - 1;
const char *_mid;
while ( 1 ) {
if ( _upper < _lower ) {
_keys += _klen;
_trans += (unsigned int)_klen;
break;
}
_mid = _lower + ((_upper-_lower) >> 1);
if ( ( (*( p))) < (*( _mid)) )
_upper = _mid - 1;
else if ( ( (*( p))) > (*( _mid)) )
_lower = _mid + 1;
else {
_trans += (unsigned int)(_mid - _keys);
goto _match;
}
}
}
_klen = (int)_cmd_cfg_range_lengths[ccfg.cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_upper = _keys + (_klen<<1) - 2;
const char *_mid;
while ( 1 ) {
if ( _upper < _lower ) {
_trans += (unsigned int)_klen;
break;
}
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( ( (*( p))) < (*( _mid)) )
_upper = _mid - 2;
else if ( ( (*( p))) > (*( _mid + 1)) )
_lower = _mid + 2;
else {
_trans += (unsigned int)((_mid - _keys)>>1);
break;
}
}
}
_match: {}
}
ccfg.cs = (int)_cmd_cfg_cond_targs[_trans];
if ( _cmd_cfg_cond_actions[_trans] != 0 ) {
_acts = ( _cmd_cfg_actions + (_cmd_cfg_cond_actions[_trans]));
_nacts = (unsigned int)(*( _acts));
_acts += 1;
while ( _nacts > 0 ) {
switch ( (*( _acts)) )
{
case 0: {
{
#line 76 "cfg.rl"
memset(&ccfg.buf, 0, sizeof ccfg.buf);
ccfg.buflen = 0;
ccfg.ternary = 0;
}
#line 1668 "cfg.c"
break;
}
case 1: {
{
#line 81 "cfg.rl"
if (ccfg.buflen < sizeof ccfg.buf - 1)
ccfg.buf[ccfg.buflen++] = *p;
else
suicide("line or option is too long");
}
#line 1682 "cfg.c"
break;
}
case 2: {
{
#line 87 "cfg.rl"
if (ccfg.buflen < sizeof ccfg.buf)
ccfg.buf[ccfg.buflen] = 0;
}
#line 1694 "cfg.c"
break;
}
case 3: {
{
#line 94 "cfg.rl"
get_clientid_string(ccfg.buf, ccfg.buflen); }
#line 1703 "cfg.c"
break;
}
case 4: {
{
#line 95 "cfg.rl"
copy_cmdarg(client_config.hostname, ccfg.buf,
sizeof client_config.hostname, "hostname");
}
#line 1715 "cfg.c"
break;
}
case 5: {
{
#line 99 "cfg.rl"
copy_cmdarg(client_config.interface, ccfg.buf,
sizeof client_config.interface, "interface");
}
#line 1727 "cfg.c"
break;
}
case 6: {
{
#line 103 "cfg.rl"
switch (ccfg.ternary) {
case 1: client_config.abort_if_no_lease = true; break;
case -1: client_config.abort_if_no_lease = false; default: break;
}
}
#line 1741 "cfg.c"
break;
}
case 7: {
{
#line 109 "cfg.rl"
set_client_addr(ccfg.buf); }
#line 1750 "cfg.c"
break;
}
case 8: {
{
#line 110 "cfg.rl"
copy_cmdarg(client_config.vendor, ccfg.buf,
sizeof client_config.vendor, "vendorid");
}
#line 1762 "cfg.c"
break;
}
case 9: {
{
#line 114 "cfg.rl"
if (nk_uidgidbyname(ccfg.buf, &ndhc_uid, &ndhc_gid))
suicide("invalid ndhc user '%s' specified", ccfg.buf);
}
#line 1774 "cfg.c"
break;
}
case 10: {
{
#line 118 "cfg.rl"
if (nk_uidgidbyname(ccfg.buf, &ifch_uid, &ifch_gid))
suicide("invalid ifch user '%s' specified", ccfg.buf);
}
#line 1786 "cfg.c"
break;
}
case 11: {
{
#line 122 "cfg.rl"
if (nk_uidgidbyname(ccfg.buf, &sockd_uid, &sockd_gid))
suicide("invalid sockd user '%s' specified", ccfg.buf);
}
#line 1798 "cfg.c"
break;
}
case 12: {
{
#line 126 "cfg.rl"
copy_cmdarg(chroot_dir, ccfg.buf, sizeof chroot_dir, "chroot");
}
#line 1809 "cfg.c"
break;
}
case 13: {
{
#line 129 "cfg.rl"
copy_cmdarg(state_dir, ccfg.buf, sizeof state_dir, "state-dir");
}
#line 1820 "cfg.c"
break;
}
case 14: {
{
#line 132 "cfg.rl"
copy_cmdarg(script_file, ccfg.buf, sizeof script_file, "script-file");
}
#line 1831 "cfg.c"
break;
}
case 15: {
{
#line 135 "cfg.rl"
log_line("seccomp_enforce option is deprecated; please remove it");
log_line("In the meanwhile, it is ignored and seccomp is disabled.");
}
#line 1843 "cfg.c"
break;
}
case 16: {
{
#line 139 "cfg.rl"
switch (ccfg.ternary) {
case 1: set_arp_relentless_def(true); break;
case -1: set_arp_relentless_def(false); default: break;
}
}
#line 1857 "cfg.c"
break;
}
case 17: {
{
#line 145 "cfg.rl"
int t = atoi(ccfg.buf);
if (t >= 0)
arp_probe_wait = (unsigned)t;
}
#line 1870 "cfg.c"
break;
}
case 18: {
{
#line 150 "cfg.rl"
int t = atoi(ccfg.buf);
if (t >= 0)
arp_probe_num = (unsigned)t;
}
#line 1883 "cfg.c"
break;
}
case 19: {
{
#line 155 "cfg.rl"
int ti = atoi(ccfg.buf);
if (ti >= 0) {
unsigned t = (unsigned)ti;
arp_probe_min = t;
if (arp_probe_min > arp_probe_max) {
t = arp_probe_max;
arp_probe_max = arp_probe_min;
arp_probe_min = t;
}
}
}
#line 1903 "cfg.c"
break;
}
case 20: {
{
#line 167 "cfg.rl"
int ti = atoi(ccfg.buf);
if (ti >= 0) {
unsigned t = (unsigned)ti;
arp_probe_max = t;
if (arp_probe_min > arp_probe_max) {
t = arp_probe_max;
arp_probe_max = arp_probe_min;
arp_probe_min = t;
}
}
}
#line 1923 "cfg.c"
break;
}
case 21: {
{
#line 179 "cfg.rl"
char *q;
long mt = strtol(ccfg.buf, &q, 10);
if (q == ccfg.buf)
suicide("gw-metric arg '%s' isn't a valid number", ccfg.buf);
if (mt > INT_MAX)
suicide("gw-metric arg '%s' is too large", ccfg.buf);
if (mt < 0)
mt = 0;
client_config.metric = (int)mt;
}
#line 1942 "cfg.c"
break;
}
case 22: {
{
#line 190 "cfg.rl"
copy_cmdarg(resolv_conf_d, ccfg.buf, sizeof resolv_conf_d,
"resolv-conf");
}
#line 1954 "cfg.c"
break;
}
case 23: {
{
#line 194 "cfg.rl"
switch (ccfg.ternary) {
case 1: allow_hostname = 1; break;
case -1: allow_hostname = 0; default: break;
}
}
#line 1968 "cfg.c"
break;
}
case 24: {
{
#line 200 "cfg.rl"
uint32_t t = (uint32_t)atoi(ccfg.buf);
client_config.rfkillIdx = t;
client_config.enable_rfkill = true;
}
#line 1981 "cfg.c"
break;
}
case 25: {
{
#line 205 "cfg.rl"
client_config.s6_notify_fd = atoi(ccfg.buf);
client_config.enable_s6_notify = true;
}
#line 1993 "cfg.c"
break;
}
case 26: {
{
#line 209 "cfg.rl"
print_version(); exit(EXIT_SUCCESS); }
#line 2002 "cfg.c"
break;
}
case 27: {
{
#line 210 "cfg.rl"
show_usage(); exit(EXIT_SUCCESS); }
#line 2011 "cfg.c"
break;
}
case 28: {
{
#line 325 "cfg.rl"
parse_cfgfile(ccfg.buf); }
#line 2020 "cfg.c"
break;
}
case 29: {
{
#line 326 "cfg.rl"
ccfg.ternary = 1; }
#line 2029 "cfg.c"
break;
}
}
_nacts -= 1;
_acts += 1;
}
}
if ( p == eof ) {
if ( ccfg.cs >= 248 )
goto _out;
}
else {
if ( ccfg.cs != 0 ) {
p += 1;
goto _resume;
}
}
_out: {}
}
#line 391 "cfg.rl"
if (ccfg.cs == cmd_cfg_error)
suicide("error parsing command line option: malformed");
if (ccfg.cs >= cmd_cfg_first_final)
return;
suicide("error parsing command line option: incomplete");
}