RE: GNOME over IPv6



Hi Mark,

> > 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.

    Thank you ! :-)

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

   We are testing both on Solaris and on Linux.

>
> > 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?

  If the build is done on one machine and the target is another and if the
target doesnt support IPv6, One might want to then disable 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 ...

  The scenario mentioned is very much possible. I hadnt thought about that.
The only reason i had in mind is that if the build m/c and the target m/c
are the same, and if this configure check were to fail, then we could
disable IPv6 altogether. Possibly we could check for the error value. It
would give an indication whether the protocol support is available.

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

  We check for specific functions required by the IPv6 code and without
which the IPv6 wouldn't work and would break compilation. In the patch we
check for required functions (in this case getaddrinfo()) during configure,
else we disable the build of the IPv6 code).

>
> > 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 ?

  If we could successfully create an AF_INET6 socket, we are on a host which
supports IPv6, so i could use the IPv6 specific features. Two reasons for
the above.
1. If we are on a host which doesnt support IPv6 (could possibly be that the
host is currently running on IPv4), then we fallback to IPv4
2. If we are on a host which supports IPv6, we assume that everthing is in
place and the use of IPv6 specific APIs would not cause a runtime breakage.

  As more and more implementations completely support IPv6 such stringent
compile and runtime checks could be removed.

> > 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 would also add
http://www.ietf.org/internet-drafts/draft-ietf-ipngwg-rfc2553bis-10.txt
which overrides RFC 2553 - Basic Socket Interface Extensions for IPv6

regards,
shivram

>	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]