| 14 | |
| 15 | The proposal is comprised of two parts. One is a change to the `refid` value for IPv6 addresses, and the other goes to a recommended way of selecting a `refid` that will identify the current host. |
| 16 | |
| 17 | To select an IP to be used as the basis for a host's `refid`: |
| 18 | |
| 19 | * load any list of "do-not-use IPs" |
| 20 | * Scan the list of "up" IPs, ignoring any in the "do-not-use" list |
| 21 | |
| 22 | Call the IPs we have found "list A". |
| 23 | |
| 24 | If a mechanism exists to identify when there is a change to an interface, repeat the above steps, saving the results in "list B". |
| 25 | |
| 26 | For each IP in "list A", see if that IP is in "list B". If it is not, remove the IP from "list A". |
| 27 | |
| 28 | For each IP in "list B", see if that IP is in "list A". If it is not, add the IP to the end of "list A". |
| 29 | |
| 30 | Assign the first entry in "list A" to `candidate_IP`. |
| 31 | |
| 32 | For each of the remaining IPs in "list A", see if the new IP is "more routable" than the `candidate_IP`. If it is, remember it as the new `candidate_IP`. |
| 33 | |
| 34 | The following list shows how "routable" an IP is. |
| 35 | |
| 36 | For IPv4 addresses, the following list goes from least to most routable: |
| 37 | * an address in 127.0.0.0/8 |
| 38 | * an address in RFC1918 space |
| 39 | * any other address |
| 40 | |
| 41 | For IPv6 addresses, the following list goes from least to most routable: |
| 42 | * a localhost address |
| 43 | * an interface-local address |
| 44 | * … |
| 45 | * Unicast addresses |
| 46 | |
| 47 | If the `candidate_IP` is an IPv4 address, use that value for the `refid`. |
| 48 | |
| 49 | If the `candidate_IP` is an IPv6 address: |
| 50 | * Generate an `md5` hash of the address |
| 51 | * set the `refid` to (0xF0000000. 0xF0000000, or 0xFF000000) |
| 52 | * get the high-order 32 bits of the hash. |
| 53 | * AND these 32 bits with (0x0FFFFFFF, 0x07FFFFFF, or 0x00FFFFFF) |
| 54 | * OR this result with the `refid`. |
| 55 | |