diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-25 17:49:03 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-25 17:49:03 +0100 |
commit | 772b80cc1392a52c9275c2290cc8b0c08cd9fdfa (patch) | |
tree | 266ce394cbd51361694e4829dfacc5e0f7e5a396 /sysdep | |
parent | 82bc3c5a44dce29ac4e45f1fb638589273766fc5 (diff) | |
parent | 51f2e7afaf069508685281e8c1b8bb1ceda79d8f (diff) |
Merge commit '51f2e7afaf069508685281e8c1b8bb1ceda79d8f' into wireguard-next-tmp7-1
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/unix/main.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 208d3173..683d26e1 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -112,21 +112,21 @@ get_hostname(linpool *lp) #ifdef PATH_IPROUTE_DIR static inline void -add_num_const(char *name, int val, const char *file, const uint line) +add_num_const(struct config *conf, char *name, int val, const char *file, const uint line) { struct f_val *v = cfg_alloc(sizeof(struct f_val)); *v = (struct f_val) { .type = T_INT, .val.i = val }; - struct symbol *sym = cf_get_symbol(name); - if (sym->class && cf_symbol_is_local(sym)) + struct symbol *sym = cf_get_symbol(conf, name); + if (sym->class && cf_symbol_is_local(conf, sym)) cf_error("Error reading value for %s from %s:%d: already defined", name, file, line); - cf_define_symbol(sym, SYM_CONSTANT | T_INT, val, v); + cf_define_symbol(conf, sym, SYM_CONSTANT | T_INT, val, v); } /* the code of read_iproute_table() is based on rtnl_tab_initialize() from iproute2 package */ static void -read_iproute_table(char *file, char *prefix, uint max) +read_iproute_table(struct config *conf, char *file, char *prefix, uint max) { char buf[512], namebuf[512]; char *name; @@ -163,7 +163,7 @@ read_iproute_table(char *file, char *prefix, uint max) if ((*p < 'a' || *p > 'z') && (*p < 'A' || *p > 'Z') && (*p < '0' || *p > '9') && (*p != '_')) *p = '_'; - add_num_const(namebuf, val, file, line); + add_num_const(conf, namebuf, val, file, line); } fclose(fp); @@ -192,10 +192,10 @@ sysdep_preconfig(struct config *c) c->watchdog_warning = UNIX_DEFAULT_WATCHDOG_WARNING; #ifdef PATH_IPROUTE_DIR - read_iproute_table(PATH_IPROUTE_DIR "/rt_protos", "ipp_", 255); - read_iproute_table(PATH_IPROUTE_DIR "/rt_realms", "ipr_", 0xffffffff); - read_iproute_table(PATH_IPROUTE_DIR "/rt_scopes", "ips_", 255); - read_iproute_table(PATH_IPROUTE_DIR "/rt_tables", "ipt_", 0xffffffff); + read_iproute_table(c, PATH_IPROUTE_DIR "/rt_protos", "ipp_", 255); + read_iproute_table(c, PATH_IPROUTE_DIR "/rt_realms", "ipr_", 0xffffffff); + read_iproute_table(c, PATH_IPROUTE_DIR "/rt_scopes", "ips_", 255); + read_iproute_table(c, PATH_IPROUTE_DIR "/rt_tables", "ipt_", 0xffffffff); #endif } |