From b54efa5c69258d4442892f9ca18d388f0afcc49e Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 26 Jan 2012 10:37:10 +0000 Subject: [PATCH] - applied patch to support outgoing-interface with ub_ctx_set_option. git-svn-id: file:///svn/unbound/trunk@2596 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 1 + util/config_file.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/Changelog b/doc/Changelog index 52f6b7f1c..edb34866c 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Tag 1.4.15 (same as 1.4.15rc1), for 1.4.15 release. - trunk 1.4.16; includes changes memset testcode, #424 openindiana, and keyfile write fixup. + - applied patch to support outgoing-interface with ub_ctx_set_option. 23 January 2012: Wouter - Fix memset in test code. diff --git a/util/config_file.c b/util/config_file.c index ae8e52b63..21d6d1965 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -409,7 +409,18 @@ int config_set_option(struct config_file* cfg, const char* opt, else S_STR("control-cert-file:", control_cert_file) else S_STR("module-config:", module_conf) else S_STR("python-script:", python_script) - else { + else if (strcmp(opt, "outgoing-interface:") == 0) { + char* d = strdup(val); + char** oi = (char**)malloc((cfg->num_out_ifs+1)*sizeof(char*)); + if(!d || !oi) { free(d); free(oi); return -1; } + if(cfg->out_ifs && cfg->num_out_ifs) { + memmove(oi, cfg->out_ifs, cfg->num_out_ifs*sizeof(char*)); + free(cfg->out_ifs); + } + oi[cfg->num_out_ifs] = d; + cfg->num_out_ifs++; + cfg->out_ifs = oi; + } else { /* unknown or unsupported (from the set_option interface): * interface, outgoing-interface, access-control, * stub-zone, name, stub-addr, stub-host, stub-prime -- 2.47.2