Subject: Re: I-D ACTION:draft-chakrabarti-ipv6-addrselect-api-03.txt

From: Samita Chakrabarti <[email-masked]>
Date: Fri, 22 Jul 2005 17:18:20 -0700 (PDT)

Hi Keiichi,

NOTE : [ Julien's address change: [email-masked] ]
> 
> I have one question about the usage of IPV6_PREFER_DST_LARGESCOPE and
> IPV6_PREFER_DST_SMALLSCOPE socket options.
> 
> I'm afraid I cannot imagine when I need to use the above socket
> options, since selection of a destination address is done by
> getaddrinfo() (or by specifying an address explicitly) I think.
> 
> Do you have any concrete idea of the usage of above socket options?

The idea is to use both IPV6_PREFER flags in conjunction with corresponding
 AI_PREFER_* flags in getaddrinfo().

RFC3484 Destination address selection rule #8 ( prefer smaller scope):

 Thus,     IPV6_PREFER_DST_SMALLSCOPE  is the default setting for a system.
 
 One example might be that if sender wants to use global destination
 address to talk to an onlink node for which it knows a smaller scope
 address.  In that situation, setting  LARGESCOPE
 socket option and passing AI flag to getaddrinfo() is recommended.
 
 Now, for DST flags, it may be possible to get away with AI_PREFER_* flags,
 but, implementations may vary in implementing getaddrinfo() for collecting
 potential source addresses (RFC3484 section 8). 
 Hence for portability and consistency reason, both setsockopt() and AI flags
  are recommended for destination scope. 

>From implementation point of view do you think IPV6_PREFER_DST_*SCOPE
is redundant across all systems ?
 
Thanks,
-Samita

--------------------------------------------------------------------
IETF IPv6 working group mailing list
[email-masked]
Administrative Requests: https://www1.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------

---

From: JINMEI Tatuya / 神明達哉<[email-masked]>
Date: Mon, 25 Jul 2005 16:34:51 +0900

>>>>> On Fri, 22 Jul 2005 17:18:20 -0700 (PDT), 
>>>>> Samita Chakrabarti <[email-masked]> said:

 
>  socket option and passing AI flag to getaddrinfo() is recommended.

For which socket are you intending to set the LARGESCOPE socket
option?  Could you show an example code fragment that uses this option
(e.g., containing calls to getaddrinfo(), socket(), and connect() or
sendto())?

> is redundant across all systems ?
 
I don't know about "all" systems, but I cannot just imagine meaningful
usage for this option.  And, if no one can provide concrete useful
usage, I don't think it a good idea to provide such a meaningless
option just for "consistency".

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.
					[email-masked]

---

From: Keiichi SHIMA <[email-masked]>
Date: Mon, 25 Jul 2005 21:56:23 +0900 (JST)

Hi Samita and Tatsuya,

From: JINMEI Tatuya / 神明達哉 <[email-masked]>
Date: Mon, 25 Jul 2005 16:34:51 +0900

> (e.g., containing calls to getaddrinfo(), socket(), and connect() or

I had the same feeling with Tatsuya.

For the particular case, that you quated, maybe we don't need
IPV6_PREFER_DST_ option.  If were you, I would write the following code:

hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PREFER_SRC_LARGESCOPE|AI_PREFER_DST_LARGESCOPE;
getaddrinfo("www.foobar.com", "http", &hints, &res0);
for every res in res0 {
    s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
    setsockopt(s, IPPROTO_IPV6, IPV6_PREFER_SRC_LARGESCOPE=on);
    connect(s, res->ai_addr, res->ai_addrlen);
    ...
}

I think specifying IPV6_PREFER_DST_XXX doesn't have any meaning,
because the destination address has already been chosen in
getaddrinfo().

> >   are recommended for destination scope. 

I agree that AI_PREFER_DST_XXX is necessary to give a user a chance to
choose preferred destination address based on the conditions you listed
in the draft.

> option just for "consistency".

---
Keiichi SHIMA
IIJ Research Laboratory <[email-masked]>
KAME Project <[email-masked]>