Your message dated Mon, 26 Apr 2010 21:33:14 +0200
with message-id <[email protected]>
has caused the   report #578950,
regarding liblinphone3: Sends IPv6 addresses to IPv4 hosts when DNS name has A 
and AAAA
to be marked as having been forwarded to the upstream software
author(s) [email protected]

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
578950: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578950
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
This is bug #578950 in the Debian bug tracker:
http://bugs.debian.org/578950

Please keep [email protected], [email protected]
and [email protected] as CC in the discussion (M-F-T is set).

When

 - the SIP server has both A and AAAA records in DNS
 - linphone is configured to use IPv4, not IPv6

linphone speaks over IPv4 to the server, but puts an IPv6 address in
the SIP messages. This, at least in the case where Asterisk is the
server (and probably for other servers that don't implement IPv6)
makes calls not work. (registration works)

The attached patch (against v3.2.1) fixes the issue.

Analysis:

Abstract from the debug log:

 linphonec> call 500
 ortp-message-Local interface to reach sip.mamane.lu is 2001:960:2:97::2.

First sign of trouble: linphone identifies its own IP as an IPv6...

 ortp-message-getaddrinfo returned the following addresses:
 ortp-message-94.142.241.136 port 5060
 ortp-message-Message sent: (to dest=94.142.241.136:5060)

but OK, it still speaks to the server over IPv4

 v=0
 o=lionel 123456 654321 IN IP6 2001:960:2:97::2
 s=A conversation
 c=IN IP6 2001:960:2:97::2

the IP6 address there makes Asterisk balk. The Asterisk log says:

 WARNING[3678] chan_sip.c: Invalid host in c= line, 'IN IP6 2001:960:2:97::2'

and it returns this message to Linphone:

ortp-message-Received message: SIP/2.0 488 Not acceptable here

-- 
Lionel
#! /bin/sh /usr/share/dpatch/dpatch-run
## always_ipv4_for_ipv4 hosts.dpatch by Lionel Elie Mamane <[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Identify with IPv4 address to IPv4 host even if it has an AAAA DNS RR

@DPATCH@
--- linphone-3.2.1.orig/coreapi/linphonecore.c
+++ linphone-3.2.1/coreapi/linphonecore.c
@@ -788,7 +788,7 @@
                return;
        }
        if (dest==NULL) dest="87.98.157.38"; /*a public IP address*/
-       if (linphone_core_get_local_ip_for(dest,result)==0)
+       if (linphone_core_get_local_ip_for(lc->sip_conf.ipv6_enabled ? AF_INET6 
: AF_INET, dest,result)==0)
                return;
        /*else fallback to exosip routine that will attempt to find the most 
realistic interface */
        if (eXosip_guess_localip(lc->sip_conf.ipv6_enabled ? AF_INET6 : 
AF_INET,result,LINPHONE_IPADDR_SIZE)<0){
only in patch2:
unchanged:
--- linphone-3.2.1.orig/coreapi/misc.c
+++ linphone-3.2.1/coreapi/misc.c
@@ -746,7 +746,7 @@
        return -1;
 }
 
-int linphone_core_get_local_ip_for(const char *dest, char *result){
+int linphone_core_get_local_ip_for(int family, const char *dest, char *result){
        int err,tmp;
        struct addrinfo hints;
        struct addrinfo *res=NULL;
@@ -755,7 +755,7 @@
        socklen_t s;
 
        memset(&hints,0,sizeof(hints));
-       hints.ai_family=PF_UNSPEC;
+       hints.ai_family=family;
        hints.ai_socktype=SOCK_DGRAM;
        /*hints.ai_flags=AI_NUMERICHOST|AI_CANONNAME;*/
        err=getaddrinfo(dest,"5060",&hints,&res);
only in patch2:
unchanged:
--- linphone-3.2.1.orig/coreapi/private.h
+++ linphone-3.2.1/coreapi/private.h
@@ -188,6 +188,6 @@
 void linphone_proxy_config_update(LinphoneProxyConfig *cfg);
 void linphone_proxy_config_get_contact(LinphoneProxyConfig *cfg, const char 
**ip, int *port);
 LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const 
char *uri);
-int linphone_core_get_local_ip_for(const char *dest, char *result);
+int linphone_core_get_local_ip_for(int family, const char *dest, char *result);
 
 #endif /* _PRIVATE_H */

--- End Message ---

Reply via email to