Re: [Jsonrpc-cpp-devel] Fix to adapt IPV6 and IPV4 on same socket
Brought to you by:
s-vincent
From: Peter Spiess-K. <de...@sp...> - 2015-12-18 08:17:34
|
Hi Anoop! On 12/18/2015 08:01 AM, Anoop Ravi wrote: > Hi, > > > > I could find a bug in jsonrpc-cpp module while trying to adopt > ipv6 capability to my application. I tried to bind my server application > to all ip addresses (ipv4 and v6 at the same time) using “::”. I found a > comment line in “src/networking.cpp” which says “accept IPv6 OR IPv4 on > the same socket”. As the comment says, the server socket should accept > both V4 and V6 in the same socket. So I tried to communicate to my > server application using its IPV4 address, It didn’t work while > connecting with its V6 counterpart was working. > > The TCP implementation was kind of prototype. That's why it is still on the develop branch. It is contributed code by a third-party. I also detected lots of flaws in it and probably I will remove it again, until I have the time to give it a deep review and fix the bugs. > > This made me peek into networking.cpp source code to see the > socket options. In “setsockopt()”, a parameter decides the flexibility > of the socket to accept both ip versions or not. > > > > /on = 1; / > > /setsockopt//(//sock//,// IPPROTO_IPV6//,//IPV6_V6ONLY//,// //&//on//,// //sizeof//(//on//));/// > > > > Here the variable is set to value ‘1’, which doesn’t allow both ip > versions simultaneously. This contradicts with the comment given there. > > > > /on //=// //0//;/ > > /setsockopt//(//sock//,// IPPROTO_IPV6//,//IPV6_V6ONLY//,// //&//on//,// //sizeof//(//on//));/// > > > > Instead its value should be ‘0’. Modifying this value made my > application work as expected. > > Thanks for taking the time reporting this. > > I think this is a bug in the implementation. I couldn’t find any > bugzilla or other bug tracking tools. Hence posting it here. > > The library is officially maintained at Github. If you refuse to sign-up on GitHub (which I would totally understand), you can always post your findings here on the mailing list. https://github.com/cinemast/libjson-rpc-cpp > > Best Regards, > > Anoop Ravi > > Greetings Peter |