Subject: update on src/dst selection algorithm

From: Alain Durand <[email-masked]>
Date: Thu, 14 Oct 1999 12:51:02 +0200

I've tried to modify my algorithm to integrate Erik's comment.

The interesting thing is that it is generic enough and can be extended
easily to other class of addresses.

Lets define the precedence prec of an address as the following function
prec(link local) = 10
prec(site local) = 20
prec(native-v6 global, non 6to4) = 30
prec(native-V6 global, 6to4) = 35
prec(IPv4 compatible) = 50

Note1: those are suggested default value. They can be override manually
by configuration options if one does not like this specific order.

Note2: we are only considering valid, non deprecated addresses.

0. Consider the set P0 of all possible pairs source x destination addresses,
1. Consider the subset P1 of P0 of all possible pairs source x destination
     so that prec(source) = prec(destination)

2. If P1 is not empty,
     there is a least a match of precedence between source and destination
  2.0 Let LP be the lowest precedence of all pairs
  2.1. Consider the subset P2 of P1 of all pairs source x destination of 
precedence LP
  2.2. If P2 is not reduce to a single pair, choose either
         - longest prefix match
         - DNS order for dst
         - random selection

3. If P1 is empty,
     there is no match of precedence between source and destination,
     communication may actually not be possible,
     we have some heuristic to try to connect.
  3.0 Consider D0 the set of all possible destination addresses
  3.1 Consider the subset D1 of D0 of destination addresses dst of the lowest
        precedence prec(dst)
  3.2 If D1 is not reduced to one address, one may pick
        the first one returned by the DNS or use random selection.
  3.3 Consider S0 the set of all possible source addresses
  3.4 Consider the subset S1 of S0 of all possible source addresses of
        precedence > prec(dst)
  3.5 If S1 is not empty,
   3.5.0 Consider S2 the subset of S1 of source addresses of the lowest 
precedence
   3.5.1 If S2 is not reduced to one address, one may use longest prefix match
           with dst or random selection.
  3.6 If S1 is empty
   3.6.0 Consider S3 the subset of S1 of source addresses of the highest 
precedence
   3.6.1 If S3 is not reduced to one address, one may use longest prefix match
            with dst or random selection.
  3.7 If the communication failed (scope too small for example), remove dst 
from
        the subset D0 and reiterate at step 3.1.

In the case of a simple application that select the first address returned by
the DNS and let the kernel fix the source address, this algorithm
can still be used by the kernel with only one destination address.

	- Alain.

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