Re: GNOME over IPv6



Hi Shivram,

On Thu, 2003-02-13 at 02:43, Shivram U wrote:
> Hi,
>   Me and a few of my collegues are working on porting GNOME
> applications/libraries to work with the IPv6 protocol. 

	Great news ! :-)

> Currently we are
> working on porting esound and gnome-vfs. The patch for esound is ready and
> attached to this mail. 

	I haven't looked in detail at the patch, sorry ... no time and its not
my place anyhow ...

> I have attached a small write up on how we are
> proceeding with this task. The write up goes into the following details
> a) A brief introduction to the concepts of IPv6.
> b) Porting aspects to be considered.
> c) Code changes to be done.
> d) Code examples to illustrate IP6 code mixed with IPv4 code.
> 
>   Please do have a look at the write up and the attached patch.

	The writeup is very useful. Some comments below.

	Also, out of curiousity, what platforms are you guys testing this on.
Solaris or Linux or both ?

 
> Changes to configure.in
> -----------------------
>  The configure script would contain an additional configurable parameter "--enable-ipv6". By default IPv6 is enabled if the build system is IPv6 enabled. This can be turned off explicitly by passing "--enable-ipv6=no" to the configure script.
>  
>  C_MSG_CHECKING([whether to enable ipv6])
> AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable IPv6 extensions],
> [ case "$enableval" in
>         no)
>                 AC_MSG_RESULT(no)
>                 ipv6=no
>                 ;;
>         *)
>                 AC_MSG_RESULT(yes)
>                 ipv6=yes
>                 ;;
>         esac ],
>         AC_TRY_RUN([ /* AF_INET6 available check */
> #include <sys/types.h>
> #include <sys/socket.h>
> main()
> {
>  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
>    exit(1);
>  else
>    exit(0);
> }
> ],
>   AC_MSG_RESULT(yes)
>   AC_DEFINE(ENABLE_IPV6)
>   ipv6=yes,
>   AC_MSG_RESULT(no)
>   ipv6=no,
>   AC_MSG_RESULT(no)
>   ipv6=no
> ))
> 
> if ipv6=yes; then
>   .. specific functions like getaddrinfo () tests
> fi
> 
>  In the above changes to configure.in, --enable-ipv6 is turned on by default, and if --enable-ipv6 is not "no" then, we try to run a program which tries to create a socket with address family AF_INET6. If the program exits with a return value of 0, then the build system IPv6 is supported. We then define the variable ENABLE_IPV6.

	Is any of this really neccessary ?

	1) Why would people want to turn off ipv6 support?
	2) Why the runtime socket(AF_INET6... check ? Surely if AF_INET6 	   is
defined that's enough to know that IPv6 support is 
	   available? We wouldn't want some build time resource 	  
unavailability (which might cause socket() to fail) to 
	   unintentionally disable IPv6 support ...

	In linc, we just use '#if defined(AF_INET6)'

> Developing applications/libraries that work with/without IPv6 support
> ---------------------------------------------------------------------
>  The application/libraries that are made IPv6 aware should still work on systems that implement only IPv4.
>  The following runtime check would be useful  
> 
> int ipv6_supported()
> {
>  int s;
> 
> #if defined (ENABLE_IPV6)
>   s = socket (AF_INET6, SOCK_STREAM, 0);
>   if (s != -1) {
>     (void) close (s);
>     return 1;
>   }
> #endif
>   return 0;
> }

	Hmm, I didn't see this before making the comments above - now I'm even
more concerned. Why is this runtime check neccessary ?
 
> References
> ----------
> RFC 2553 - Basic Socket Interface Extensions for IPv6
> IPv6 Overview paper available at http://playground.sun.com/pub/ipng/html/INET-IPng-Paper.html
> "Porting Networking Applications to the IPv6 APIs" available from http://www.sun.com/solaris/ipv6/

	I'd also recommend Richards Stevens' "Unix Network Programming Vol. 1".
I'd run a mile if someone asked me to do some sockets coding and I
didn't have this book handy ... :-)


Cheers,
Mark.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]