

                    Link Address Resolution Algoritm
                   for Internet Protocol "Five Fields"
                  =====================================

This document describes specification for a resolution between IPv5
addresses and IEEE 802.3 Ethernet addresses, as well as a Duplicate 
Address Detection protocol. Other data-link layers may require separate
specifications.

Minimum Prefix:
The minimum prefix on Ethernet interfaces is /10.

On the Ethernet, instead of resolving a logical IP address to a physical
MAC address, we simply generate our own logical MAC addresses as a one-way
function from logical IP addresses.

Generating Logical MAC addresses
=================================

One-way function to generate MAC address is to put last 40-bits (four fields)
of an IPv5 address into a logical MAC container, beginning with
0A:xx:xx: xx:xx:xx

So let's take an IP address like this:
      382.201.769.25.133

IP:
2nd Field    - 3rd Field    - 4th field    - 5th field
00 1100 1001 - 11 0000 0001 - 00 0001 1001 - 00 1000 0101

Logical MAC address:
2nd Octet - 3rd Octet - 4th Octet - 5th Octet - 6th Octet

0011 0010 - 0111 0000 - 0001 0000 - 0110 0100 - 1000 0101 (binary)
0x 32     - 0x 70     - 0x 10     - 0x 64     - 0x 85     (hexa)

So our final logical MAC address will look like:
0A:32:70:10:64:85

This is a one-way function. You can convert any IPv5 address to
a logical MAC, but not the other way around, which is why minimal
IP prefix is /10.

ICMP frames for DAD

ICMP packet:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4|     Type                      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  8|     Reserved                  |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
 12|                      Source MAC address                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 16|                       IPv5 Session ID                         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   IP Fields:
   
   HTL = 1 (Hops-to-Live)
   Source IP Address = Destination IP Address

   ICMP Fields:

   Type: (16-bit)
     (proposed values; to be assigned by IANA)

   16 = DAD request
   17 = DAD reply

   Reserved (16-bit)           - Initialized to zero on transmission;
                                 ignored by receiver.

   Source MAC address (48-bit) - of the computer sending this packet.

   IPv5 Session ID (32-bit)    - an additional unique identifier to 
                                 detect duplicate MAC addresses.
                                 Randomly generated value during init.
                                 Does not change until stack reboot.

================================
Fast Duplicate Address Detection (Unicast)
================================
FDAD request:

Ethernet layer:
dst.MAC: 0A:32:70:10:64:85 (Unicast to Logical MAC of target IP;)
                            Derieved from 382.201.769.25.133 earlier.
src.MAC: B8:6B:23:7B:C3:79 (physical MAC of PC-"A")
src.IP: 382.201.769.25.133 (same as destination)
dst.IP: 382.201.769.25.133
IP5 session ID= AAA

FDAD reply:

dst.MAC: B8:6B:23:7B:C3:79 (physical MAC of PC-"A")
src.MAC: B8:6B:23:7B:C3:80 (physical MAC of PC-"B")
src.IP: 382.201.769.25.133 (same as destination)
dst.IP: 382.201.769.25.133
IP5 session ID= BBB

Duplicate IP detected !
(no reply = all good)

=======================================
Bonus: Duplicate MAC address detection
=======================================
If receiving station has the same physical MAC as received DAD request,
we compare IPv5 session ID. If it is different, we send a reply:

FDAD reply #2
dst.MAC: FF:FF:FF:FF:FF:FF (reply sent to Layer 2 broadcast,
                            to make sure it traverses ALL switces)
src.MAC: B8:6B:23:7B:C3:79 (physical MAC of PC-"C" & "A")

src.IP: 382.201.769.25.133 (same as destination)
dst.IP: 382.201.769.25.133
IP5 session ID= CCC

Duplicate IP & physical MAC detected !
(no reply = all good)

Limitation: What we do not detect ?
=====================================

If there is a duplicate (logical or physical) MAC address,
not running IPv5 it will go undetected by this algorithm.

Additionally, if after IPv5 stack is up-n-running, two broadcast 
domains with duplicate addresses were subsequently joined,
 we can't detect it in real-time.

Duplicate physical MAC but different IP.
NOTE: We do not care, since IPv5 uses logical MAP addresses for 
traffic. We do not detect this scenario.

Booting IPv5
=============
When booting an IPv5 stack, it must be put into "tentative mode",
until DAD procedure is complete.
Additionally, IPv5 stack must Randomly-generate an IPv5 Session ID,
 and "remember" it during an entire session,
 as well as it's "physical MAC address", to answer DAD requests.

Changing an IP address, either statically, via DHCP,
or otherwise requires a new DAD procedure.
Changing link up/down state also requires a new DAD procedure.

It is recommended to pereodically restart DAD procedure,
say once every 120-240 minutes. Configurable by OS vendor.
This partially solves the 2nd limitation.

What to do when there is a duplicate address ?
=================================================

If a duplicate address detected during IPv5 stack bootup,
it must be shut-down, and error reported to the user.
(via log, GUI dialog, console, SNMP, or otherwise)

If a duplicate address detected after IPv5 stack bootup,
it must be kept running, and error reported to the user.

Dual-Stack operation hints
===========================
For working with both IPv5 and IPv4/v6, the operating system
may either use "promiscuous mode" of an Ethernet controller,
to listen to multiple unicast MAC addresses, or move
IPv4/v6 to a new logical MAC address, used by IPv5.

If an Ethernet controller supports "standard mode" listening
to multiple unicast MAC addresses, it should be chosen.

Private MAC addresses
=====================
According to various sources on the Internet, the
following MAC address ranges are considered private.
Also known as "Locally Administered Address Ranges":

x2-xx-xx-xx-xx-xx
x6-xx-xx-xx-xx-xx
xA-xx-xx-xx-xx-xx
xE-xx-xx-xx-xx-xx
