2008/12/22 Mohammed Sulaiman <mhh.sulai...@talk21.com>: > Hi , we are using Sofia 1.12.8 on the Windows Mobile 6 platform in a voip > client app. > We have come across the following issue, when making a call over 3G. > > Sofia is using the IpHelper api on a our platform to get a list of > nameservers. We have a situation where it obtains 2 nameservers > > 192.168.0.1 and 10.205.65.68 > > the 3G access pointIp address is 10.47.127.102 so the first one obviously is > no use. So there is some code in Sofia to traverse the nameservers if the > query times out. > However we fail to connect on the socket when trying to query > the 10.205.65.68, the connect() call in "sres_server_socket" returns Windows > error 10048 > > "Only one usage of each socket address (protocol/network address/port) is > normally permitted.""
This sounds, err, interesting. I think there is a security problem with DNS always using the same source port or even easily guessable source port, so an explicit bind() to a random port (and a loop if that fails) should be in order there. (And each query should have its own socket, too, but it is a bit more complicated.) > sres_send_dns_query(003CD300, 0041B3D0) id=9637 A xxx.xxx.com (to > [192.168.0.1]:53) > sres_resolver_timer() called at 1229661607 > sres_resend_dns_query(003CD300, 0041B3D0, timeout) called > sres_send_dns_query(003CD300, 0041B3D0) called > sres_server_socket: connect: Address already in use: 10.206.65.68:53 > sres_send_dns_query(003CD300, 0041B3D0) id=9637 A xxx.xxx.com (to > [192.168.0.1]:53) > > The problem is after this error sofia marks this nameserver as 'bad' > dns->dns_error = SRES_TIME_MAX; > and never uses it again. So always keeps trying to query the unreachable > server 192.168.0.1 > I've noticed running in the debugger we can query the 10.205.65.68 > nameserver as the > connect(s, (void *)dns->dns_addr, dns->dns_addrlen) succeeds > Without the debugger connected it always fails. > ie slowing things down makes it work. But what I am trying to work out is > why the initial connect on the socket fails. It seems to be because we made > an initial query to an unreachable server and the socket is maybe still in > use or something. > > Has anyone seen this issue before, any ideas how to resolve. > I did try setsockopt with SO_REUSEADDR, this time connect() succeeds but the > query doesn't get a response although this nameserver is a reachable one. So > i'm thinking the first query to 192.168.0.1 nameserver still causing a > problem. Can you try to use some kind of network tracing here to see what kind of requests are actually sent? > One final thing i would have thought using the sres library would result in > NAPTR query > rather than A but i am seeing only A type queries going out. That depends on the URIs. Request to <sip:talk21.com> would start resolving a NAPTR, but <sip:talk21.com:5060> (with explicit port) would start directly with an A record. -- Pekka.Pessi mail at nokia.com ------------------------------------------------------------------------------ _______________________________________________ Sofia-sip-devel mailing list Sofia-sip-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel