[SR-Users] IPv6 addresses in dispatcher on IPv4 only proxy

Alex Hermann alex at speakup.nl
Tue Oct 16 15:19:11 CEST 2012


On Thursday 11 October 2012, Alex Hermann wrote:
> I am using the dispatcher module with a database table shared among
> multiple proxies. Some proxies do both IPv4 and IPv6, others only do IPv4.
> The problem is when i use an IPv6 address in the dispatcher table. Then
> the IPv4-only proxies fail to load the table.

For reference, this little patch solved my issue. Probably not suitable
for inclusion without a config option.

diff --git a/modules_k/dispatcher/dispatch.c b/modules_k/dispatcher/dispatch.c
index 50df1fc..e0dadda 100644
--- a/modules_k/dispatcher/dispatch.c
+++ b/modules_k/dispatcher/dispatch.c
@@ -259,7 +259,14 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
                LM_ERR("bad uri [%.*s]\n", uri.len, uri.s);
                goto err;
        }
-       
+
+       /* skip IPv6 references if IPv6 lookups are disabled */
+       if (default_core_cfg.dns_try_ipv6 == 0 &&
+               puri.host.s[0] == '[' && puri.host.s[puri.host.len-1] == ']') {
+               LM_DBG("skipping IPv6 record %.*s\n", puri.host.len, puri.host.s);
+               return 0;
+       }
+
        /* get dest set */
        sp = ds_lists[list_idx];
        while(sp)

-- 
Greetings,

Alex Hermann




More information about the sr-users mailing list