i agree with steve, also i admit 2553bis should be more explicit about
        what is supposed to work (i.e. should tell people that multicast does
        not work with IPv4 mapped address).

>> I think we did discuss this is the past and concluded that the
>> v4-mapped v6 addresses were only meaningful when carrying IPv4
>> non-loopback, unicast addresses.  Thus, the IPv6 node should not
>> have to do multiple, different prefix checks to determine if an
>> address is a multicast address or a loopback address.
>Well, then I would like to beg and plead for a reconsideration.
>As someone writing a multicast app, I look at the unicast API with
>envy...   Three simple function calls and I'm ready to move data
>with either v4 or v6 hosts.
>       gethostinfo()
>       socket()
>       [bind()]
>       connect()

        getaddrinfo(3) is the way to go.  it will present you with
        necessary info (address family, whatever) together with the
        address you have.  the following code should do the right thing.
        if you hardcode AF_INET6 (or AF_INET), you lose in the future.

        please take a look at the following paper, it gives you a great detail
        about AF independent programming:
.%A Craig Metz
.%T Protocol Independence Using the Sockets API
.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
.%D June 2000

itojun


---
main()
{
        i = 0;
        /* initialize hints */
        getaddrinfo(mcastaddr, port, &hints, &res0);
        for (res = res0; res; res = res->ai_next) {
                switch (res->ai_family) {
                case AF_INET6:
                case AF_INET:
                        break;
                default:
                        exit(1);        /* unknown address family */
                }

                s[i] = socket(res->ai_familiy, res->ai_socktype, res->ai_protocol);
                if (s[i] < 0)
                        continue;

                /* do it if necessary */
                if (bind(s[i], res->ai_addr, res->ai_addrlen) < 0) {
                        close(s[i]);
                        continue;
                }

                switch (res->ai_family) {
                case AF_INET6:
                        /* IPV6_MULTICAST_IF, IPV6_JOIN_GROUP */
                        break;
                case AF_INET6:
                        /* IP_MULTICAST_IF */
                        break;
                }

                i++;
                continue;
        }
        if (i == 0);
                exit(1);        /*no listening socket */
        /* select loop on s[0] to s[i - 1] */
}
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to