[Unbound-users] outgoing-interface config option

Николай Брыскин devel.niks at gmail.com
Wed Jan 25 19:51:32 UTC 2012


Hello, I'm using libunbound in my application (proxy server), and I
need to configure libunbound with specific outgoing interface for DNS
requests.
I've wrote this patch (tested with libunbound 1.4.9 and 1.4.12):

Index: unbound-1.4.12/util/config_file.c
===================================================================
--- unbound-1.4.12.orig/util/config_file.c      2012-01-25
23:15:15.000000000 +0400
+++ unbound-1.4.12/util/config_file.c   2012-01-25 23:15:31.000000000 +0400
@@ -403,6 +403,16 @@
       else S_STR("control-cert-file:", control_cert_file)
       else S_STR("module-config:", module_conf)
       else S_STR("python-script:", python_script)
+    else if (strcmp(opt, "outgoing-interface:") == 0) {
+        if (cfg->num_out_ifs == 0)
+            cfg->out_ifs = calloc(1, sizeof(char*));
+        else
+            cfg->out_ifs = realloc(cfg->out_ifs,
(cfg->num_out_ifs+1)*sizeof(char*));
+        if(!cfg->out_ifs)
+            return -1;
+        else
+            cfg->out_ifs[cfg->num_out_ifs++] = strdup(val);
+    }
       else {
               /* unknown or unsupported (from the set_option interface):
                * interface, outgoing-interface, access-control,

I have not found functions like S_STR for this functionality, so it
looks quite ugly.
Could you add this or similar patch to the upstream?

-- 
Best regards, Nikolay Bryskin.



More information about the Unbound-users mailing list